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
4a90ef03
Kaydet (Commit)
4a90ef03
authored
Mar 03, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14177: marshal.loads() now raises TypeError when given an unicode string.
Patch by Guilherme Gonçalves.
üst
679e9d36
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
6 deletions
+15
-6
test_exceptions.py
Lib/test/test_exceptions.py
+1
-1
test_marshal.py
Lib/test/test_marshal.py
+6
-1
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
marshal.c
Python/marshal.c
+4
-4
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
4a90ef03
...
@@ -38,7 +38,7 @@ class ExceptionTests(unittest.TestCase):
...
@@ -38,7 +38,7 @@ class ExceptionTests(unittest.TestCase):
try
:
try
:
try
:
try
:
import
marshal
import
marshal
marshal
.
loads
(
''
)
marshal
.
loads
(
b
''
)
except
EOFError
:
except
EOFError
:
pass
pass
finally
:
finally
:
...
...
Lib/test/test_marshal.py
Dosyayı görüntüle @
4a90ef03
...
@@ -184,7 +184,7 @@ class BugsTestCase(unittest.TestCase):
...
@@ -184,7 +184,7 @@ class BugsTestCase(unittest.TestCase):
pass
pass
def
test_loads_recursion
(
self
):
def
test_loads_recursion
(
self
):
s
=
'c'
+
(
'X'
*
4
*
4
)
+
'{'
*
2
**
20
s
=
b
'c'
+
(
b
'X'
*
4
*
4
)
+
b
'{'
*
2
**
20
self
.
assertRaises
(
ValueError
,
marshal
.
loads
,
s
)
self
.
assertRaises
(
ValueError
,
marshal
.
loads
,
s
)
def
test_recursion_limit
(
self
):
def
test_recursion_limit
(
self
):
...
@@ -257,6 +257,11 @@ class BugsTestCase(unittest.TestCase):
...
@@ -257,6 +257,11 @@ class BugsTestCase(unittest.TestCase):
finally
:
finally
:
support
.
unlink
(
support
.
TESTFN
)
support
.
unlink
(
support
.
TESTFN
)
def
test_loads_reject_unicode_strings
(
self
):
# Issue #14177: marshal.loads() should not accept unicode strings
unicode_string
=
'T'
self
.
assertRaises
(
TypeError
,
marshal
.
loads
,
unicode_string
)
def
test_main
():
def
test_main
():
support
.
run_unittest
(
IntTestCase
,
support
.
run_unittest
(
IntTestCase
,
...
...
Misc/ACKS
Dosyayı görüntüle @
4a90ef03
...
@@ -341,6 +341,7 @@ Johannes Gijsbers
...
@@ -341,6 +341,7 @@ Johannes Gijsbers
Michael Gilfix
Michael Gilfix
Christoph Gohlke
Christoph Gohlke
Tim Golden
Tim Golden
Guilherme Gonçalves
Chris Gonnerman
Chris Gonnerman
David Goodger
David Goodger
Hans de Graaff
Hans de Graaff
...
...
Misc/NEWS
Dosyayı görüntüle @
4a90ef03
...
@@ -130,6 +130,9 @@ Core and Builtins
...
@@ -130,6 +130,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #14177: marshal.loads() now raises TypeError when given an unicode
string. Patch by Guilherme Gonçalves.
- Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary,
- Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary,
WeakValueDictionary) to return a better approximation when some objects
WeakValueDictionary) to return a better approximation when some objects
are dead or dying. Moreover, the implementation is now O(1) rather than
are dead or dying. Moreover, the implementation is now O(1) rather than
...
...
Python/marshal.c
Dosyayı görüntüle @
4a90ef03
...
@@ -1383,7 +1383,7 @@ marshal_loads(PyObject *self, PyObject *args)
...
@@ -1383,7 +1383,7 @@ marshal_loads(PyObject *self, PyObject *args)
char
*
s
;
char
*
s
;
Py_ssize_t
n
;
Py_ssize_t
n
;
PyObject
*
result
;
PyObject
*
result
;
if
(
!
PyArg_ParseTuple
(
args
,
"
s
*:loads"
,
&
p
))
if
(
!
PyArg_ParseTuple
(
args
,
"
y
*:loads"
,
&
p
))
return
NULL
;
return
NULL
;
s
=
p
.
buf
;
s
=
p
.
buf
;
n
=
p
.
len
;
n
=
p
.
len
;
...
@@ -1400,10 +1400,10 @@ marshal_loads(PyObject *self, PyObject *args)
...
@@ -1400,10 +1400,10 @@ marshal_loads(PyObject *self, PyObject *args)
}
}
PyDoc_STRVAR
(
loads_doc
,
PyDoc_STRVAR
(
loads_doc
,
"loads(
string
)
\n
\
"loads(
bytes
)
\n
\
\n
\
\n
\
Convert the
string
to a value. If no valid value is found, raise
\n
\
Convert the
bytes object
to a value. If no valid value is found, raise
\n
\
EOFError, ValueError or TypeError. Extra characters in the
string
are
\n
\
EOFError, ValueError or TypeError. Extra characters in the
input
are
\n
\
ignored."
);
ignored."
);
static
PyMethodDef
marshal_methods
[]
=
{
static
PyMethodDef
marshal_methods
[]
=
{
...
...
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