Bug report
Bug description:
I developed a C extension in the past that used to work for Python 3.9~3.11.4 without issues or crashes. Then After 3.11.9 and 3.12.0 all the way to the latest release of 3.12 I noticed that my call to self->async_task = (PyObject*)PyObject_New(AsyncExecutorTask, &PyAsyncExecutorTaskObject); no longer would automatically call the tp_new slot in PyAsyncExecutorTaskObject which is a hidden object member within my C extension code that I created a year ago. As such it puts my object into bad state and when I debug the start function right on it's Py_RETURN_NONE would be rerun automatically after it should have returned, this is fine until it gets to that objects tp_dealloc member function that it then crashes python with an access violation after it properly frees it's member objects (a few PyObject *'s). Somehow it seems to AV when it tries to rerun this statement at the end of it's dealloc function: Py_TYPE(self)->tp_free((PyObject*)self);. Most likely this is due to this problem where tp_new on that object itself is getting skipped from being called which then results in tp_alloc on it not being called which results in the access violation that I face in my code.
Gist with simplified code that should reproduce this problem: https://gist.github.com/AraHaan/6746d7e91c9c3f54e3fc446c601da698 (gist also includes a test python script to debug the code in VS2022 using the Python Tools workload).
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Windows
Bug report
Bug description:
I developed a C extension in the past that used to work for Python 3.9~3.11.4 without issues or crashes. Then After 3.11.9 and 3.12.0 all the way to the latest release of 3.12 I noticed that my call to
self->async_task = (PyObject*)PyObject_New(AsyncExecutorTask, &PyAsyncExecutorTaskObject);no longer would automatically call thetp_newslot inPyAsyncExecutorTaskObjectwhich is a hidden object member within my C extension code that I created a year ago. As such it puts my object into bad state and when I debug thestartfunction right on it'sPy_RETURN_NONEwould be rerun automatically after it should have returned, this is fine until it gets to that objectstp_deallocmember function that it then crashes python with an access violation after it properly frees it's member objects (a few PyObject *'s). Somehow it seems to AV when it tries to rerun this statement at the end of it's dealloc function:Py_TYPE(self)->tp_free((PyObject*)self);. Most likely this is due to this problem wheretp_newon that object itself is getting skipped from being called which then results intp_allocon it not being called which results in the access violation that I face in my code.Gist with simplified code that should reproduce this problem: https://gist.github.com/AraHaan/6746d7e91c9c3f54e3fc446c601da698 (gist also includes a test python script to debug the code in VS2022 using the Python Tools workload).
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Windows