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
5e02c782
Kaydet (Commit)
5e02c782
authored
Eyl 21, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Eyl 21, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31410: Optimized calling wrapper and classmethod descriptors. (#3481)
üst
b3a77964
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
29 deletions
+34
-29
2017-09-10-20-58-51.bpo-31410.wD_RbH.rst
...ore and Builtins/2017-09-10-20-58-51.bpo-31410.wD_RbH.rst
+1
-0
descrobject.c
Objects/descrobject.c
+33
-29
No files found.
Misc/NEWS.d/next/Core and Builtins/2017-09-10-20-58-51.bpo-31410.wD_RbH.rst
0 → 100644
Dosyayı görüntüle @
5e02c782
Optimized calling wrapper and classmethod descriptors.
Objects/descrobject.c
Dosyayı görüntüle @
5e02c782
...
@@ -296,7 +296,7 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
...
@@ -296,7 +296,7 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
PyObject
*
kwds
)
PyObject
*
kwds
)
{
{
Py_ssize_t
argc
;
Py_ssize_t
argc
;
PyObject
*
self
,
*
func
,
*
result
,
**
stack
;
PyObject
*
self
,
*
result
;
/* Make sure that the first argument is acceptable as 'self' */
/* Make sure that the first argument is acceptable as 'self' */
assert
(
PyTuple_Check
(
args
));
assert
(
PyTuple_Check
(
args
));
...
@@ -330,20 +330,38 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
...
@@ -330,20 +330,38 @@ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
return
NULL
;
return
NULL
;
}
}
func
=
PyCFunction_NewEx
(
descr
->
d_method
,
self
,
NULL
);
result
=
_PyMethodDef_RawFastCallDict
(
descr
->
d_method
,
self
,
if
(
func
==
NULL
)
&
PyTuple_GET_ITEM
(
args
,
1
),
argc
-
1
,
return
NULL
;
kwds
);
stack
=
&
PyTuple_GET_ITEM
(
args
,
1
);
result
=
_Py_CheckFunctionResult
((
PyObject
*
)
descr
,
result
,
NULL
);
result
=
_PyObject_FastCallDict
(
func
,
stack
,
argc
-
1
,
kwds
);
Py_DECREF
(
func
);
return
result
;
return
result
;
}
}
Py_LOCAL_INLINE
(
PyObject
*
)
wrapperdescr_raw_call
(
PyWrapperDescrObject
*
descr
,
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kwds
)
{
wrapperfunc
wrapper
=
descr
->
d_base
->
wrapper
;
if
(
descr
->
d_base
->
flags
&
PyWrapperFlag_KEYWORDS
)
{
wrapperfunc_kwds
wk
=
(
wrapperfunc_kwds
)
wrapper
;
return
(
*
wk
)(
self
,
args
,
descr
->
d_wrapped
,
kwds
);
}
if
(
kwds
!=
NULL
&&
(
!
PyDict_Check
(
kwds
)
||
PyDict_GET_SIZE
(
kwds
)
!=
0
))
{
PyErr_Format
(
PyExc_TypeError
,
"wrapper %s() takes no keyword arguments"
,
descr
->
d_base
->
name
);
return
NULL
;
}
return
(
*
wrapper
)(
self
,
args
,
descr
->
d_wrapped
);
}
static
PyObject
*
static
PyObject
*
wrapperdescr_call
(
PyWrapperDescrObject
*
descr
,
PyObject
*
args
,
PyObject
*
kwds
)
wrapperdescr_call
(
PyWrapperDescrObject
*
descr
,
PyObject
*
args
,
PyObject
*
kwds
)
{
{
Py_ssize_t
argc
;
Py_ssize_t
argc
;
PyObject
*
self
,
*
func
,
*
result
,
**
stack
;
PyObject
*
self
,
*
result
;
/* Make sure that the first argument is acceptable as 'self' */
/* Make sure that the first argument is acceptable as 'self' */
assert
(
PyTuple_Check
(
args
));
assert
(
PyTuple_Check
(
args
));
...
@@ -369,16 +387,16 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds)
...
@@ -369,16 +387,16 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds)
return
NULL
;
return
NULL
;
}
}
func
=
PyWrapper_New
((
PyObject
*
)
descr
,
self
);
args
=
PyTuple_GetSlice
(
args
,
1
,
argc
);
if
(
func
==
NULL
)
if
(
args
==
NULL
)
{
return
NULL
;
return
NULL
;
}
stack
=
&
PyTuple_GET_ITEM
(
args
,
1
);
result
=
wrapperdescr_raw_call
(
descr
,
self
,
args
,
kwds
);
result
=
_PyObject_FastCallDict
(
func
,
stack
,
argc
-
1
,
kwds
);
Py_DECREF
(
args
);
Py_DECREF
(
func
);
return
result
;
return
result
;
}
}
static
PyObject
*
static
PyObject
*
method_get_doc
(
PyMethodDescrObject
*
descr
,
void
*
closure
)
method_get_doc
(
PyMethodDescrObject
*
descr
,
void
*
closure
)
{
{
...
@@ -1167,21 +1185,7 @@ static PyGetSetDef wrapper_getsets[] = {
...
@@ -1167,21 +1185,7 @@ static PyGetSetDef wrapper_getsets[] = {
static
PyObject
*
static
PyObject
*
wrapper_call
(
wrapperobject
*
wp
,
PyObject
*
args
,
PyObject
*
kwds
)
wrapper_call
(
wrapperobject
*
wp
,
PyObject
*
args
,
PyObject
*
kwds
)
{
{
wrapperfunc
wrapper
=
wp
->
descr
->
d_base
->
wrapper
;
return
wrapperdescr_raw_call
(
wp
->
descr
,
wp
->
self
,
args
,
kwds
);
PyObject
*
self
=
wp
->
self
;
if
(
wp
->
descr
->
d_base
->
flags
&
PyWrapperFlag_KEYWORDS
)
{
wrapperfunc_kwds
wk
=
(
wrapperfunc_kwds
)
wrapper
;
return
(
*
wk
)(
self
,
args
,
wp
->
descr
->
d_wrapped
,
kwds
);
}
if
(
kwds
!=
NULL
&&
(
!
PyDict_Check
(
kwds
)
||
PyDict_GET_SIZE
(
kwds
)
!=
0
))
{
PyErr_Format
(
PyExc_TypeError
,
"wrapper %s() takes no keyword arguments"
,
wp
->
descr
->
d_base
->
name
);
return
NULL
;
}
return
(
*
wrapper
)(
self
,
args
,
wp
->
descr
->
d_wrapped
);
}
}
static
int
static
int
...
...
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