-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Multiple warnings and asserts triggered in debug CPython 3.11 #33765
Comments
cc @pitrou |
This is a bit weird: all these classes and methods are generated by Cython and we're not doing anything particularly advanced in that regard. Did you build PyArrow yourself? |
No, this is pyarrow 10.0.1 from PyPI. Note that I compiled Python myself with |
@jorisvandenbossche @AlenkaF One of us should definitely take a look at it. Perhaps upgrading Cython on our wheel build jobs would be enough? |
I didn't yet further investigate, but at least I can confirm that I also get those warnings using a debug build of Python 3.11 and the latest pyarrow installed as a wheel. And the same with pyarrow installed using conda. BTW, it seems that conda-forge just has a python debug build since two weeks (conda-forge/python-feedstock#597), so that's an easy way to get it ( I can try to further look at it in one of the coming days.
I would assume that we use the latest cython already (at the time of building the wheel, of course, but the conda-package is more recent). But will try with building pyarrow locally. |
Summary of my findings up to now. The warning comes from python/cpython#95324 (PR: python/cpython#95325). This warning was added to Python 3.11 in debug mode to help people catch bugs when an object doesn't call This is only relevant for objects that support garbage collection (have the static void __pyx_tp_dealloc_7pyarrow_3lib_Array(PyObject *o) {
struct __pyx_obj_7pyarrow_3lib_Array *p = (struct __pyx_obj_7pyarrow_3lib_Array *)o;
#if CYTHON_USE_TP_FINALIZE
if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
if (PyObject_CallFinalizerFromDealloc(o)) return;
}
#endif
PyObject_GC_UnTrack(o);
__Pyx_call_destructor(p->sp_array);
Py_CLEAR(p->type);
Py_CLEAR(p->_name);
#if CYTHON_USE_TYPE_SLOTS
if (PyType_IS_GC(Py_TYPE(o)->tp_base))
#endif
PyObject_GC_Track(o);
__pyx_tp_dealloc_7pyarrow_3lib__Weakrefable(o);
} So cython correctly includes a I am not sure what then causes the warning to be raised. Should cython not track GC again before calling dealloc of Weakrefable? Or is that a "bug" in the warning upstream in cpython that it should not raise the warning in the dealloc of the base class without GC of a class with GC? The crash seems to be related in the sense that code that is not expecting an exception is now raising one. For that code snippet, I get the traceback:
My understanding is that our code raises an error (because we can't convert the |
I would suggest reporting it to Cython. |
Yeah, in the meantime I checked that removing the |
Opened cython/cython#5231 with a minimal reproducer |
Describe the bug, including details regarding any error messages, version, and platform.
CPython can be built in debug mode to catch some maybe-fatal-maybe-not errors. We have such python3.11 configured with
--with-pydebug
and pyarrow 10.0.1 installed, here is an example of gc warningsimilar code sometimes triggers assertion
Another crash
Component(s)
Python
The text was updated successfully, but these errors were encountered: