-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
CPython 3.8.4 regression on __setattr__ in multiinheritance with metaclasses #85467
Comments
CPython 3.8.4 broke previously correct custom __setattr__ implementation, when metaclass inheritances from multiple classes, including not-meta. Following code:
Works in Python up to 3.8.3, but in 3.8.4 it raises: Traceback (most recent call last):
File "repr.py", line 13, in <module>
obj.test = True
File "repr.py", line 3, in __setattr__
type.__setattr__(cls, key, value)
TypeError: can't apply this __setattr__ to DefaultMeta object This change affects e.g. pallets-eco/flask-sqlalchemy#852 |
The error message is coming from hackcheck function in Objects/typeobject.c, Lines 5811 to 5845 in b4cd77d
|
The regression was introduced in commit 8912c18 $ git checkout v3.8.4
$ ./configure -C
$ make
$ $ ./python bpo41295.py
Traceback (most recent call last):
File "bpo41295.py", line 14, in <module>
obj.test = True
File "bpo41295.py", line 3, in __setattr__
type.__setattr__(cls, key, value)
TypeError: can't apply this __setattr__ to DefaultMeta object $ git revert 8912c182455de83e27d5c120639ec91b18247913
[detached HEAD 8d3c7847a0] Revert "bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092) (GH-21339)"
3 files changed, 11 insertions(+), 117 deletions(-)
$ make
$ ./python bpo41295.py
True |
Stefan, please take a look. |
It appears to be solved in Flask-SQLAlchemy's development version already, as the mixins now inherit from |
Just sent a PR that fixes the issue (a first approach), let me know if it's addressing the issue correctly or if there's a better way. Thanks! |
David, which issue number is this? |
We have a buildbot failure: test_asyncio altered the execution environment. What does that mean? Victor? |
@Stefan: Today I run unit tests for Flask-SQLAlchemy (v2.4.3) as well as for aioxmpp (another library reported this problem https://github.com/horazont/aioxmpp/issues/342). In both cases patch is successful: tests fail on Python 3.8.4 but pass on patched Python. As for me it looks done. Thanks for everyone involved! |
@kam193 Thanks for running the aioxmpp tests. I built the patched python yesterday, but I didn’t manage to get a virtualenv with it up&running. Good to hear that the fix works as expected! |
That happened several times before in previous builds. I think there's just a part of the asyncio tests that is unreliable. I left a comment in bpo-41273 since it might be related, the sporadic failures started appearing in the build following the merge. |
@jonas: I know, running those tests isn't so easy, I think a few libraries are incompatible with python 3.9/3.10 yet or I didn't find right prerequisites. But fortunately, everything is running on patched 3.8, so after back-porting I can run it |
@Łukasz: this should be good for the 3.8.5 release. |
Released. |
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: