Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
72dccde8
Commit
72dccde8
authored
Feb 16, 2017
by
INADA Naoki
Committed by
GitHub
Feb 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-29548: Fix some inefficient call API usage (GH-97)
parent
72e81d00
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
40 deletions
+23
-40
Modules/_testcapimodule.c
Modules/_testcapimodule.c
+1
-1
Modules/_threadmodule.c
Modules/_threadmodule.c
+1
-2
Modules/_tkinter.c
Modules/_tkinter.c
+4
-7
Objects/abstract.c
Objects/abstract.c
+1
-1
Objects/fileobject.c
Objects/fileobject.c
+14
-27
Objects/typeobject.c
Objects/typeobject.c
+1
-1
Objects/weakrefobject.c
Objects/weakrefobject.c
+1
-1
No files found.
Modules/_testcapimodule.c
View file @
72dccde8
...
...
@@ -3070,7 +3070,7 @@ slot_tp_del(PyObject *self)
/* Execute __del__ method, if any. */
del
=
_PyObject_LookupSpecial
(
self
,
&
PyId___tp_del__
);
if
(
del
!=
NULL
)
{
res
=
PyEval_CallObject
(
del
,
NULL
);
res
=
_PyObject_CallNoArg
(
del
);
if
(
res
==
NULL
)
PyErr_WriteUnraisable
(
del
);
else
...
...
Modules/_threadmodule.c
View file @
72dccde8
...
...
@@ -994,8 +994,7 @@ t_bootstrap(void *boot_raw)
_PyThreadState_Init
(
tstate
);
PyEval_AcquireThread
(
tstate
);
nb_threads
++
;
res
=
PyEval_CallObjectWithKeywords
(
boot
->
func
,
boot
->
args
,
boot
->
keyw
);
res
=
PyObject_Call
(
boot
->
func
,
boot
->
args
,
boot
->
keyw
);
if
(
res
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_SystemExit
))
PyErr_Clear
();
...
...
Modules/_tkinter.c
View file @
72dccde8
...
...
@@ -2417,7 +2417,7 @@ PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
}
PyTuple_SET_ITEM
(
arg
,
i
,
s
);
}
res
=
Py
Eval_CallObject
(
func
,
arg
);
res
=
Py
Object_Call
(
func
,
arg
,
NULL
);
Py_DECREF
(
arg
);
if
(
res
==
NULL
)
...
...
@@ -2661,16 +2661,13 @@ static void
FileHandler
(
ClientData
clientData
,
int
mask
)
{
FileHandler_ClientData
*
data
=
(
FileHandler_ClientData
*
)
clientData
;
PyObject
*
func
,
*
file
,
*
arg
,
*
res
;
PyObject
*
func
,
*
file
,
*
res
;
ENTER_PYTHON
func
=
data
->
func
;
file
=
data
->
file
;
arg
=
Py_BuildValue
(
"(Oi)"
,
file
,
(
long
)
mask
);
res
=
PyEval_CallObject
(
func
,
arg
);
Py_DECREF
(
arg
);
res
=
PyObject_CallFunction
(
func
,
"Oi"
,
file
,
mask
);
if
(
res
==
NULL
)
{
errorInCmd
=
1
;
PyErr_Fetch
(
&
excInCmd
,
&
valInCmd
,
&
trbInCmd
);
...
...
@@ -2840,7 +2837,7 @@ TimerHandler(ClientData clientData)
ENTER_PYTHON
res
=
PyEval_CallObject
(
func
,
NULL
);
res
=
_PyObject_CallNoArg
(
func
);
Py_DECREF
(
func
);
Py_DECREF
(
v
);
/* See Tktt_New() */
...
...
Objects/abstract.c
View file @
72dccde8
...
...
@@ -1329,7 +1329,7 @@ PyNumber_Long(PyObject *o)
}
trunc_func
=
_PyObject_LookupSpecial
(
o
,
&
PyId___trunc__
);
if
(
trunc_func
)
{
result
=
PyEval_CallObject
(
trunc_func
,
NULL
);
result
=
_PyObject_CallNoArg
(
trunc_func
);
Py_DECREF
(
trunc_func
);
if
(
result
==
NULL
||
PyLong_CheckExact
(
result
))
{
return
result
;
...
...
Objects/fileobject.c
View file @
72dccde8
...
...
@@ -49,6 +49,7 @@ PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const c
PyObject
*
PyFile_GetLine
(
PyObject
*
f
,
int
n
)
{
_Py_IDENTIFIER
(
readline
);
PyObject
*
result
;
if
(
f
==
NULL
)
{
...
...
@@ -56,32 +57,18 @@ PyFile_GetLine(PyObject *f, int n)
return
NULL
;
}
{
PyObject
*
reader
;
PyObject
*
args
;
_Py_IDENTIFIER
(
readline
);
reader
=
_PyObject_GetAttrId
(
f
,
&
PyId_readline
);
if
(
reader
==
NULL
)
return
NULL
;
if
(
n
<=
0
)
args
=
PyTuple_New
(
0
);
else
args
=
Py_BuildValue
(
"(i)"
,
n
);
if
(
args
==
NULL
)
{
Py_DECREF
(
reader
);
return
NULL
;
}
result
=
PyEval_CallObject
(
reader
,
args
);
Py_DECREF
(
reader
);
Py_DECREF
(
args
);
if
(
result
!=
NULL
&&
!
PyBytes_Check
(
result
)
&&
!
PyUnicode_Check
(
result
))
{
Py_DECREF
(
result
);
result
=
NULL
;
PyErr_SetString
(
PyExc_TypeError
,
"object.readline() returned non-string"
);
}
if
(
n
<=
0
)
{
result
=
_PyObject_CallMethodIdObjArgs
(
f
,
&
PyId_readline
,
NULL
);
}
else
{
result
=
_PyObject_CallMethodId
(
f
,
&
PyId_readline
,
"i"
,
n
);
}
if
(
result
!=
NULL
&&
!
PyBytes_Check
(
result
)
&&
!
PyUnicode_Check
(
result
))
{
Py_DECREF
(
result
);
result
=
NULL
;
PyErr_SetString
(
PyExc_TypeError
,
"object.readline() returned non-string"
);
}
if
(
n
<
0
&&
result
!=
NULL
&&
PyBytes_Check
(
result
))
{
...
...
@@ -197,7 +184,7 @@ PyObject_AsFileDescriptor(PyObject *o)
}
else
if
((
meth
=
_PyObject_GetAttrId
(
o
,
&
PyId_fileno
))
!=
NULL
)
{
PyObject
*
fno
=
PyEval_CallObject
(
meth
,
NULL
);
PyObject
*
fno
=
_PyObject_CallNoArg
(
meth
);
Py_DECREF
(
meth
);
if
(
fno
==
NULL
)
return
-
1
;
...
...
Objects/typeobject.c
View file @
72dccde8
...
...
@@ -4348,7 +4348,7 @@ _common_reduce(PyObject *self, int proto)
if
(
!
copyreg
)
return
NULL
;
res
=
Py
Eval_CallMethod
(
copyreg
,
"_reduce_ex"
,
"(Oi)
"
,
self
,
proto
);
res
=
Py
Object_CallMethod
(
copyreg
,
"_reduce_ex"
,
"Oi
"
,
self
,
proto
);
Py_DECREF
(
copyreg
);
return
res
;
...
...
Objects/weakrefobject.c
View file @
72dccde8
...
...
@@ -461,7 +461,7 @@ proxy_checkref(PyWeakReference *proxy)
WRAP_BINARY
(
proxy_getattr
,
PyObject_GetAttr
)
WRAP_UNARY
(
proxy_str
,
PyObject_Str
)
WRAP_TERNARY
(
proxy_call
,
Py
Eval_CallObjectWithKeywords
)
WRAP_TERNARY
(
proxy_call
,
Py
Object_Call
)
static
PyObject
*
proxy_repr
(
PyWeakReference
*
proxy
)
...
...
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