summaryrefslogtreecommitdiffstats
path: root/Lib/compiler/pyassem.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-08-30 20:25:55 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-08-30 20:25:55 (GMT)
commit71ebc3359bb1a5106ba3c282746817d5d44e735b (patch)
tree545b890ab51c541d5043172fc45d4ba2a8ce7844 /Lib/compiler/pyassem.py
parent017cb2c7d85fa4a07365a9a205aca21bc29d01a8 (diff)
downloadcpython-71ebc3359bb1a5106ba3c282746817d5d44e735b.zip
cpython-71ebc3359bb1a5106ba3c282746817d5d44e735b.tar.gz
cpython-71ebc3359bb1a5106ba3c282746817d5d44e735b.tar.bz2
Fix _convert_NAME() so that it doesn't store locals for class bodies.
Fix list comp code generation -- emit GET_ITER instead of Const(0) after the list. Add CO_GENERATOR flag to generators. Get CO_xxx flags from the new module
Diffstat (limited to 'Lib/compiler/pyassem.py')
-rw-r--r--Lib/compiler/pyassem.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/compiler/pyassem.py b/Lib/compiler/pyassem.py
index dc01656..c3fa7b7 100644
--- a/Lib/compiler/pyassem.py
+++ b/Lib/compiler/pyassem.py
@@ -7,6 +7,8 @@ import sys
import types
from compiler import misc
+from compiler.consts import CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, \
+ CO_VARKEYWORDS
def xxx_sort(l):
l = l[:]
@@ -311,11 +313,6 @@ class Block:
return contained
# flags for code objects
-CO_OPTIMIZED = 0x0001
-CO_NEWLOCALS = 0x0002
-CO_VARARGS = 0x0004
-CO_VARKEYWORDS = 0x0008
-CO_NESTED = 0x0010
# the FlowGraph is transformed in place; it exists in one of these states
RAW = "RAW"
@@ -503,7 +500,8 @@ class PyFlowGraph(FlowGraph):
return self._lookupName(arg, self.names)
def _convert_NAME(self, arg):
- self._lookupName(arg, self.varnames)
+ if self.klass is None:
+ self._lookupName(arg, self.varnames)
return self._lookupName(arg, self.names)
_convert_STORE_NAME = _convert_NAME
_convert_DELETE_NAME = _convert_NAME
@@ -739,9 +737,8 @@ class StackDepthTracker:
'DELETE_SUBSCR': -2,
# PRINT_EXPR?
'PRINT_ITEM': -1,
- 'LOAD_LOCALS': 1,
'RETURN_VALUE': -1,
- 'EXEC_STMT': -2,
+ 'EXEC_STMT': -3,
'BUILD_CLASS': -2,
'STORE_NAME': -1,
'STORE_ATTR': -2,
@@ -756,6 +753,7 @@ class StackDepthTracker:
# close enough...
'SETUP_EXCEPT': 3,
'SETUP_FINALLY': 3,
+ 'FOR_ITER': 1,
}
# use pattern match
patterns = [