You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stubtest: Inconsistencies in TextChoices, IntegerChoices and missing members in django.utils.inspect #3148
Running ./scripts/stubtest.sh on the current version of django-stubs reveals several inconsistencies between the stubs and the runtime environment.
Choices Classes Inconsistency (__init__ vs __new__)
Multiple errors indicate that IntegerChoices and TextChoices define __init__ with parameters in the stubs, but at runtime, these parameters do not exist in __init__. The error message suggests moving the logic to __new__.
Affected modules:
django.db.models.enums
django.contrib.gis.db.models
django.tasks.base
Example Error:
error: django.db.models.enums.IntegerChoices.__init__ is inconsistent, runtime does not have parameter "x".
You may need to write stubs for __new__ instead of __init__.
Stub: Overload(def (self: ..., x: ...), def (self: ..., x: ..., label: ...))
Runtime: def (self)
Missing members in django.utils.inspect
The runtime has lock and safe_signature_from_callable which are completely missing from the stubs.
Errors:
error: django.utils.inspect.lock is not present in stub
error: django.utils.inspect.safe_signature_from_callable is not present in stub
Environment:
Django version: [Write your Django version here, e.g., 5.0]
Python version: [Write your Python version here, e.g., 3.12]
Command run: `./scripts/stubtest.sh`
Question:
Is this expected behavior for the current state of the stubs, or should these be addressed by moving the signatures to __new__ and adding the missing members to django.utils.inspect?
changed the title [-]stubtest: Inconsistencies in `TextChoices, `IntegerChoices` and missing members in `django.utils.inspect`[/-][+]stubtest: Inconsistencies in `TextChoices`, `IntegerChoices` and missing members in `django.utils.inspect`[/+]on Mar 3, 2026
Activity
ngnpope commentedon Mar 2, 2026
Yeah, this is a known issue with Python 3.14 - it's just that nobody has had a chance to properly look into this yet. Assistance is welcome.
ngnpope commentedon Mar 3, 2026
This part was completed in #3152. I'll need some time to think about the enum issues.
[-]stubtest: Inconsistencies in `TextChoices, `IntegerChoices` and missing members in `django.utils.inspect`[/-][+]stubtest: Inconsistencies in `TextChoices`, `IntegerChoices` and missing members in `django.utils.inspect`[/+]ahmedasar00 commentedon Mar 3, 2026
Thank you.