[Patches] [ python-Patches-1251748 ] compiler package: "global a; a=5"
SourceForge.net
noreply at sourceforge.net
Mon Sep 5 00:52:16 CEST 2005
Patches item #1251748, was opened at 2005-08-04 10:28
Message generated for change (Comment added) made by nascheme
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1251748&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Armin Rigo (arigo)
Assigned to: Nobody/Anonymous (nobody)
Summary: compiler package: "global a; a=5"
Initial Comment:
The stdlib compiler package produces wrong code for
"global a; a=5". It produces a STORE_NAME instead of a
STORE_GLOBAL.
Quick patch from Michael attached.
----------------------------------------------------------------------
>Comment By: Neil Schemenauer (nascheme)
Date: 2005-09-04 22:52
Message:
Logged In: YES
user_id=35752
These fixes should definitely go into 2.5, IMHO. If you
need help porting the patch, let me know.
----------------------------------------------------------------------
Comment By: Armin Rigo (arigo)
Date: 2005-09-04 13:09
Message:
Logged In: YES
user_id=4771
The compiler package contains several bugs along the lines
of the one reported here. It doesn't seem to be that much
used; with PyPy it is probably the first time that this
package is tested in-depth, as we are trying to pass
CPython's own test suite by using only this compiler
package. We had to make a few involved fixes.
Attached is a diff against the 2.4 maintenance head of
CPython (we based our changes on 2.4.1). If there is
interest, I can extract individual parts of the big diff
and/or port them to 2.5 CVS HEAD. For now I will only give
a quick overview of the diff.
* the more involved problem was related to scoping of
variables. This turned out to be more difficult to fix than
mwh's patch (included in this tracker). (Disclaimer:
Michael never pretended his patch was more than a quick
hack.) For reference, see the following code snippets:
http://codespeak.net/svn/pypy/dist/pypy/interpreter/test/test_syntax.py
* we try to always raise SyntaxErrors with line number
information. (Note sure if this has been done completely yet.)
* pyassem.py has some heavy changes that I cannot comment on
(don't know about them). Other changes there are related to
scoping flags.
* a number of situations should raise a SyntaxError, but
were silently accepted (and generally produce weird bytecodes).
* fixed docstring handling. Previously, in interactive
mode, entering "hello" produced no result at all -- because
the string was interpreted as a docstring! Also, a genuine
docstring on the same line as a statement -- "docstring";
x=5 -- would result in the statement being ignored.
* we can pass future flags from outside now.
* lambda functions didn't get the official name <lambda>.
(Yeah, I know it's a detail, but a CPython test fails
because of that.)
* added raising of SyntaxWarnings.
* the st->ast transformer 'single' mode now returns a Module
AST node instead of a Stmt. This matches more closely what
the rest of the package expects.
* some minor changes in transformer.py are probably not
interesting to CPython (e.g. changing some () into []).
Their goal was to make transformer.py statically typeable
for PyPy.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1251748&group_id=5470
More information about the Patches
mailing list