Skip to content

Commit 563dda4

Browse files
committed
rename __builtins__ for clarity
1 parent 97df9b2 commit 563dda4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Lib/dataclasses.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,8 @@ def _create_fn(name, args, body, *, globals=None, locals=None,
344344
# worries about external callers.
345345
if locals is None:
346346
locals = {}
347-
# __builtins__ may be the "builtins" module or
348-
# the value of its "__dict__",
349-
# so make sure "__builtins__" is the module.
350-
if '__builtins__' not in locals:
351-
locals['__builtins__'] = builtins
347+
if 'BUILTINS' not in locals:
348+
locals['BUILTINS'] = builtins
352349
return_annotation = ''
353350
if return_type is not MISSING:
354351
locals['_return_type'] = return_type
@@ -375,7 +372,7 @@ def _field_assign(frozen, name, value, self_name):
375372
# self_name is what "self" is called in this function: don't
376373
# hard-code "self", since that might be a field name.
377374
if frozen:
378-
return f'__builtins__.object.__setattr__({self_name},{name!r},{value})'
375+
return f'BUILTINS.object.__setattr__({self_name},{name!r},{value})'
379376
return f'{self_name}.{name}={value}'
380377

381378

0 commit comments

Comments
 (0)