Py_TRASHCAN_SAFE_BEGIN/END in C extension?

Barry Scott barry at barrys-emacs.org
Wed Dec 22 06:09:21 EST 2021



> On 22 Dec 2021, at 08:14, Marco Sulla <Marco.Sulla.Python at gmail.com> wrote:
> 
> Yes, it's deprecated, but I need it for Python 3.7, since there was
> yet no Py_TRASHCAN_BEGIN / END

Hopefully the bug report will makes clear what you have to do in your code to get things working.

Barry

> 
> On Tue, 21 Dec 2021 at 23:22, Barry <barry at barrys-emacs.org> wrote:
>> 
>> 
>> 
>> On 21 Dec 2021, at 22:08, Marco Sulla <Marco.Sulla.Python at gmail.com> wrote:
>> 
>> In Python 3.7, must Py_TRASHCAN_SAFE_BEGIN - Py_TRASHCAN_SAFE_END be
>> used in a C extension?
>> 
>> I'm asking because in my C extension I use them in the deallocator
>> without problems, but users signalled me that they segfault in Python
>> 3.7 on Debian 10. I checked and this is true.
>> 
>> 
>> I searched the web for Py_TRASHCAN_SAFE_BEGIN
>> And that quickly lead me to this bug.
>> 
>> https://bugs.python.org/issue40608.
>> 
>> That gives lots of clues for what might be the problem.
>> It seems that is a deprecated api.
>> 
>> Barry
>> 
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>> 
> 



More information about the Python-list mailing list