mirror of https://github.com/python/cpython
Disable support for access statement
This commit is contained in:
parent
aacdc9da75
commit
0dfcf753ad
|
@ -29,7 +29,8 @@ fplist: fpdef (',' fpdef)* [',']
|
||||||
|
|
||||||
stmt: simple_stmt | compound_stmt
|
stmt: simple_stmt | compound_stmt
|
||||||
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
|
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
|
||||||
small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt
|
#small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt
|
||||||
|
small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt
|
||||||
expr_stmt: testlist ('=' testlist)*
|
expr_stmt: testlist ('=' testlist)*
|
||||||
# For assignments, additional restrictions enforced by the interpreter
|
# For assignments, additional restrictions enforced by the interpreter
|
||||||
print_stmt: 'print' (test ',')* [test]
|
print_stmt: 'print' (test ',')* [test]
|
||||||
|
@ -43,10 +44,10 @@ raise_stmt: 'raise' test [',' test [',' test]]
|
||||||
import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
|
import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
|
||||||
dotted_name: NAME ('.' NAME)*
|
dotted_name: NAME ('.' NAME)*
|
||||||
global_stmt: 'global' NAME (',' NAME)*
|
global_stmt: 'global' NAME (',' NAME)*
|
||||||
access_stmt: 'access' ('*' | NAME (',' NAME)*) ':' accesstype (',' accesstype)*
|
#access_stmt: 'access' ('*' | NAME (',' NAME)*) ':' accesstype (',' accesstype)*
|
||||||
accesstype: NAME+
|
#accesstype: NAME+
|
||||||
# accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']
|
## accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']
|
||||||
# but can't be because that would create undesirable reserved words!
|
## but can't be because that would create undesirable reserved words!
|
||||||
exec_stmt: 'exec' expr ['in' test [',' test]]
|
exec_stmt: 'exec' expr ['in' test [',' test]]
|
||||||
|
|
||||||
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
|
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
|
||||||
|
|
|
@ -28,6 +28,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
/* This object type is no longer supported */
|
||||||
|
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
|
|
||||||
/* Access object interface */
|
/* Access object interface */
|
||||||
|
|
||||||
/* Access mode bits (note similarity with UNIX permissions) */
|
/* Access mode bits (note similarity with UNIX permissions) */
|
||||||
|
@ -60,6 +64,8 @@ int PyAccess_HasValue Py_PROTO((PyObject *));
|
||||||
|
|
||||||
extern DL_IMPORT(PyTypeObject) PyAnyNumber_Type, PyAnySequence_Type, PyAnyMapping_Type;
|
extern DL_IMPORT(PyTypeObject) PyAnyNumber_Type, PyAnySequence_Type, PyAnyMapping_Type;
|
||||||
|
|
||||||
|
#endif /* !SUPPORT_OBSOLETE_ACCESS */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,38 +21,36 @@
|
||||||
#define import_stmt 276
|
#define import_stmt 276
|
||||||
#define dotted_name 277
|
#define dotted_name 277
|
||||||
#define global_stmt 278
|
#define global_stmt 278
|
||||||
#define access_stmt 279
|
#define exec_stmt 279
|
||||||
#define accesstype 280
|
#define compound_stmt 280
|
||||||
#define exec_stmt 281
|
#define if_stmt 281
|
||||||
#define compound_stmt 282
|
#define while_stmt 282
|
||||||
#define if_stmt 283
|
#define for_stmt 283
|
||||||
#define while_stmt 284
|
#define try_stmt 284
|
||||||
#define for_stmt 285
|
#define except_clause 285
|
||||||
#define try_stmt 286
|
#define suite 286
|
||||||
#define except_clause 287
|
#define test 287
|
||||||
#define suite 288
|
#define and_test 288
|
||||||
#define test 289
|
#define not_test 289
|
||||||
#define and_test 290
|
#define comparison 290
|
||||||
#define not_test 291
|
#define comp_op 291
|
||||||
#define comparison 292
|
#define expr 292
|
||||||
#define comp_op 293
|
#define xor_expr 293
|
||||||
#define expr 294
|
#define and_expr 294
|
||||||
#define xor_expr 295
|
#define shift_expr 295
|
||||||
#define and_expr 296
|
#define arith_expr 296
|
||||||
#define shift_expr 297
|
#define term 297
|
||||||
#define arith_expr 298
|
#define factor 298
|
||||||
#define term 299
|
#define power 299
|
||||||
#define factor 300
|
#define atom 300
|
||||||
#define power 301
|
#define lambdef 301
|
||||||
#define atom 302
|
#define trailer 302
|
||||||
#define lambdef 303
|
#define subscriptlist 303
|
||||||
#define trailer 304
|
#define subscript 304
|
||||||
#define subscriptlist 305
|
#define sliceop 305
|
||||||
#define subscript 306
|
#define exprlist 306
|
||||||
#define sliceop 307
|
#define testlist 307
|
||||||
#define exprlist 308
|
#define dictmaker 308
|
||||||
#define testlist 309
|
#define classdef 309
|
||||||
#define dictmaker 310
|
#define arglist 310
|
||||||
#define classdef 311
|
#define argument 311
|
||||||
#define arglist 312
|
|
||||||
#define argument 313
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS /* This object type is no longer supported */
|
||||||
|
|
||||||
/* Access object implementation */
|
/* Access object implementation */
|
||||||
|
|
||||||
/* XXX TO DO LIST
|
/* XXX TO DO LIST
|
||||||
|
@ -358,3 +360,5 @@ typeobject Anymappingtype = {
|
||||||
0, /*ob_size*/
|
0, /*ob_size*/
|
||||||
"*mapping*", /*tp_name*/
|
"*mapping*", /*tp_name*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* SUPPORT_OBSOLETE_ACCESS */
|
||||||
|
|
|
@ -37,8 +37,10 @@ newclassobject(bases, dict, name)
|
||||||
object *dict;
|
object *dict;
|
||||||
object *name; /* String; NULL if unknown */
|
object *name; /* String; NULL if unknown */
|
||||||
{
|
{
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
int pos;
|
int pos;
|
||||||
object *key, *value;
|
object *key, *value;
|
||||||
|
#endif
|
||||||
classobject *op, *dummy;
|
classobject *op, *dummy;
|
||||||
static object *getattrstr, *setattrstr, *delattrstr;
|
static object *getattrstr, *setattrstr, *delattrstr;
|
||||||
if (dictlookup(dict, "__doc__") == NULL) {
|
if (dictlookup(dict, "__doc__") == NULL) {
|
||||||
|
@ -73,11 +75,13 @@ newclassobject(bases, dict, name)
|
||||||
XINCREF(op->cl_getattr);
|
XINCREF(op->cl_getattr);
|
||||||
XINCREF(op->cl_setattr);
|
XINCREF(op->cl_setattr);
|
||||||
XINCREF(op->cl_delattr);
|
XINCREF(op->cl_delattr);
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
pos = 0;
|
pos = 0;
|
||||||
while (mappinggetnext(dict, &pos, &key, &value)) {
|
while (mappinggetnext(dict, &pos, &key, &value)) {
|
||||||
if (is_accessobject(value))
|
if (is_accessobject(value))
|
||||||
setaccessowner(value, (object *)op);
|
setaccessowner(value, (object *)op);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return (object *) op;
|
return (object *) op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,12 +155,14 @@ class_getattr(op, name)
|
||||||
err_setval(AttributeError, name);
|
err_setval(AttributeError, name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (is_accessobject(v)) {
|
if (is_accessobject(v)) {
|
||||||
v = getaccessvalue(v, getowner());
|
v = getaccessvalue(v, getowner());
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
INCREF(v);
|
INCREF(v);
|
||||||
if (is_funcobject(v)) {
|
if (is_funcobject(v)) {
|
||||||
object *w = newinstancemethodobject(v, (object *)NULL,
|
object *w = newinstancemethodobject(v, (object *)NULL,
|
||||||
|
@ -173,7 +179,9 @@ class_setattr(op, name, v)
|
||||||
object *name;
|
object *name;
|
||||||
object *v;
|
object *v;
|
||||||
{
|
{
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
object *ac;
|
object *ac;
|
||||||
|
#endif
|
||||||
char *sname = getstringvalue(name);
|
char *sname = getstringvalue(name);
|
||||||
if (sname[0] == '_' && sname[1] == '_') {
|
if (sname[0] == '_' && sname[1] == '_') {
|
||||||
int n = getstringsize(name);
|
int n = getstringsize(name);
|
||||||
|
@ -187,9 +195,11 @@ class_setattr(op, name, v)
|
||||||
"classes are read-only in restricted mode");
|
"classes are read-only in restricted mode");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
ac = mappinglookup(op->cl_dict, name);
|
ac = mappinglookup(op->cl_dict, name);
|
||||||
if (ac != NULL && is_accessobject(ac))
|
if (ac != NULL && is_accessobject(ac))
|
||||||
return setaccessvalue(ac, getowner(), v);
|
return setaccessvalue(ac, getowner(), v);
|
||||||
|
#endif
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
int rv = mappingremove(op->cl_dict, name);
|
int rv = mappingremove(op->cl_dict, name);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
|
@ -260,6 +270,7 @@ issubclass(class, base)
|
||||||
|
|
||||||
/* Instance objects */
|
/* Instance objects */
|
||||||
|
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
static int
|
static int
|
||||||
addaccess(class, inst)
|
addaccess(class, inst)
|
||||||
classobject *class;
|
classobject *class;
|
||||||
|
@ -295,6 +306,7 @@ addaccess(class, inst)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
object *
|
object *
|
||||||
newinstanceobject(class, arg, kw)
|
newinstanceobject(class, arg, kw)
|
||||||
|
@ -315,8 +327,11 @@ newinstanceobject(class, arg, kw)
|
||||||
INCREF(class);
|
INCREF(class);
|
||||||
inst->in_class = (classobject *)class;
|
inst->in_class = (classobject *)class;
|
||||||
inst->in_dict = newdictobject();
|
inst->in_dict = newdictobject();
|
||||||
if (inst->in_dict == NULL ||
|
if (inst->in_dict == NULL
|
||||||
addaccess((classobject *)class, inst) != 0) {
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
|
|| addaccess((classobject *)class, inst) != 0
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
DECREF(inst);
|
DECREF(inst);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -382,8 +397,12 @@ instance_dealloc(inst)
|
||||||
if ((del = instance_getattr1(inst, delstr)) != NULL) {
|
if ((del = instance_getattr1(inst, delstr)) != NULL) {
|
||||||
object *res = call_object(del, (object *)NULL);
|
object *res = call_object(del, (object *)NULL);
|
||||||
DECREF(del);
|
DECREF(del);
|
||||||
XDECREF(res);
|
if (res == NULL) {
|
||||||
/* XXX If __del__ raised an exception, it is ignored! */
|
writestring("exception in __del__ method ignored\n",
|
||||||
|
sysget("stdout"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DECREF(res);
|
||||||
}
|
}
|
||||||
/* Restore the saved exception and undo the temporary revival */
|
/* Restore the saved exception and undo the temporary revival */
|
||||||
err_restore(error_type, error_value, error_traceback);
|
err_restore(error_type, error_value, error_traceback);
|
||||||
|
@ -438,12 +457,14 @@ instance_getattr1(inst, name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (is_accessobject(v)) {
|
if (is_accessobject(v)) {
|
||||||
v = getaccessvalue(v, getowner());
|
v = getaccessvalue(v, getowner());
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
INCREF(v);
|
INCREF(v);
|
||||||
if (class != NULL) {
|
if (class != NULL) {
|
||||||
if (is_funcobject(v)) {
|
if (is_funcobject(v)) {
|
||||||
|
@ -492,10 +513,12 @@ instance_setattr1(inst, name, v)
|
||||||
object *name;
|
object *name;
|
||||||
object *v;
|
object *v;
|
||||||
{
|
{
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
object *ac;
|
object *ac;
|
||||||
ac = mappinglookup(inst->in_dict, name);
|
ac = mappinglookup(inst->in_dict, name);
|
||||||
if (ac != NULL && is_accessobject(ac))
|
if (ac != NULL && is_accessobject(ac))
|
||||||
return setaccessvalue(ac, getowner(), v);
|
return setaccessvalue(ac, getowner(), v);
|
||||||
|
#endif
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
int rv = mappingremove(inst->in_dict, name);
|
int rv = mappingremove(inst->in_dict, name);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
|
|
|
@ -127,9 +127,11 @@ module_getattr(m, name)
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
err_setstr(AttributeError, name);
|
err_setstr(AttributeError, name);
|
||||||
else {
|
else {
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (is_accessobject(res))
|
if (is_accessobject(res))
|
||||||
res = getaccessvalue(res, getglobals());
|
res = getaccessvalue(res, getglobals());
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
INCREF(res);
|
INCREF(res);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -141,14 +143,18 @@ module_setattr(m, name, v)
|
||||||
char *name;
|
char *name;
|
||||||
object *v;
|
object *v;
|
||||||
{
|
{
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
object *ac;
|
object *ac;
|
||||||
|
#endif
|
||||||
if (name[0] == '_' && strcmp(name, "__dict__") == 0) {
|
if (name[0] == '_' && strcmp(name, "__dict__") == 0) {
|
||||||
err_setstr(TypeError, "read-only special attribute");
|
err_setstr(TypeError, "read-only special attribute");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
ac = dictlookup(m->md_dict, name);
|
ac = dictlookup(m->md_dict, name);
|
||||||
if (ac != NULL && is_accessobject(ac))
|
if (ac != NULL && is_accessobject(ac))
|
||||||
return setaccessvalue(ac, getglobals(), v);
|
return setaccessvalue(ac, getglobals(), v);
|
||||||
|
#endif
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
int rv = dictremove(m->md_dict, name);
|
int rv = dictremove(m->md_dict, name);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
|
|
|
@ -95,7 +95,9 @@ static int cmp_member PROTO((object *, object *));
|
||||||
static object *cmp_outcome PROTO((int, object *, object *));
|
static object *cmp_outcome PROTO((int, object *, object *));
|
||||||
static int import_from PROTO((object *, object *, object *));
|
static int import_from PROTO((object *, object *, object *));
|
||||||
static object *build_class PROTO((object *, object *, object *));
|
static object *build_class PROTO((object *, object *, object *));
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
static int access_statement PROTO((object *, object *, frameobject *));
|
static int access_statement PROTO((object *, object *, frameobject *));
|
||||||
|
#endif
|
||||||
static int exec_statement PROTO((object *, object *, object *));
|
static int exec_statement PROTO((object *, object *, object *));
|
||||||
static object *find_from_args PROTO((frameobject *, int));
|
static object *find_from_args PROTO((frameobject *, int));
|
||||||
|
|
||||||
|
@ -324,7 +326,9 @@ eval_code2(co, globals, locals,
|
||||||
register frameobject *f; /* Current frame */
|
register frameobject *f; /* Current frame */
|
||||||
register object **fastlocals;
|
register object **fastlocals;
|
||||||
object *retval; /* Return value */
|
object *retval; /* Return value */
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
int defmode = 0; /* Default access mode for new variables */
|
int defmode = 0; /* Default access mode for new variables */
|
||||||
|
#endif
|
||||||
#ifdef LLTRACE
|
#ifdef LLTRACE
|
||||||
int lltrace;
|
int lltrace;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1082,6 +1086,7 @@ eval_code2(co, globals, locals,
|
||||||
err_setstr(SystemError, "no locals");
|
err_setstr(SystemError, "no locals");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
u = dict2lookup(x, w);
|
u = dict2lookup(x, w);
|
||||||
if (u == NULL) {
|
if (u == NULL) {
|
||||||
if (defmode != 0) {
|
if (defmode != 0) {
|
||||||
|
@ -1103,6 +1108,7 @@ eval_code2(co, globals, locals,
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
err = dict2insert(x, w, v);
|
err = dict2insert(x, w, v);
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
break;
|
break;
|
||||||
|
@ -1113,12 +1119,14 @@ eval_code2(co, globals, locals,
|
||||||
err_setstr(SystemError, "no locals");
|
err_setstr(SystemError, "no locals");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
u = dict2lookup(x, w);
|
u = dict2lookup(x, w);
|
||||||
if (u != NULL && is_accessobject(u)) {
|
if (u != NULL && is_accessobject(u)) {
|
||||||
err = setaccessvalue(u, x,
|
err = setaccessvalue(u, x,
|
||||||
(object *)NULL);
|
(object *)NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if ((err = dict2remove(x, w)) != 0)
|
if ((err = dict2remove(x, w)) != 0)
|
||||||
err_setval(NameError, w);
|
err_setval(NameError, w);
|
||||||
break;
|
break;
|
||||||
|
@ -1196,6 +1204,7 @@ eval_code2(co, globals, locals,
|
||||||
case STORE_GLOBAL:
|
case STORE_GLOBAL:
|
||||||
w = GETNAMEV(oparg);
|
w = GETNAMEV(oparg);
|
||||||
v = POP();
|
v = POP();
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (f->f_locals != NULL) {
|
if (f->f_locals != NULL) {
|
||||||
u = dict2lookup(f->f_locals, w);
|
u = dict2lookup(f->f_locals, w);
|
||||||
if (u != NULL && is_accessobject(u)) {
|
if (u != NULL && is_accessobject(u)) {
|
||||||
|
@ -1205,12 +1214,14 @@ eval_code2(co, globals, locals,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
err = dict2insert(f->f_globals, w, v);
|
err = dict2insert(f->f_globals, w, v);
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_GLOBAL:
|
case DELETE_GLOBAL:
|
||||||
w = GETNAMEV(oparg);
|
w = GETNAMEV(oparg);
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (f->f_locals != NULL) {
|
if (f->f_locals != NULL) {
|
||||||
u = dict2lookup(f->f_locals, w);
|
u = dict2lookup(f->f_locals, w);
|
||||||
if (u != NULL && is_accessobject(u)) {
|
if (u != NULL && is_accessobject(u)) {
|
||||||
|
@ -1219,6 +1230,7 @@ eval_code2(co, globals, locals,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if ((err = dict2remove(f->f_globals, w)) != 0)
|
if ((err = dict2remove(f->f_globals, w)) != 0)
|
||||||
err_setval(NameError, w);
|
err_setval(NameError, w);
|
||||||
break;
|
break;
|
||||||
|
@ -1248,12 +1260,14 @@ eval_code2(co, globals, locals,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (is_accessobject(x)) {
|
if (is_accessobject(x)) {
|
||||||
x = getaccessvalue(x, f->f_globals /* XXX */);
|
x = getaccessvalue(x, f->f_globals /* XXX */);
|
||||||
if (x == NULL)
|
if (x == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
INCREF(x);
|
INCREF(x);
|
||||||
PUSH(x);
|
PUSH(x);
|
||||||
break;
|
break;
|
||||||
|
@ -1269,12 +1283,14 @@ eval_code2(co, globals, locals,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (is_accessobject(x)) {
|
if (is_accessobject(x)) {
|
||||||
x = getaccessvalue(x, f->f_globals);
|
x = getaccessvalue(x, f->f_globals);
|
||||||
if (x == NULL)
|
if (x == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
INCREF(x);
|
INCREF(x);
|
||||||
PUSH(x);
|
PUSH(x);
|
||||||
break;
|
break;
|
||||||
|
@ -1310,28 +1326,33 @@ eval_code2(co, globals, locals,
|
||||||
oparg));
|
oparg));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (is_accessobject(x)) {
|
if (is_accessobject(x)) {
|
||||||
x = getaccessvalue(x, f->f_locals);
|
x = getaccessvalue(x, f->f_locals);
|
||||||
if (x == NULL)
|
if (x == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
INCREF(x);
|
INCREF(x);
|
||||||
PUSH(x);
|
PUSH(x);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STORE_FAST:
|
case STORE_FAST:
|
||||||
v = POP();
|
v = POP();
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
w = GETLOCAL(oparg);
|
w = GETLOCAL(oparg);
|
||||||
if (w != NULL && is_accessobject(w)) {
|
if (w != NULL && is_accessobject(w)) {
|
||||||
err = setaccessvalue(w, f->f_locals, v);
|
err = setaccessvalue(w, f->f_locals, v);
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
SETLOCAL(oparg, v);
|
SETLOCAL(oparg, v);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_FAST:
|
case DELETE_FAST:
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
x = GETLOCAL(oparg);
|
x = GETLOCAL(oparg);
|
||||||
if (x == NULL) {
|
if (x == NULL) {
|
||||||
err_setval(NameError,
|
err_setval(NameError,
|
||||||
|
@ -1344,6 +1365,7 @@ eval_code2(co, globals, locals,
|
||||||
(object *)NULL);
|
(object *)NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
SETLOCAL(oparg, NULL);
|
SETLOCAL(oparg, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1439,6 +1461,7 @@ eval_code2(co, globals, locals,
|
||||||
locals_2_fast(f, 0);
|
locals_2_fast(f, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
case ACCESS_MODE:
|
case ACCESS_MODE:
|
||||||
v = POP();
|
v = POP();
|
||||||
w = GETNAMEV(oparg);
|
w = GETNAMEV(oparg);
|
||||||
|
@ -1448,6 +1471,7 @@ eval_code2(co, globals, locals,
|
||||||
err = access_statement(w, v, f);
|
err = access_statement(w, v, f);
|
||||||
DECREF(v);
|
DECREF(v);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case JUMP_FORWARD:
|
case JUMP_FORWARD:
|
||||||
JUMPBY(oparg);
|
JUMPBY(oparg);
|
||||||
|
@ -2826,6 +2850,7 @@ import_from(locals, v, name)
|
||||||
if (!is_stringobject(name) ||
|
if (!is_stringobject(name) ||
|
||||||
getstringvalue(name)[0] == '_')
|
getstringvalue(name)[0] == '_')
|
||||||
continue;
|
continue;
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
if (is_accessobject(value)) {
|
if (is_accessobject(value)) {
|
||||||
value = getaccessvalue(value, (object *)NULL);
|
value = getaccessvalue(value, (object *)NULL);
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
|
@ -2834,6 +2859,7 @@ import_from(locals, v, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
INCREF(value);
|
INCREF(value);
|
||||||
err = dict2insert(locals, name, value);
|
err = dict2insert(locals, name, value);
|
||||||
DECREF(value);
|
DECREF(value);
|
||||||
|
@ -2902,6 +2928,7 @@ build_class(methods, bases, name)
|
||||||
return newclassobject(bases, methods, name);
|
return newclassobject(bases, methods, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
static int
|
static int
|
||||||
access_statement(name, vmode, f)
|
access_statement(name, vmode, f)
|
||||||
object *name;
|
object *name;
|
||||||
|
@ -2931,6 +2958,7 @@ access_statement(name, vmode, f)
|
||||||
locals_2_fast(f, 0);
|
locals_2_fast(f, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
exec_statement(prog, globals, locals)
|
exec_statement(prog, globals, locals)
|
||||||
|
|
|
@ -1792,12 +1792,12 @@ com_newlocal(c, name)
|
||||||
|
|
||||||
#define strequ(a, b) (strcmp((a), (b)) == 0)
|
#define strequ(a, b) (strcmp((a), (b)) == 0)
|
||||||
|
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
static void
|
static void
|
||||||
com_access_stmt(c, n)
|
com_access_stmt(c, n)
|
||||||
struct compiling *c;
|
struct compiling *c;
|
||||||
node *n;
|
node *n;
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
int i, j, k, mode, imode;
|
int i, j, k, mode, imode;
|
||||||
object *vmode;
|
object *vmode;
|
||||||
REQ(n, access_stmt);
|
REQ(n, access_stmt);
|
||||||
|
@ -1848,8 +1848,8 @@ com_access_stmt(c, n)
|
||||||
com_addoparg(c, LOAD_CONST, imode);
|
com_addoparg(c, LOAD_CONST, imode);
|
||||||
com_addopname(c, ACCESS_MODE, CHILD(n, i));
|
com_addopname(c, ACCESS_MODE, CHILD(n, i));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
com_exec_stmt(c, n)
|
com_exec_stmt(c, n)
|
||||||
|
@ -2421,9 +2421,11 @@ com_node(c, n)
|
||||||
case global_stmt:
|
case global_stmt:
|
||||||
com_global_stmt(c, n);
|
com_global_stmt(c, n);
|
||||||
break;
|
break;
|
||||||
|
#ifdef SUPPORT_OBSOLETE_ACCESS
|
||||||
case access_stmt:
|
case access_stmt:
|
||||||
com_access_stmt(c, n);
|
com_access_stmt(c, n);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case exec_stmt:
|
case exec_stmt:
|
||||||
com_exec_stmt(c, n);
|
com_exec_stmt(c, n);
|
||||||
break;
|
break;
|
||||||
|
|
1288
Python/graminit.c
1288
Python/graminit.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue