diff options
author | KIMURA Chikahiro <chi-kimura@xr.jp.nec.com> | 2017-08-07 17:48:08 +0900 |
---|---|---|
committer | Jason Madden <jamadden@gmail.com> | 2017-09-11 07:55:21 -0500 |
commit | a11c5e20c2e25a5f7f32f1c11e4d4f47322ff3bb (patch) | |
tree | f4fdba9deb5a009c9655718ce7ea847b95e54883 | |
parent | a19b95f381047bf1b957c2b83cb9cf0f42897cbb (diff) | |
download | zope-security-a11c5e20c2e25a5f7f32f1c11e4d4f47322ff3bb.tar.gz |
call PyObject_GC_UnTrack() in tp_dealloc()
see the following sites for details:
* https://bugs.python.org/issue31095
* https://github.com/python/cpython/pull/2974
Fixes #35.
-rw-r--r-- | CHANGES.rst | 3 | ||||
-rw-r--r-- | src/zope/security/_proxy.c | 1 | ||||
-rw-r--r-- | src/zope/security/_zope_security_checker.c | 1 |
3 files changed, 5 insertions, 0 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index ab5790b..53329d8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changes 4.1.2 (unreleased) ------------------ +- Fix the extremely rare potential for a crash when the C extensions + are in use. See `issue 35 <https://github.com/zopefoundation/zope.security/issues/35>`_. + - Fix `issue 7 <https://github.com/zopefoundation/zope.security/issues/7`_: The pure-Python proxy didn't propagate ``TypeError`` from ``__repr__`` diff --git a/src/zope/security/_proxy.c b/src/zope/security/_proxy.c index 5108065..04321d7 100644 --- a/src/zope/security/_proxy.c +++ b/src/zope/security/_proxy.c @@ -343,6 +343,7 @@ proxy_clear(SecurityProxy *self) static void proxy_dealloc(SecurityProxy *self) { + PyObject_GC_UnTrack((PyObject*)self); proxy_clear(self); SecurityProxyType.tp_base->tp_dealloc((PyObject*)self); } diff --git a/src/zope/security/_zope_security_checker.c b/src/zope/security/_zope_security_checker.c index e5a2528..82edbbf 100644 --- a/src/zope/security/_zope_security_checker.c +++ b/src/zope/security/_zope_security_checker.c @@ -368,6 +368,7 @@ Checker_clear(Checker *self) static void Checker_dealloc(Checker *self) { + PyObject_GC_UnTrack((PyObject*)self); Checker_clear(self); Py_TYPE(self)->tp_free((PyObject*)self); } |