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

Skip to content

Commit d6399d2

Browse files
committed
Fix running the copy module from the command-line (however use{ful,less} it may be).
1 parent b5cfd55 commit d6399d2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/copy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class instances).
5151
import types
5252
import weakref
5353
from copyreg import dispatch_table
54+
import builtins
5455

5556
class Error(Exception):
5657
pass
@@ -109,7 +110,7 @@ def _copy_immutable(x):
109110
if t is not None:
110111
d[t] = _copy_immutable
111112
for name in ("complex", "unicode"):
112-
t = globals()['__builtins__'].get(name)
113+
t = getattr(builtins, name, None)
113114
if t is not None:
114115
d[t] = _copy_immutable
115116

0 commit comments

Comments
 (0)