mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 11:10:58 +08:00
fix Cursor.executemany created many circular references (#375)
This commit is contained in:
@ -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:
|
||||||
|
Reference in New Issue
Block a user