summaryrefslogtreecommitdiffstats
path: root/Lib/compiler/pycodegen.py
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-02-07 00:54:41 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2009-02-07 00:54:41 (GMT)
commit92c3b2190bae6dd7844c83b6acefc0b89d2bc225 (patch)
tree0cb1e4a65dab9e1ee5f24409d6c758ebc44bb3ba /Lib/compiler/pycodegen.py
parent98c3b85bc4b64307fc12b53210f941c6458bccb5 (diff)
downloadcpython-92c3b2190bae6dd7844c83b6acefc0b89d2bc225.zip
cpython-92c3b2190bae6dd7844c83b6acefc0b89d2bc225.tar.gz
cpython-92c3b2190bae6dd7844c83b6acefc0b89d2bc225.tar.bz2
Issue #999042: The Python compiler now handles explict global statements
correctly (should be assigned using STORE_GLOBAL opcode). This was done by having the system table differentiate between explict and implicit globals.
Diffstat (limited to 'Lib/compiler/pycodegen.py')
-rw-r--r--Lib/compiler/pycodegen.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
index e7ce1a9..6d5a41c 100644
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -7,7 +7,8 @@ from cStringIO import StringIO
from compiler import ast, parse, walk, syntax
from compiler import pyassem, misc, future, symbols
-from compiler.consts import SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL
+from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICT, \
+ SC_FREE, SC_CELL
from compiler.consts import (CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS,
CO_NESTED, CO_GENERATOR, CO_FUTURE_DIVISION,
CO_FUTURE_ABSIMPORT, CO_FUTURE_WITH_STATEMENT, CO_FUTURE_PRINT_FUNCTION)
@@ -282,7 +283,9 @@ class CodeGenerator:
self.emit(prefix + '_NAME', name)
else:
self.emit(prefix + '_FAST', name)
- elif scope == SC_GLOBAL:
+ elif scope == SC_GLOBAL_EXPLICT:
+ self.emit(prefix + '_GLOBAL', name)
+ elif scope == SC_GLOBAL_IMPLICIT:
if not self.optimized:
self.emit(prefix + '_NAME', name)
else: