Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32427a5

Browse files
committed
Add a comment
1 parent ebcbf69 commit 32427a5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/dataclasses.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,11 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen):
781781
if cls.__module__ in sys.modules:
782782
globals = sys.modules[cls.__module__].__dict__
783783
else:
784+
# Theoretically this can happen if someone writes
785+
# a custom string to cls.__module__. In which case
786+
# such dataclass won't be fully introspectable
787+
# (w.r.t. typing.get_type_hints) but will still function
788+
# correctly.
784789
globals = {}
785790

786791
setattr(cls, _PARAMS, _DataclassParams(init, repr, eq, order,

0 commit comments

Comments
 (0)