-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Crash in ModuleType subclass with __slots__ #91047
Comments
The following crashes the interpreter in Python 3.11, and works fine in older versions: # --- script.py
import types
class MyModule (types.ModuleType):
__slots__ = (
"_MyModule__a",
"_MyModule__b",
)
def __init__(self, name):
super().__init__(name)
m = MyModule("name")
# -- end of file The key in this is the This is a reproducer based on code in PyObjC. |
This is with python 3.11 alpha 5 using the installer for macOS. |
The crash itself happens during garbage collection: % python3.11 -Xdev t.py (master)pyobjc-8 Current thread 0x0000000104ce0580 (most recent call first): And when using a debug build and -Xdev: ../Modules/gcmodule.c:2187: visit_validate: Assertion failed: PyObject_GC_Track() object is not valid object address : 0x101a5f690 Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed Current thread 0x00000001019c0580 (most recent call first): |
The debug build seems to indicate that slot memory is not initiated properly, a stack trace (note the argument to visit_validate at frame #7):
|
Bisected to here: c3f52b4 is the first bad commit
|
@pablo: this is a possible release blocker, hard crash for code that works in earlier releases. That said, I have a workaround on my end and IMHO a fix could wait for the next alpha. |
Marking this as release blocker. |
Dennis, thanks for bisecting this. |
I don't feel qualified to review the PR, but can confirm that this PR fixes this issue as well as the crash in PyObjC that I extracted my reproducer from. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: