mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Makefile, import.c: Lance's alternative module search (allow .pyc file
without .py file); Bill's dynamic loading for SunOS using shared libraries. pwdmodule.c (mkgrent): remove DECREF of uninitialized variable. classobject.c (instance_getattr): Fix case when class lookup returns unbound method instead of function.
This commit is contained in:
parent
cbaddb52ae
commit
21d335ed9e
3 changed files with 130 additions and 104 deletions
|
|
@ -379,11 +379,24 @@ instance_getattr(inst, name)
|
|||
}
|
||||
else
|
||||
INCREF(v);
|
||||
if (is_funcobject(v) && class != NULL) {
|
||||
object *w = newinstancemethodobject(v, (object *)inst,
|
||||
(object *)class);
|
||||
DECREF(v);
|
||||
v = w;
|
||||
if (class != NULL) {
|
||||
if (is_funcobject(v)) {
|
||||
object *w = newinstancemethodobject(v, (object *)inst,
|
||||
(object *)class);
|
||||
DECREF(v);
|
||||
v = w;
|
||||
}
|
||||
else if (is_instancemethodobject(v)) {
|
||||
object *im_class = instancemethodgetclass(v);
|
||||
/* Only if classes are compatible */
|
||||
if (issubclass((object *)class, im_class)) {
|
||||
object *im_func = instancemethodgetfunc(v);
|
||||
object *w = newinstancemethodobject(im_func,
|
||||
(object *)inst, im_class);
|
||||
DECREF(v);
|
||||
v = w;
|
||||
}
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue