Skip to content

Commit 3761818

Browse files
committed
new__ parameter names and allowlist stubtest errors
1 parent f5f3da2 commit 3761818

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/stubtest/allowlist.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,21 @@ django.contrib.auth.views.UserModel
231231
# Limited stubtest support for enums (https://github.com/python/mypy/issues/16806)
232232
django.db.migrations.operations.base.OperationCategory.__new__
233233

234+
# The `label` parameter in __new__ is a deliberate stub-only addition:
235+
# Django's ChoicesType metaclass processes (value, label) tuples at class definition time,
236+
# but the runtime __new__ (from enum.Enum) only accepts (cls, value).
237+
# We keep the label overload so that defining enum members type-checks correctly.
238+
django.db.models.enums.IntegerChoices.__new__
239+
django.db.models.enums.TextChoices.__new__
240+
django.db.models.IntegerChoices.__new__
241+
django.db.models.TextChoices.__new__
242+
django.contrib.gis.db.models.IntegerChoices.__new__
243+
django.contrib.gis.db.models.TextChoices.__new__
244+
django.tasks.TaskResultStatus.__new__
245+
django.tasks.base.TaskResultStatus.__new__
246+
django.tasks.base.TextChoices.__new__
247+
django.tasks.signals.TaskResultStatus.__new__
248+
234249
# These are dynamically added when using `save(commit=False)`
235250
# See https://docs.djangoproject.com/en/stable/topics/forms/modelforms/#the-save-method
236251
django.forms.BaseModelForm.save_m2m

0 commit comments

Comments
 (0)