Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
b63015b0
Kaydet (Commit)
b63015b0
authored
Kas 30, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #25718: Fixed copying object with state with boolean value is false.
üst
3c49710e
cbbec1c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
copy.py
Lib/copy.py
+2
-2
test_copy.py
Lib/test/test_copy.py
+9
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/copy.py
Dosyayı görüntüle @
b63015b0
...
...
@@ -279,7 +279,7 @@ def _reconstruct(x, info, deep, memo=None):
if
n
>
2
:
state
=
info
[
2
]
else
:
state
=
{}
state
=
None
if
n
>
3
:
listiter
=
info
[
3
]
else
:
...
...
@@ -293,7 +293,7 @@ def _reconstruct(x, info, deep, memo=None):
y
=
callable
(
*
args
)
memo
[
id
(
x
)]
=
y
if
state
:
if
state
is
not
None
:
if
deep
:
state
=
deepcopy
(
state
,
memo
)
if
hasattr
(
y
,
'__setstate__'
):
...
...
Lib/test/test_copy.py
Dosyayı görüntüle @
b63015b0
...
...
@@ -213,6 +213,9 @@ class TestCopy(unittest.TestCase):
return
self
.
foo
==
other
.
foo
x
=
C
(
42
)
self
.
assertEqual
(
copy
.
copy
(
x
),
x
)
# State with boolean value is false (issue #25718)
x
=
C
(
0.0
)
self
.
assertEqual
(
copy
.
copy
(
x
),
x
)
# The deepcopy() method
...
...
@@ -517,6 +520,12 @@ class TestCopy(unittest.TestCase):
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
self
.
assertIsNot
(
y
.
foo
,
x
.
foo
)
# State with boolean value is false (issue #25718)
x
=
C
([])
y
=
copy
.
deepcopy
(
x
)
self
.
assertEqual
(
y
,
x
)
self
.
assertIsNot
(
y
,
x
)
self
.
assertIsNot
(
y
.
foo
,
x
.
foo
)
def
test_deepcopy_reflexive_inst
(
self
):
class
C
:
...
...
Misc/NEWS
Dosyayı görüntüle @
b63015b0
...
...
@@ -20,6 +20,8 @@ Core and Builtins
Library
-------
- Issue #25718: Fixed copying object with state with boolean value is false.
- Issue #10131: Fixed deep copying of minidom documents. Based on patch
by Marian Ganisin.
...
...
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