Repository navigation
_PyObject_StoreInstanceAttribute assertion fails in setattr after __dict__.clear() #117750
Copy link
Copy link
Closed
Closed
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errorinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Apr 11, 2024 Bisected to #116115
In Fedora, we see a similar problem when trying to import
django.conf.urlswhen building Django, but it's different. Commenting here, because @encukou asked us if the debug-build assertion is the same:Traceback (most recent call last): File "/usr/lib/rpm/redhat/import_all_modules.py", line 171, in <module> main() ~~~~^^ File "/usr/lib/rpm/redhat/import_all_modules.py", line 167, in main import_modules(modules) ~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/lib/rpm/redhat/import_all_modules.py", line 100, in import_modules importlib.import_module(module) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1387, in _gcd_import File "<frozen importlib._bootstrap>", line 1360, in _find_and_load File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 935, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 1020, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/conf/urls/__init__.py", line 1, in <module> from django.urls import include File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/urls/__init__.py", line 1, in <module> from .base import ( ...<11 lines>... ) File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/urls/base.py", line 8, in <module> from .exceptions import NoReverseMatch, Resolver404 File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/urls/exceptions.py", line 1, in <module> from django.http import Http404 File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/http/__init__.py", line 9, in <module> from django.http.response import ( ...<16 lines>... ) File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/http/response.py", line 19, in <module> from django.core.serializers.json import DjangoJSONEncoder File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/core/serializers/__init__.py", line 23, in <module> from django.core.serializers.base import SerializerDoesNotExist File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/core/serializers/base.py", line 9, in <module> from django.db import models File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/db/__init__.py", line 50, in <module> signals.request_started.connect(reset_queries) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/dispatch/dispatcher.py", line 83, in connect if settings.configured and settings.DEBUG: ^^^^^^^^^^^^^^ File "/builddir/build/BUILDROOT/python-django-4.2.11-3.fc41.x86_64/usr/lib/python3.13/site-packages/django/conf/__init__.py", line 104, in __getattr__ val = getattr(_wrapped, name) ~~~~~~~^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'DEBUG' python3-debug: /builddir/build/BUILD/Python-3.13.0a6/Objects/dictobject.c:7119: _PyObject_InlineValuesConsistencyCheck: Assertion `0' failed.The Django problem can be reproduced with:
$ python3.13d -m venv venv3.13d $ venv3.13d/bin/pip install django==5.0.4 $ venv3.13d/bin/python -c 'import django.conf.urls' ... AttributeError: 'NoneType' object has no attribute 'DEBUG' python: /builddir/build/BUILD/Python-3.13.0a6/Objects/dictobject.c:7119: _PyObject_InlineValuesConsistencyCheck: Assertion `0' failed.- added a commit that references this issue
on Apr 15, 2024 Here's a small reproducer for the
AttributeErrorcase:class A(): pass a = A() vars(a).clear() vars(a).update({'foo':'bar'}) print(vars(a)) print(a.foo)
Works with 3.12, fails with 3.13a06.
Fixed in main, so this can be closed.
- moved this from Todo to Done in Release and Deferred blockers 🚫
on Apr 16, 2024 The _PyObject_InlineValuesConsistencyCheck in Django is also fixed on main.
Reacted by Guido van Rossum
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Bug report
Bug description:
On current main (edit: debug build),
fails with:
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Notes
Originally reported here: https://discuss.python.org/t/python-3-12-3-and-3-13-0a6-released/50601/2
Linked PRs