Author: brett.cannon
Date: Fri Aug 25 07:05:30 2006
New Revision: 51600

Modified:
   python/branches/p3yk/Doc/lib/libdis.tex
   python/branches/p3yk/Include/Python-ast.h
   python/branches/p3yk/Include/opcode.h
   python/branches/p3yk/Lib/compiler/pycodegen.py
   python/branches/p3yk/Lib/opcode.py
   python/branches/p3yk/Parser/Python.asdl
   python/branches/p3yk/Python/Python-ast.c
   python/branches/p3yk/Python/ast.c
   python/branches/p3yk/Python/ceval.c
   python/branches/p3yk/Python/import.c
   python/branches/p3yk/Python/peephole.c
   python/branches/p3yk/Python/symtable.c
Log:
Remove the UNARY_CONVERT opcode (was used for backticks).  Also bumped up the
import MAGIC number.


Modified: python/branches/p3yk/Doc/lib/libdis.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libdis.tex     (original)
+++ python/branches/p3yk/Doc/lib/libdis.tex     Fri Aug 25 07:05:30 2006
@@ -165,10 +165,6 @@
 Implements \code{TOS = not TOS}.
 \end{opcodedesc}
 
-\begin{opcodedesc}{UNARY_CONVERT}{}
-Implements \code{TOS = `TOS`}.
-\end{opcodedesc}
-
 \begin{opcodedesc}{UNARY_INVERT}{}
 Implements \code{TOS = \~{}TOS}.
 \end{opcodedesc}

Modified: python/branches/p3yk/Include/Python-ast.h
==============================================================================
--- python/branches/p3yk/Include/Python-ast.h   (original)
+++ python/branches/p3yk/Include/Python-ast.h   Fri Aug 25 07:05:30 2006
@@ -186,9 +186,8 @@
 enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
                   IfExp_kind=5, Dict_kind=6, ListComp_kind=7,
                   GeneratorExp_kind=8, Yield_kind=9, Compare_kind=10,
-                  Call_kind=11, Repr_kind=12, Num_kind=13, Str_kind=14,
-                  Attribute_kind=15, Subscript_kind=16, Name_kind=17,
-                  List_kind=18, Tuple_kind=19};
+                  Call_kind=11, Num_kind=12, Str_kind=13, Attribute_kind=14,
+                  Subscript_kind=15, Name_kind=16, List_kind=17, 
Tuple_kind=18};
 struct _expr {
         enum _expr_kind kind;
         union {
@@ -253,10 +252,6 @@
                 } Call;
                 
                 struct {
-                        expr_ty value;
-                } Repr;
-                
-                struct {
                         object n;
                 } Num;
                 
@@ -414,7 +409,6 @@
 expr_ty Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty
              starargs, expr_ty kwargs, int lineno, int col_offset, PyArena
              *arena);
-expr_ty Repr(expr_ty value, int lineno, int col_offset, PyArena *arena);
 expr_ty Num(object n, int lineno, int col_offset, PyArena *arena);
 expr_ty Str(string s, int lineno, int col_offset, PyArena *arena);
 expr_ty Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int

Modified: python/branches/p3yk/Include/opcode.h
==============================================================================
--- python/branches/p3yk/Include/opcode.h       (original)
+++ python/branches/p3yk/Include/opcode.h       Fri Aug 25 07:05:30 2006
@@ -18,7 +18,6 @@
 #define UNARY_POSITIVE 10
 #define UNARY_NEGATIVE 11
 #define UNARY_NOT      12
-#define UNARY_CONVERT  13
 
 #define UNARY_INVERT   15
 

Modified: python/branches/p3yk/Lib/compiler/pycodegen.py
==============================================================================
--- python/branches/p3yk/Lib/compiler/pycodegen.py      (original)
+++ python/branches/p3yk/Lib/compiler/pycodegen.py      Fri Aug 25 07:05:30 2006
@@ -1207,9 +1207,6 @@
     def visitNot(self, node):
         return self.unaryOp(node, 'UNARY_NOT')
 
-    def visitBackquote(self, node):
-        return self.unaryOp(node, 'UNARY_CONVERT')
-
     # bit ops
 
     def bitOp(self, nodes, op):

Modified: python/branches/p3yk/Lib/opcode.py
==============================================================================
--- python/branches/p3yk/Lib/opcode.py  (original)
+++ python/branches/p3yk/Lib/opcode.py  Fri Aug 25 07:05:30 2006
@@ -54,7 +54,6 @@
 def_op('UNARY_POSITIVE', 10)
 def_op('UNARY_NEGATIVE', 11)
 def_op('UNARY_NOT', 12)
-def_op('UNARY_CONVERT', 13)
 
 def_op('UNARY_INVERT', 15)
 

Modified: python/branches/p3yk/Parser/Python.asdl
==============================================================================
--- python/branches/p3yk/Parser/Python.asdl     (original)
+++ python/branches/p3yk/Parser/Python.asdl     Fri Aug 25 07:05:30 2006
@@ -65,7 +65,6 @@
             | Compare(expr left, cmpop* ops, expr* comparators)
             | Call(expr func, expr* args, keyword* keywords,
                         expr? starargs, expr? kwargs)
-            | Repr(expr value)
             | Num(object n) -- a number as a PyObject.
             | Str(string s) -- need to specify raw, unicode, etc?
             -- other literals? bools?

Modified: python/branches/p3yk/Python/Python-ast.c
==============================================================================
--- python/branches/p3yk/Python/Python-ast.c    (original)
+++ python/branches/p3yk/Python/Python-ast.c    Fri Aug 25 07:05:30 2006
@@ -206,10 +206,6 @@
         "starargs",
         "kwargs",
 };
-static PyTypeObject *Repr_type;
-static char *Repr_fields[]={
-        "value",
-};
 static PyTypeObject *Num_type;
 static char *Num_fields[]={
         "n",
@@ -532,8 +528,6 @@
         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 @@
 }
 
 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 @@
                         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 @@
         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) <

Modified: python/branches/p3yk/Python/ast.c
==============================================================================
--- python/branches/p3yk/Python/ast.c   (original)
+++ python/branches/p3yk/Python/ast.c   Fri Aug 25 07:05:30 2006
@@ -401,9 +401,6 @@
         case Compare_kind:
             expr_name = "comparison";
             break;
-        case Repr_kind:
-            expr_name = "repr";
-            break;
         case IfExp_kind:
             expr_name = "conditional expression";
             break;

Modified: python/branches/p3yk/Python/ceval.c
==============================================================================
--- python/branches/p3yk/Python/ceval.c (original)
+++ python/branches/p3yk/Python/ceval.c Fri Aug 25 07:05:30 2006
@@ -1040,14 +1040,6 @@
                        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);

Modified: python/branches/p3yk/Python/import.c
==============================================================================
--- python/branches/p3yk/Python/import.c        (original)
+++ python/branches/p3yk/Python/import.c        Fri Aug 25 07:05:30 2006
@@ -65,9 +65,10 @@
        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

Modified: python/branches/p3yk/Python/peephole.c
==============================================================================
--- python/branches/p3yk/Python/peephole.c      (original)
+++ python/branches/p3yk/Python/peephole.c      Fri Aug 25 07:05:30 2006
@@ -189,9 +189,6 @@
                        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 @@
                                /* 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)  &&

Modified: python/branches/p3yk/Python/symtable.c
==============================================================================
--- python/branches/p3yk/Python/symtable.c      (original)
+++ python/branches/p3yk/Python/symtable.c      Fri Aug 25 07:05:30 2006
@@ -1182,9 +1182,6 @@
                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. */
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to