summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-11 22:15:52 (GMT)
committerThomas Wouters <thomas@python.org>2000-08-11 22:15:52 (GMT)
commit0be5aab04d2f441323e8a7681f79137d26fd2e30 (patch)
tree67b542d99a3b0ddf62427b2b05a25dafa13437cc
parenta8d7341f63fc73f46eb997c2b9481ce0d35069ae (diff)
downloadcpython-0be5aab04d2f441323e8a7681f79137d26fd2e30.zip
cpython-0be5aab04d2f441323e8a7681f79137d26fd2e30.tar.gz
cpython-0be5aab04d2f441323e8a7681f79137d26fd2e30.tar.bz2
Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since they
did the same anyway. I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of distutils, is it ? Should it try to be compatible with old bytecode version ?
-rw-r--r--Doc/lib/libdis.tex8
-rw-r--r--Include/opcode.h4
-rw-r--r--Lib/dis.py4
-rw-r--r--Python/ceval.c3
-rw-r--r--Python/compile.c23
-rw-r--r--Python/import.c2
6 files changed, 15 insertions, 29 deletions
diff --git a/Doc/lib/libdis.tex b/Doc/lib/libdis.tex
index 26cc567..bf1fc63 100644
--- a/Doc/lib/libdis.tex
+++ b/Doc/lib/libdis.tex
@@ -337,14 +337,14 @@ Implements \code{del name}, where \var{namei} is the index into
\member{co_names} attribute of the code object.
\end{opcodedesc}
-\begin{opcodedesc}{UNPACK_TUPLE}{count}
+\begin{opcodedesc}{UNPACK_SEQUENCE}{count}
Unpacks TOS into \var{count} individual values, which are put onto
the stack right-to-left.
\end{opcodedesc}
-\begin{opcodedesc}{UNPACK_LIST}{count}
-Unpacks TOS into \var{count} individual values.
-\end{opcodedesc}
+%\begin{opcodedesc}{UNPACK_LIST}{count}
+%This opcode is obsolete.
+%\end{opcodedesc}
%\begin{opcodedesc}{UNPACK_ARG}{count}
%This opcode is obsolete.
diff --git a/Include/opcode.h b/Include/opcode.h
index 630d5dd..78505b7 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -76,8 +76,8 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#define STORE_NAME 90 /* Index in name list */
#define DELETE_NAME 91 /* "" */
-#define UNPACK_TUPLE 92 /* Number of tuple items */
-#define UNPACK_LIST 93 /* Number of list items */
+#define UNPACK_SEQUENCE 92 /* Number of sequence items */
+
#define STORE_ATTR 95 /* Index in name list */
#define DELETE_ATTR 96 /* "" */
#define STORE_GLOBAL 97 /* "" */
diff --git a/Lib/dis.py b/Lib/dis.py
index faea354..3309357 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -206,8 +206,8 @@ HAVE_ARGUMENT = 90 # Opcodes from here have an argument:
name_op('STORE_NAME', 90) # Index in name list
name_op('DELETE_NAME', 91) # ""
-def_op('UNPACK_TUPLE', 92) # Number of tuple items
-def_op('UNPACK_LIST', 93) # Number of list items
+def_op('UNPACK_SEQUENCE', 92) # Number of tuple items
+
name_op('STORE_ATTR', 95) # Index in name list
name_op('DELETE_ATTR', 96) # ""
name_op('STORE_GLOBAL', 97) # ""
diff --git a/Python/ceval.c b/Python/ceval.c
index 9bcb2ad..40b5738 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1165,8 +1165,7 @@ eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
default: switch (opcode) {
#endif
- case UNPACK_TUPLE:
- case UNPACK_LIST:
+ case UNPACK_SEQUENCE:
v = POP();
if (PyTuple_Check(v)) {
if (PyTuple_Size(v) != oparg) {
diff --git a/Python/compile.c b/Python/compile.c
index 49e5863..395bd1e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1729,27 +1729,14 @@ com_assign_trailer(struct compiling *c, node *n, int assigning)
}
static void
-com_assign_tuple(struct compiling *c, node *n, int assigning)
+com_assign_sequence(struct compiling *c, node *n, int assigning)
{
int i;
if (TYPE(n) != testlist)
REQ(n, exprlist);
if (assigning) {
i = (NCH(n)+1)/2;
- com_addoparg(c, UNPACK_TUPLE, i);
- com_push(c, i-1);
- }
- for (i = 0; i < NCH(n); i += 2)
- com_assign(c, CHILD(n, i), assigning);
-}
-
-static void
-com_assign_list(struct compiling *c, node *n, int assigning)
-{
- int i;
- if (assigning) {
- i = (NCH(n)+1)/2;
- com_addoparg(c, UNPACK_LIST, i);
+ com_addoparg(c, UNPACK_SEQUENCE, i);
com_push(c, i-1);
}
for (i = 0; i < NCH(n); i += 2)
@@ -1775,7 +1762,7 @@ com_assign(struct compiling *c, node *n, int assigning)
case exprlist:
case testlist:
if (NCH(n) > 1) {
- com_assign_tuple(c, n, assigning);
+ com_assign_sequence(c, n, assigning);
return;
}
n = CHILD(n, 0);
@@ -1843,7 +1830,7 @@ com_assign(struct compiling *c, node *n, int assigning)
"can't assign to []");
return;
}
- com_assign_list(c, n, assigning);
+ com_assign_sequence(c, n, assigning);
return;
case NAME:
com_assign_name(c, CHILD(n, 0), assigning);
@@ -2869,7 +2856,7 @@ com_fplist(struct compiling *c, node *n)
}
else {
int i = (NCH(n)+1)/2;
- com_addoparg(c, UNPACK_TUPLE, i);
+ com_addoparg(c, UNPACK_SEQUENCE, i);
com_push(c, i-1);
for (i = 0; i < NCH(n); i += 2)
com_fpdef(c, CHILD(n, i));
diff --git a/Python/import.c b/Python/import.c
index 3c5f624..9b30942 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -66,7 +66,7 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
/* XXX Perhaps the magic number should be frozen and a version field
added to the .pyc file header? */
/* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */
-#define MAGIC (50428 | ((long)'\r'<<16) | ((long)'\n'<<24))
+#define MAGIC (50811 | ((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