[Python-Dev] Re: Removal of _Py_ForgetReference from public header in 3.9 issue

2020年6月15日 02:07:02 -0700

On 2020年06月14日 22:10, [email protected] wrote:
Please excuse if this is the wrong mailing list. I couldn't find one for module 
maintainers.
This is relevant to [email protected]; let's continue here.
I maintain an open source Python module in C. I'm trying to verify for the first time 
that the module still works with cpython 3.9. This module does *not* use the 
"limited" C API.
In building my module against 3.9b3, I'm getting a missing declaration warning 
on _Py_ForgetReference. My module builds and passes test fine, this is just a 
compiler warning issue.
What does the _Py_ForgetReference function do? The [documentation] says it's only for use in the interpereter core, so I'd assume it's .
[documentation]: https://docs.python.org/3/c-api/refcounting.html
The change that caused this was made in:
 commit f58bd7c1693fe041f7296a5778d0a11287895648
 Author: Victor Stinner <[email protected]>
 Date: Wed Feb 5 13:12:19 2020 +0100
 bpo-39542: Make PyObject_INIT() opaque in limited C API (GH-18363)
 ...
I definitely need the _Py_ForgetReference call for a particularly hairy error 
condition (https://github.com/jnwatson/py-lmdb/blob/master/lmdb/cpython.c#L888 
if you're curious). In fact, my tests will seg fault if I don't have that call 
and trace refs is enabled.
I can't follow the reasoning behind the code easily. Why do you use _Py_ForgetReference and PyObject_Del, instead of Py_DECREF(self)?
Should I put an #ifdef Py_TRACE_REFS around the call? Ignore it? What do you 
think is the proper resolution?
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/4EOCN7P4HI56GQ74FY3TMIKDBIPGKL2G/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to