diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/Python-ast.c | 37 | ||||
-rw-r--r-- | Python/ast.c | 3 | ||||
-rw-r--r-- | Python/ceval.c | 8 | ||||
-rw-r--r-- | Python/import.c | 3 | ||||
-rw-r--r-- | Python/peephole.c | 4 | ||||
-rw-r--r-- | Python/symtable.c | 3 |
6 files changed, 2 insertions, 56 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 8e16cfb..11f42b8 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -206,10 +206,6 @@ static char *Call_fields[]={ "starargs", "kwargs", }; -static PyTypeObject *Repr_type; -static char *Repr_fields[]={ - "value", -}; static PyTypeObject *Num_type; static char *Num_fields[]={ "n", @@ -532,8 +528,6 @@ static int init_types(void) if (!Compare_type) return 0; Call_type = make_type("Call", expr_type, Call_fields, 5); if (!Call_type) return 0; - Repr_type = make_type("Repr", expr_type, Repr_fields, 1); - if (!Repr_type) return 0; Num_type = make_type("Num", expr_type, Num_fields, 1); if (!Num_type) return 0; Str_type = make_type("Str", expr_type, Str_fields, 1); @@ -1553,27 +1547,6 @@ Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs, } expr_ty -Repr(expr_ty value, int lineno, int col_offset, PyArena *arena) -{ - expr_ty p; - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for Repr"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) { - PyErr_NoMemory(); - return NULL; - } - p->kind = Repr_kind; - p->v.Repr.value = value; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty Num(object n, int lineno, int col_offset, PyArena *arena) { expr_ty p; @@ -2544,15 +2517,6 @@ ast2obj_expr(void* _o) goto failed; Py_DECREF(value); break; - case Repr_kind: - result = PyType_GenericNew(Repr_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Repr.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; case Num_kind: result = PyType_GenericNew(Num_type, NULL, NULL); if (!result) goto failed; @@ -3113,7 +3077,6 @@ init_ast(void) if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0) return; if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return; - if (PyDict_SetItemString(d, "Repr", (PyObject*)Repr_type) < 0) return; if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return; if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return; if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) < diff --git a/Python/ast.c b/Python/ast.c index b566ba3..1a43878 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -401,9 +401,6 @@ set_context(expr_ty e, expr_context_ty ctx, const node *n) case Compare_kind: expr_name = "comparison"; break; - case Repr_kind: - expr_name = "repr"; - break; case IfExp_kind: expr_name = "conditional expression"; break; diff --git a/Python/ceval.c b/Python/ceval.c index b33c16b..95def9a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1040,14 +1040,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) STACKADJ(-1); break; - case UNARY_CONVERT: - v = TOP(); - x = PyObject_Repr(v); - Py_DECREF(v); - SET_TOP(x); - if (x != NULL) continue; - break; - case UNARY_INVERT: v = TOP(); x = PyNumber_Invert(v); diff --git a/Python/import.c b/Python/import.c index a05078e..d80611e 100644 --- a/Python/import.c +++ b/Python/import.c @@ -65,9 +65,10 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *); Python 2.5c1: 62121 (fix wrong lnotab with for loops and storing constants that should have been removed) Python 3000: 3000 + 3010 (removed UNARY_CONVERT) . */ -#define MAGIC (3000 | ((long)'\r'<<16) | ((long)'\n'<<24)) +#define MAGIC (3010 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the value of this global to accommodate for alterations of how the diff --git a/Python/peephole.c b/Python/peephole.c index 836d398..1459960 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -189,9 +189,6 @@ fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts) if (PyObject_IsTrue(v) == 1) newconst = PyNumber_Negative(v); break; - case UNARY_CONVERT: - newconst = PyObject_Repr(v); - break; case UNARY_INVERT: newconst = PyNumber_Invert(v); break; @@ -470,7 +467,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, /* Fold unary ops on constants. LOAD_CONST c1 UNARY_OP --> LOAD_CONST unary_op(c) */ case UNARY_NEGATIVE: - case UNARY_CONVERT: case UNARY_INVERT: if (lastlc >= 1 && ISBASICBLOCK(blocks, i-3, 4) && diff --git a/Python/symtable.c b/Python/symtable.c index 05d504c..bf15960 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1182,9 +1182,6 @@ symtable_visit_expr(struct symtable *st, expr_ty e) if (e->v.Call.kwargs) VISIT(st, expr, e->v.Call.kwargs); break; - case Repr_kind: - VISIT(st, expr, e->v.Repr.value); - break; case Num_kind: case Str_kind: /* Nothing to do here. */ |