fix Cursor.executemany created many circular references (#375)

This commit is contained in:
Inada Naoki
2019-08-08 18:55:21 +09:00
committed by GitHub
parent 23addef86d
commit b3e775a780

View File

@ -110,14 +110,17 @@ class BaseCursor(object):
return x return x
if isinstance(args, (tuple, list)): if isinstance(args, (tuple, list)):
return tuple(literal(ensure_bytes(arg)) for arg in args) ret = tuple(literal(ensure_bytes(arg)) for arg in args)
elif isinstance(args, dict): elif isinstance(args, dict):
return {ensure_bytes(key): literal(ensure_bytes(val)) ret = {ensure_bytes(key): literal(ensure_bytes(val))
for (key, val) in args.items()} for (key, val) in args.items()}
else: else:
# If it's not a dictionary let's try escaping it anyways. # If it's not a dictionary let's try escaping it anyways.
# Worst case it will throw a Value error # Worst case it will throw a Value error
return literal(ensure_bytes(args)) ret = literal(ensure_bytes(args))
ensure_bytes = None # break circular reference
return ret
def _check_executed(self): def _check_executed(self):
if not self._executed: if not self._executed: