Skip to content

Commit 915574e

Browse files
committed
make _copy a core module
1 parent 266397d commit 915574e

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
lines changed

Lib/copy.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,26 +179,13 @@ def _deepcopy_fallback(x, memo=None, _nil=[]):
179179
_keep_alive(x, memo) # Make sure x lives at least as long as d
180180
return y
181181

182-
try:
183-
from _copy import deepcopy
184-
except ImportError as ex:
185-
deepcopy = _deepcopy_fallback
182+
from _copy import deepcopy
186183

187184
_deepcopy_dispatch = d = {}
188185

189186
def _deepcopy_atomic(x, memo):
190187
return x
191-
d[type(None)] = _deepcopy_atomic
192-
d[type(Ellipsis)] = _deepcopy_atomic
193-
d[type(NotImplemented)] = _deepcopy_atomic
194-
d[int] = _deepcopy_atomic
195-
d[float] = _deepcopy_atomic
196-
d[bool] = _deepcopy_atomic
197-
d[complex] = _deepcopy_atomic
198-
d[bytes] = _deepcopy_atomic
199-
d[str] = _deepcopy_atomic
200188
d[types.CodeType] = _deepcopy_atomic
201-
d[type] = _deepcopy_atomic
202189
d[range] = _deepcopy_atomic
203190
d[types.BuiltinFunctionType] = _deepcopy_atomic
204191
d[types.FunctionType] = _deepcopy_atomic

Modules/Setup.bootstrap.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ _weakref _weakref.c
2525

2626
# commonly used core modules
2727
_abc _abc.c
28+
_copy _copy.c
2829
_functools _functoolsmodule.c
2930
_locale _localemodule.c
3031
_operator _operator.c

Modules/_copy.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define NEEDS_PY_IDENTIFIER
2+
13
#include "Python.h"
24

35
/*[clinic input]
@@ -259,6 +261,7 @@ deepcopy_tuple(PyObject* x, PyObject* memo, PyObject* id_x, Py_hash_t hash_id_x)
259261
return y;
260262
}
261263

264+
262265
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
263266

264267
/*

Modules/clinic/_copy.c.h

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,10 +1336,6 @@ def detect_uuid(self):
13361336
# Build the _uuid module if possible
13371337
self.addext(Extension('_uuid', ['_uuidmodule.c']))
13381338

1339-
def detect_copy(self):
1340-
# Build the _copy module
1341-
self.addext(Extension('_copy', ['_copy.c']))
1342-
13431339
def detect_modules(self):
13441340
# remove dummy extension
13451341
self.extensions = []
@@ -1350,7 +1346,6 @@ def detect_modules(self):
13501346
self.detect_simple_extensions()
13511347
self.detect_test_extensions()
13521348
self.detect_readline_curses()
1353-
self.detect_copy()
13541349
self.detect_crypt()
13551350
self.detect_openssl_hashlib()
13561351
self.detect_hash_builtins()

0 commit comments

Comments
 (0)