Skip to content
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

FusedFunctionObject half-initialized during GC tracking #3215

Closed
achernomorov opened this issue Oct 28, 2019 · 2 comments
Closed

FusedFunctionObject half-initialized during GC tracking #3215

achernomorov opened this issue Oct 28, 2019 · 2 comments

Comments

@achernomorov
Copy link

There are new CPython behavior about GC tracking of half initialized objects https://bugs.python.org/issue38392.

FusedFunctionObject is about to be in half-initialized state then base CyFunctionObject "constructor" calls GC_Track.

So...

../Modules/gcmodule.c:2019: visit_validate: Assertion failed: PyObject_GC_Track() object is not valid
Enable tracemalloc to get the memory block allocation traceback

object address : 0x7fcc7c1109b0
object refcount : 1
object type : 0x7fcc6a4c1660
object type name: fused_cython_function
object repr : <cyfunction get_nonzero_line at 0x7fcc7c1109b0>

Fatal Python error: _PyObject_AssertFailed
Python runtime state: initialized


Reproduce

Env
python 3.9 ( latest from github)
./configure --with-pydebug --enable-profiling
Python need to be build with PY_DEBUG - issue38392 is new functionality so it under PY_DEBUG for now.

Code

import scipy.ndimage._ni_label

achernomorov added a commit to achernomorov/cython that referenced this issue Oct 28, 2019
@scoder scoder closed this as completed in c964bfd Apr 11, 2020
@scoder scoder added this to the 3.0 milestone Apr 11, 2020
@scoder
Copy link
Contributor

scoder commented Apr 11, 2020

Thanks for the report and the PR. I ended up rewriting parts of it in c964bfd to get a bit of additional cleanup along the way and avoid unused C function warnings.

@scoder scoder modified the milestones: 3.0, 0.29.17 Apr 13, 2020
scoder added a commit that referenced this issue Apr 13, 2020
…stantiating a fused function before the object fields of the fused function subtype are fully initialised.

See https://bugs.python.org/issue38392
Closes GH-3215.
Supersedes GH-3216.
@scoder
Copy link
Contributor

scoder commented Apr 13, 2020

Backported to 0.29.17 in b3c2e0d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants