-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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 when setting attribute with string subclass as the name (--with-pydebug) #91059
Comments
The script below fails with an assertion error with python 3.11a5+ (current trunk) when build with --with-pydebug: # BEGIN OF FILE
class String(str):
__slots__ = ()
name = String("hello")
class Bag:
pass
o = Bag()
setattr(o, name, 42) # END OF FILE Error output: % /tmp/py311/bin/python3 -Xdev str.py (master)pyobjc-8 Current thread 0x0000000100a98580 (most recent call first): |
A hard crash seems wrong to me, and I'm not convinced yet that checking that the type of the attribute name is exactly string is correct. Found while debugging a crash in PyObjC's testsuite, PyObjC uses a subclass of str to represent Objective-C strings. Using such instances works fine in practice, but causes a crash in a --with-pydebug build due to this assertion. |
a8b9350 is the first bad commit
|
Ronald, does PR 31658 fix your issue? |
Your PR fixed the issue for me. |
The PR introduced some deprecation warnings in tests. ./python -Wall -m test test_unicode == Tests result: SUCCESS == 1 test OK. Total duration: 952 ms |
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: