[issue44588] Possible double Py_XDECREF in cpython typeobject.c

2021-07-20 Thread Ziyue Jiang
Ziyue Jiang added the comment: Thanks for replying. I did fix my code by adding Py_TPFLAGS_DEFAULT. It's okay. I just think the behavior is a little strange when I don't set the default flag, thus adding this issue. -- ___ Python track

[issue44588] Possible double Py_XDECREF in cpython typeobject.c

2021-07-09 Thread Ziyue Jiang
Ziyue Jiang added the comment: I just take over a Python3.6 project from a friend, migrating it to the newest Python version. Then this problem happened. After debugging, I think it's a possible double Py_XDECREF if using C-API like this. But I'm not familiar with Python C-API bef

[issue44588] Possible double Py_XDECREF in cpython typeobject.c

2021-07-09 Thread Ziyue Jiang
Ziyue Jiang added the comment: Sorry, not inherited from Time, Time is the class I use in a real project. Time -> A -- ___ Python tracker <https://bugs.python.org/issu

[issue44588] Possible double Py_XDECREF in cpython typeobject.c

2021-07-09 Thread Ziyue Jiang
Ziyue Jiang added the comment: I have no detailed code. The way to I produce it is that using PyType_FromSpec() to generate a type A without the flag Py_TPFLAGS_DEFAULT(which sets the flag Py_TPFLAGS_HAVE_VERSION_TAG). Then compile and run in Python. from my_pkg import A class Time1(Time

[issue44588] Possible double Py_XDECREF in cpython typeobject.c

2021-07-09 Thread Ziyue Jiang
Ziyue Jiang added the comment: Maybe a little complicared but you can still construct a case to trigger the double free action, thus causing a SIGABRT. Program received signal SIGABRT, Aborted. 0x77c3718b in raise () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) bt #0

[issue44588] Possible double Py_XDECREF in cpython typeobject.c

2021-07-09 Thread Ziyue Jiang
New submission from Ziyue Jiang : The type_mro_modified() function in Object/typeobject.c may produce double Py_XDECREF on mro_meth and type_mro_meth when enter the code: if (!_PyType_HasFeature(cls, Py_TPFLAGS_HAVE_VERSION_TAG) || !PyType_IsSubtype(type, cls)) { goto clear; } I think