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
9639e4ab
Kaydet (Commit)
9639e4ab
authored
Şub 20, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Şub 20, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-29532: Altering a kwarg dictionary passed to functools.partial() (#190)
no longer affects a partial object after creation.
üst
d0e8212e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
test_functools.py
Lib/test/test_functools.py
+9
-0
NEWS
Misc/NEWS
+3
-0
_functoolsmodule.c
Modules/_functoolsmodule.c
+4
-1
No files found.
Lib/test/test_functools.py
Dosyayı görüntüle @
9639e4ab
...
...
@@ -90,6 +90,15 @@ class TestPartial:
p
(
b
=
7
)
self
.
assertEqual
(
d
,
{
'a'
:
3
})
def
test_kwargs_copy
(
self
):
# Issue #29532: Altering a kwarg dictionary passed to a constructor
# should not affect a partial object after creation
d
=
{
'a'
:
3
}
p
=
self
.
partial
(
capture
,
**
d
)
self
.
assertEqual
(
p
(),
((),
{
'a'
:
3
}))
d
[
'a'
]
=
5
self
.
assertEqual
(
p
(),
((),
{
'a'
:
3
}))
def
test_arg_combinations
(
self
):
# exercise special code paths for zero args in either partial
# object or the caller
...
...
Misc/NEWS
Dosyayı görüntüle @
9639e4ab
...
...
@@ -232,6 +232,9 @@ Extension Modules
Library
-------
- bpo-29532: Altering a kwarg dictionary passed to functools.partial()
no longer affects a partial object after creation.
- bpo-22807: Add uuid.SafeUUID and uuid.UUID.is_safe to relay information from
the platform about whether generated UUIDs are generated with a
multiprocessing safe method.
...
...
Modules/_functoolsmodule.c
Dosyayı görüntüle @
9639e4ab
...
...
@@ -88,10 +88,13 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
if
(
kw
==
NULL
)
{
pto
->
kw
=
PyDict_New
();
}
else
{
else
if
(
Py_REFCNT
(
kw
)
==
1
)
{
Py_INCREF
(
kw
);
pto
->
kw
=
kw
;
}
else
{
pto
->
kw
=
PyDict_Copy
(
kw
);
}
}
else
{
pto
->
kw
=
PyDict_Copy
(
pkw
);
...
...
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