mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Access checks now work, at least for instance data (not for methods
yet). The class is now passed to eval_code and stored in the current frame. It is also stored in instance method objects. An "unbound" instance method is now returned when a function is retrieved through "classname.funcname", which when called passes the class to eval_code.
This commit is contained in:
parent
25831652fd
commit
81daa32c15
14 changed files with 655 additions and 150 deletions
|
@ -30,6 +30,13 @@ It should be possible to use other object types as base classes,
|
|||
but currently it isn't. We'll see if we can fix that later, sigh...
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
OB_HEAD
|
||||
object *cl_bases; /* A tuple of class objects */
|
||||
object *cl_dict; /* A dictionary */
|
||||
object *cl_name; /* A string */
|
||||
} classobject;
|
||||
|
||||
extern typeobject Classtype, Instancetype, Instancemethodtype;
|
||||
|
||||
#define is_classobject(op) ((op)->ob_type == &Classtype)
|
||||
|
@ -38,9 +45,12 @@ extern typeobject Classtype, Instancetype, Instancemethodtype;
|
|||
|
||||
extern object *newclassobject PROTO((object *, object *, object *));
|
||||
extern object *newinstanceobject PROTO((object *, object *));
|
||||
extern object *newinstancemethodobject PROTO((object *, object *));
|
||||
extern object *newinstancemethodobject PROTO((object *, object *, object *));
|
||||
|
||||
extern object *instancemethodgetfunc PROTO((object *));
|
||||
extern object *instancemethodgetself PROTO((object *));
|
||||
extern object *instancemethodgetclass PROTO((object *));
|
||||
|
||||
extern object *instance_convert PROTO((object *, char *));
|
||||
|
||||
extern int issubclass PROTO((object *, object *));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue