mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Fix memory leak on attributes.
This commit is contained in:
parent
26cc63f867
commit
03e5bc02c9
2 changed files with 16 additions and 6 deletions
|
@ -607,7 +607,9 @@ class ObjVisitor(PickleVisitor):
|
|||
for a in sum.attributes:
|
||||
self.emit("value = ast2obj_%s(o->%s);" % (a.type, a.name), 1)
|
||||
self.emit("if (!value) goto failed;", 1)
|
||||
self.emit('PyObject_SetAttrString(result, "%s", value);' % a.name, 1)
|
||||
self.emit('if (PyObject_SetAttrString(result, "%s", value) < 0)' % a.name, 1)
|
||||
self.emit('goto failed;', 2)
|
||||
self.emit('Py_DECREF(value);', 1)
|
||||
self.func_end()
|
||||
|
||||
def simpleSum(self, sum, name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue