Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
d5da2dbc
Commit
d5da2dbc
authored
Apr 27, 2019
by
Stefan Behnel
Committed by
GitHub
Apr 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2930 from pablogsal/2929
Clean weakrefs before calling user's dealloc
parents
eb40e5d1
82b029b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+7
-3
No files found.
Cython/Compiler/ModuleNode.py
View file @
d5da2dbc
...
@@ -1475,12 +1475,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -1475,12 +1475,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
UtilityCode
.
load_cached
(
"PyTrashcan"
,
"ExtensionTypes.c"
))
UtilityCode
.
load_cached
(
"PyTrashcan"
,
"ExtensionTypes.c"
))
code
.
putln
(
"__Pyx_TRASHCAN_BEGIN(o, %s)"
%
slot_func_cname
)
code
.
putln
(
"__Pyx_TRASHCAN_BEGIN(o, %s)"
%
slot_func_cname
)
# call the user's __dealloc__
self
.
generate_usr_dealloc_call
(
scope
,
code
)
if
weakref_slot
:
if
weakref_slot
:
# We must clean the weakreferences before calling the user's __dealloc__
# because if the __dealloc__ releases the GIL, a weakref can be
# dereferenced accessing the object in an inconsistent state or
# resurrecting it.
code
.
putln
(
"if (p->__weakref__) PyObject_ClearWeakRefs(o);"
)
code
.
putln
(
"if (p->__weakref__) PyObject_ClearWeakRefs(o);"
)
# call the user's __dealloc__
self
.
generate_usr_dealloc_call
(
scope
,
code
)
if
dict_slot
:
if
dict_slot
:
code
.
putln
(
"if (p->__dict__) PyDict_Clear(p->__dict__);"
)
code
.
putln
(
"if (p->__dict__) PyDict_Clear(p->__dict__);"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment