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
415c1e36
Kaydet (Commit)
415c1e36
authored
Ock 16, 2008
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Raise a TypeError instead of a ValueError when too many initializers
are used in a Structure or Union constructor.
üst
02ec289f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
test_structures.py
Lib/ctypes/test/test_structures.py
+4
-4
NEWS
Misc/NEWS
+2
-0
_ctypes.c
Modules/_ctypes/_ctypes.c
+1
-1
No files found.
Lib/ctypes/test/test_structures.py
Dosyayı görüntüle @
415c1e36
...
...
@@ -222,8 +222,8 @@ class StructureTestCase(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
POINT
,
2
,
3
,
x
=
4
)
self
.
assertRaises
(
TypeError
,
POINT
,
2
,
3
,
y
=
4
)
#
Should this raise TypeError instead?
self
.
assertRaises
(
Valu
eError
,
POINT
,
2
,
3
,
4
)
#
too many initializers
self
.
assertRaises
(
Typ
eError
,
POINT
,
2
,
3
,
4
)
def
test_keyword_initializers
(
self
):
class
POINT
(
Structure
):
...
...
@@ -320,9 +320,9 @@ class StructureTestCase(unittest.TestCase):
self
.
failUnlessEqual
(
cls
,
RuntimeError
)
if
issubclass
(
Exception
,
object
):
self
.
failUnlessEqual
(
msg
,
"(Phone) <type 'exceptions.
Valu
eError'>: too many initializers"
)
"(Phone) <type 'exceptions.
Typ
eError'>: too many initializers"
)
else
:
self
.
failUnlessEqual
(
msg
,
"(Phone) exceptions.
Valu
eError: too many initializers"
)
self
.
failUnlessEqual
(
msg
,
"(Phone) exceptions.
Typ
eError: too many initializers"
)
def
get_except
(
self
,
func
,
*
args
):
...
...
Misc/NEWS
Dosyayı görüntüle @
415c1e36
...
...
@@ -366,6 +366,8 @@ Library
- Issue #1831: ctypes now raises a TypeError if conflicting positional
and named arguments are passed to a Structure or Union initializer.
When too many positional arguments are passed, also a TypeError is
raised instead of a ValueError.
- Convert the internal ctypes array type cache to a WeakValueDict so
that array types do not live longer than needed.
...
...
Modules/_ctypes/_ctypes.c
Dosyayı görüntüle @
415c1e36
...
...
@@ -3557,7 +3557,7 @@ Struct_init(PyObject *self, PyObject *args, PyObject *kwds)
if
(
PyTuple_GET_SIZE
(
args
)
>
PySequence_Length
(
fields
))
{
Py_DECREF
(
fields
);
PyErr_SetString
(
PyExc_
Valu
eError
,
PyErr_SetString
(
PyExc_
Typ
eError
,
"too many initializers"
);
return
-
1
;
}
...
...
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