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
a8b27e62
Kaydet (Commit)
a8b27e62
authored
Haz 24, 2019
tarafından
Jeroen Demeyer
Kaydeden (comit)
Petr Viktorin
Haz 24, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-36974: inherit tp_vectorcall_offset unconditionally (GH-13858)
üst
47fbc4e4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
+18
-7
test_call.py
Lib/test/test_call.py
+9
-0
2019-06-06-11-00-55.bpo-36974.wdzzym.rst
...ore and Builtins/2019-06-06-11-00-55.bpo-36974.wdzzym.rst
+2
-0
call.c
Objects/call.c
+1
-1
typeobject.c
Objects/typeobject.c
+6
-6
No files found.
Lib/test/test_call.py
Dosyayı görüntüle @
a8b27e62
...
@@ -577,9 +577,18 @@ class TestPEP590(unittest.TestCase):
...
@@ -577,9 +577,18 @@ class TestPEP590(unittest.TestCase):
def
__call__
(
self
,
n
):
def
__call__
(
self
,
n
):
return
'new'
return
'new'
class
SuperBase
:
def
__call__
(
self
,
*
args
):
return
super
()
.
__call__
(
*
args
)
class
MethodDescriptorSuper
(
SuperBase
,
_testcapi
.
MethodDescriptorBase
):
def
__call__
(
self
,
*
args
):
return
super
()
.
__call__
(
*
args
)
calls
+=
[
calls
+=
[
(
MethodDescriptorHeap
(),
(
0
,),
{},
True
),
(
MethodDescriptorHeap
(),
(
0
,),
{},
True
),
(
MethodDescriptorOverridden
(),
(
0
,),
{},
'new'
),
(
MethodDescriptorOverridden
(),
(
0
,),
{},
'new'
),
(
MethodDescriptorSuper
(),
(
0
,),
{},
True
),
]
]
for
(
func
,
args
,
kwargs
,
expected
)
in
calls
:
for
(
func
,
args
,
kwargs
,
expected
)
in
calls
:
...
...
Misc/NEWS.d/next/Core and Builtins/2019-06-06-11-00-55.bpo-36974.wdzzym.rst
0 → 100644
Dosyayı görüntüle @
a8b27e62
The slot ``tp_vectorcall_offset`` is inherited unconditionally to support
``super().__call__()`` when the base class uses vectorcall.
Objects/call.c
Dosyayı görüntüle @
a8b27e62
...
@@ -184,7 +184,7 @@ PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *kwargs)
...
@@ -184,7 +184,7 @@ PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *kwargs)
/* get vectorcallfunc as in _PyVectorcall_Function, but without
/* get vectorcallfunc as in _PyVectorcall_Function, but without
* the _Py_TPFLAGS_HAVE_VECTORCALL check */
* the _Py_TPFLAGS_HAVE_VECTORCALL check */
Py_ssize_t
offset
=
Py_TYPE
(
callable
)
->
tp_vectorcall_offset
;
Py_ssize_t
offset
=
Py_TYPE
(
callable
)
->
tp_vectorcall_offset
;
if
(
(
offset
<=
0
)
||
(
!
Py_TYPE
(
callable
)
->
tp_call
)
)
{
if
(
offset
<=
0
)
{
PyErr_Format
(
PyExc_TypeError
,
"'%.200s' object does not support vectorcall"
,
PyErr_Format
(
PyExc_TypeError
,
"'%.200s' object does not support vectorcall"
,
Py_TYPE
(
callable
)
->
tp_name
);
Py_TYPE
(
callable
)
->
tp_name
);
return
NULL
;
return
NULL
;
...
...
Objects/typeobject.c
Dosyayı görüntüle @
a8b27e62
...
@@ -5153,15 +5153,15 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
...
@@ -5153,15 +5153,15 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
COPYSLOT(tp_repr);
COPYSLOT(tp_repr);
/* tp_hash see tp_richcompare */
/* tp_hash see tp_richcompare */
{
{
/* Inherit tp_vectorcall_offset only if tp_call is not overridden */
/* Always inherit tp_vectorcall_offset to support PyVectorcall_Call().
if
(
!
type
->
tp_call
)
{
* If _Py_TPFLAGS_HAVE_VECTORCALL is not inherited, then vectorcall
COPYSLOT
(
tp_vectorcall_offset
);
* won't be used automatically. */
}
COPYSLOT(tp_vectorcall_offset);
/* Inherit_Py_TPFLAGS_HAVE_VECTORCALL for non-heap types
/* Inherit _Py_TPFLAGS_HAVE_VECTORCALL for non-heap types
* if tp_call is not overridden */
* if tp_call is not overridden */
if (!type->tp_call &&
if (!type->tp_call &&
(base->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) &&
(base->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) &&
!
(
type
->
tp_flags
&
_Py_TPFLAGS_HAVE_VECTORCALL
)
&&
!(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
!(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
{
{
type->tp_flags |= _Py_TPFLAGS_HAVE_VECTORCALL;
type->tp_flags |= _Py_TPFLAGS_HAVE_VECTORCALL;
...
...
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