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
6c3d5274
Kaydet (Commit)
6c3d5274
authored
Mar 15, 2017
tarafından
Michael Seifert
Kaydeden (comit)
Serhiy Storchaka
Mar 15, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords are not strings (#649)
üst
024b4fdc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
1 deletion
+34
-1
test_functools.py
Lib/test/test_functools.py
+26
-0
ACKS
Misc/ACKS
+1
-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 @
6c3d5274
...
...
@@ -403,6 +403,32 @@ class TestPartialC(TestPartial, unittest.TestCase):
else
:
self
.
fail
(
'partial object allowed __dict__ to be deleted'
)
def
test_manually_adding_non_string_keyword
(
self
):
p
=
self
.
partial
(
capture
)
# Adding a non-string/unicode keyword to partial kwargs
p
.
keywords
[
1234
]
=
'value'
r
=
repr
(
p
)
self
.
assertIn
(
'1234'
,
r
)
self
.
assertIn
(
"'value'"
,
r
)
with
self
.
assertRaises
(
TypeError
):
p
()
def
test_keystr_replaces_value
(
self
):
p
=
self
.
partial
(
capture
)
class
MutatesYourDict
(
object
):
def
__str__
(
self
):
p
.
keywords
[
self
]
=
[
'sth2'
]
return
'astr'
# Raplacing the value during key formatting should keep the original
# value alive (at least long enough).
p
.
keywords
[
MutatesYourDict
()]
=
[
'sth'
]
r
=
repr
(
p
)
self
.
assertIn
(
'astr'
,
r
)
self
.
assertIn
(
"['sth']"
,
r
)
class
TestPartialPy
(
TestPartial
,
unittest
.
TestCase
):
partial
=
py_functools
.
partial
...
...
Misc/ACKS
Dosyayı görüntüle @
6c3d5274
No preview for this file type
Misc/NEWS
Dosyayı görüntüle @
6c3d5274
...
...
@@ -281,6 +281,9 @@ Extension Modules
Library
-------
-
bpo
-
29800
:
Fix
crashes
in
partial
.
__repr__
if
the
keys
of
partial
.
keywords
are
not
strings
.
Patch
by
Michael
Seifert
.
-
bpo
-
8256
:
Fixed
possible
failing
or
crashing
input
()
if
attributes
"encoding"
or
"errors"
of
sys
.
stdin
or
sys
.
stdout
are
not
set
or
are
not
strings
.
...
...
Modules/_functoolsmodule.c
Dosyayı görüntüle @
6c3d5274
...
...
@@ -297,8 +297,11 @@ partial_repr(partialobject *pto)
/* Pack keyword arguments */
assert
(
PyDict_Check
(
pto
->
kw
));
for
(
i
=
0
;
PyDict_Next
(
pto
->
kw
,
&
i
,
&
key
,
&
value
);)
{
Py_SETREF
(
arglist
,
PyUnicode_FromFormat
(
"%U, %U=%R"
,
arglist
,
/* Prevent key.__str__ from deleting the value. */
Py_INCREF
(
value
);
Py_SETREF
(
arglist
,
PyUnicode_FromFormat
(
"%U, %S=%R"
,
arglist
,
key
,
value
));
Py_DECREF
(
value
);
if
(
arglist
==
NULL
)
goto
done
;
}
...
...
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