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
a6c0c069
Kaydet (Commit)
a6c0c069
authored
Eyl 20, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
Nick Coghlan
Eyl 20, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31506: Improve the error message logic for object.__new__ and object.__init__. (GH-3650)
üst
d6e2f26f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
2017-09-19-10-29-36.bpo-31506.pRVTRB.rst
...ore and Builtins/2017-09-19-10-29-36.bpo-31506.pRVTRB.rst
+1
-0
typeobject.c
Objects/typeobject.c
+21
-10
No files found.
Misc/NEWS.d/next/Core and Builtins/2017-09-19-10-29-36.bpo-31506.pRVTRB.rst
0 → 100644
Dosyayı görüntüle @
a6c0c069
Improved the error message logic for object.__new__ and object.__init__.
Objects/typeobject.c
Dosyayı görüntüle @
a6c0c069
...
...
@@ -3543,23 +3543,34 @@ excess_args(PyObject *args, PyObject *kwds)
static
int
object_init
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwds
)
{
int
err
=
0
;
PyTypeObject
*
type
=
Py_TYPE
(
self
);
if
(
excess_args
(
args
,
kwds
)
&&
(
type
->
tp_new
==
object_new
||
type
->
tp_init
!=
object_init
))
{
PyErr_SetString
(
PyExc_TypeError
,
"object.__init__() takes no parameters"
);
err
=
-
1
;
if
(
excess_args
(
args
,
kwds
))
{
if
(
type
->
tp_init
!=
object_init
)
{
PyErr_SetString
(
PyExc_TypeError
,
"object() takes no arguments"
);
return
-
1
;
}
if
(
type
->
tp_new
==
object_new
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes no arguments"
,
type
->
tp_name
);
return
-
1
;
}
}
return
err
;
return
0
;
}
static
PyObject
*
object_new
(
PyTypeObject
*
type
,
PyObject
*
args
,
PyObject
*
kwds
)
{
if
(
excess_args
(
args
,
kwds
)
&&
(
type
->
tp_init
==
object_init
||
type
->
tp_new
!=
object_new
))
{
PyErr_SetString
(
PyExc_TypeError
,
"object() takes no parameters"
);
return
NULL
;
if
(
excess_args
(
args
,
kwds
))
{
if
(
type
->
tp_new
!=
object_new
)
{
PyErr_SetString
(
PyExc_TypeError
,
"object() takes no arguments"
);
return
NULL
;
}
if
(
type
->
tp_init
==
object_init
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.200s() takes no arguments"
,
type
->
tp_name
);
return
NULL
;
}
}
if
(
type
->
tp_flags
&
Py_TPFLAGS_IS_ABSTRACT
)
{
...
...
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