Skip to content

Commit d6c680d

Browse files
committed
Use a dunder name instead of a single underscore
1 parent 86da9b8 commit d6c680d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/dataclasses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def __annotate__(format, /):
565565

566566
# This is a flag for _add_slots to know it needs to regenerate this method
567567
# In order to remove references to the original class when it is replaced
568-
__annotate__._generated_by_dataclasses = True
568+
__annotate__.__generated_by_dataclasses__ = True
569569
__annotate__.__qualname__ = f"{__class__.__qualname__}.{method_name}.__annotate__"
570570

571571
return __annotate__
@@ -1399,7 +1399,7 @@ def _add_slots(cls, is_frozen, weakref_slot, defined_fields):
13991399

14001400
# Fix the class reference in the __annotate__ method
14011401
init_annotate = newcls.__init__.__annotate__
1402-
if getattr(init_annotate, "_generated_by_dataclasses", False):
1402+
if getattr(init_annotate, "__generated_by_dataclasses__", False):
14031403
_update_func_cell_for__class__(init_annotate, cls, newcls)
14041404

14051405
return newcls

0 commit comments

Comments
 (0)