Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2552c2d6
Commit
2552c2d6
authored
Jan 28, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #26202: copy.deepcopy() now correctly copies range() objects with
non-atomic attributes.
parents
8abaa9ab
0a20bbf6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
Lib/copy.py
Lib/copy.py
+0
-1
Lib/test/test_copy.py
Lib/test/test_copy.py
+12
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/copy.py
View file @
2552c2d6
...
...
@@ -207,7 +207,6 @@ try:
except
AttributeError
:
pass
d
[
type
]
=
_deepcopy_atomic
d
[
range
]
=
_deepcopy_atomic
d
[
types
.
BuiltinFunctionType
]
=
_deepcopy_atomic
d
[
types
.
FunctionType
]
=
_deepcopy_atomic
d
[
weakref
.
ref
]
=
_deepcopy_atomic
...
...
Lib/test/test_copy.py
View file @
2552c2d6
...
...
@@ -314,7 +314,7 @@ class TestCopy(unittest.TestCase):
pass
tests
=
[
None
,
42
,
2
**
100
,
3.14
,
True
,
False
,
1j
,
"hello"
,
"hello
\
u1234
"
,
f
.
__code__
,
NewStyle
,
range
(
10
),
Classic
,
max
]
NewStyle
,
Classic
,
max
]
for
x
in
tests
:
self
.
assertIs
(
copy
.
deepcopy
(
x
),
x
)
...
...
@@ -536,6 +536,17 @@ class TestCopy(unittest.TestCase):
self
.
assertIsNot
(
y
,
x
)
self
.
assertIs
(
y
.
foo
,
y
)
def
test_deepcopy_range
(
self
):
class
I
(
int
):
pass
x
=
range
(
I
(
10
))
y
=
copy
.
deepcopy
(
x
)
self
.
assertIsNot
(
y
,
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
.
stop
,
x
.
stop
)
self
.
assertEqual
(
y
.
stop
,
x
.
stop
)
self
.
assertIsInstance
(
y
.
stop
,
I
)
# _reconstruct()
def
test_reconstruct_string
(
self
):
...
...
Misc/NEWS
View file @
2552c2d6
...
...
@@ -159,6 +159,9 @@ Core and Builtins
Library
-------
- Issue #26202: copy.deepcopy() now correctly copies range() objects with
non-atomic attributes.
- Issue #19883: Fixed possible integer overflows in zipimport.
- Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment