Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b3e775a

Browse filesBrowse files
authored
fix Cursor.executemany created many circular references (PyMySQL#375)
1 parent 23addef commit b3e775a
Copy full SHA for b3e775a

File tree

Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed

‎MySQLdb/cursors.py

Copy file name to clipboardExpand all lines: MySQLdb/cursors.py
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,17 @@ def ensure_bytes(x):
110110
return x
111111

112112
if isinstance(args, (tuple, list)):
113-
return tuple(literal(ensure_bytes(arg)) for arg in args)
113+
ret = tuple(literal(ensure_bytes(arg)) for arg in args)
114114
elif isinstance(args, dict):
115-
return {ensure_bytes(key): literal(ensure_bytes(val))
116-
for (key, val) in args.items()}
115+
ret = {ensure_bytes(key): literal(ensure_bytes(val))
116+
for (key, val) in args.items()}
117117
else:
118118
# If it's not a dictionary let's try escaping it anyways.
119119
# Worst case it will throw a Value error
120-
return literal(ensure_bytes(args))
120+
ret = literal(ensure_bytes(args))
121+
122+
ensure_bytes = None # break circular reference
123+
return ret
121124

122125
def _check_executed(self):
123126
if not self._executed:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.