mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
moved callable() to object.c
This commit is contained in:
parent
e95d92b65e
commit
a6f6050229
1 changed files with 0 additions and 29 deletions
|
@ -87,32 +87,6 @@ builtin_apply(self, args)
|
||||||
return call_object(func, arglist);
|
return call_object(func, arglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
callable(x)
|
|
||||||
object *x;
|
|
||||||
{
|
|
||||||
if (x == NULL)
|
|
||||||
return 0;
|
|
||||||
if (x->ob_type->tp_call != NULL ||
|
|
||||||
is_funcobject(x) ||
|
|
||||||
is_instancemethodobject(x) ||
|
|
||||||
is_methodobject(x) ||
|
|
||||||
is_classobject(x))
|
|
||||||
return 1;
|
|
||||||
if (is_instanceobject(x)) {
|
|
||||||
object *call = getattr(x, "__call__");
|
|
||||||
if (call == NULL) {
|
|
||||||
err_clear();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* Could test recursively but don't, for fear of endless
|
|
||||||
recursion if some joker sets self.__call__ = self */
|
|
||||||
DECREF(call);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
builtin_callable(self, args)
|
builtin_callable(self, args)
|
||||||
object *self;
|
object *self;
|
||||||
|
@ -420,8 +394,6 @@ builtin_execfile(self, args)
|
||||||
object *globals = None, *locals = None;
|
object *globals = None, *locals = None;
|
||||||
object *res;
|
object *res;
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
char *s;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
if (!newgetargs(args, "s|O!O!:execfile",
|
if (!newgetargs(args, "s|O!O!:execfile",
|
||||||
&filename,
|
&filename,
|
||||||
|
@ -1050,7 +1022,6 @@ builtin_xrange(self, args)
|
||||||
{
|
{
|
||||||
long ilow = 0, ihigh = 0, istep = 1;
|
long ilow = 0, ihigh = 0, istep = 1;
|
||||||
long n;
|
long n;
|
||||||
object *v;
|
|
||||||
|
|
||||||
if (gettuplesize(args) <= 1) {
|
if (gettuplesize(args) <= 1) {
|
||||||
if (!newgetargs(args,
|
if (!newgetargs(args,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue