| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
If passed a .py file as an argument, try to find its accompanying
.pyc.
|
|
|
|
|
|
|
|
| |
Invoke compiler.syntax.check() after building AST. If a SyntaxError
occurs, print the error and exit without generating a .pyc file.
Refactor code to use compiler.misc.set_filename() rather than passing
filename argument around to each CodeGenerator instance.
|
| |
|
| |
|
|
|
|
|
|
| |
introspection incompatibility, but in fact it's just that calltips
always gave up on a docstring that started with a newline (but
didn't realize they were giving up <wink>).
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the option to have nested scopes or old LGB scopes. This has a
large impact on the code base, by removing the need for two variants
of each CodeGenerator.
Add a get_module() method to CodeGenerator objects, used to get the
future features for the current module.
Set CO_GENERATOR, CO_GENERATOR_ALLOWED, and CO_FUTURE_DIVISION flags
as appropriate.
Attempt to fix the value of nlocals in newCodeObject(), assuming that
nlocals is 0 if CO_NEWLOCALS is not defined.
|
|
|
|
|
|
|
| |
bound.
When a Yield() node is visited, assign to the generator attribute of
the scope, not the visitor.
|
| |
|
| |
|
| |
|
|
|
|
| |
Shuts up another couple of gcc warnings.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
operators per line or statement are now on by default, and -m turns
these warnings off.
- Change the way multiple / operators are reported; a regular
recommendation is always emitted after the warning.
- Report ambiguous warnings (both int|long and float|complex used for
the same operator).
- Update the doc string again to clarify all this and describe the
possible messages more precisely.
|
| |
|
|
|
|
|
| |
division, and this makes sense. Add -Qwarnall to warn for all
classic divisions, as required by the fixdiv.py tool.
|
| |
|
|
|
|
|
| |
treated the same as single ones by default. Added -m option to issue
a warning for this case instead.
|
|
|
|
|
|
|
| |
percolated out, and some general cleanup. The output is still the
same, except it now prints "Index: <file>" instead of "Processing:
<file>", so that the output can be used as input for patch (but only
the diff-style parts of it).
|
| |
|
|
|
|
|
| |
to be change to //. The code is pretty gross so far, and I promise
I'll work on this more, but I have to go eat now! :-)
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
| |
try/except or try/finally.
Previous versions had only track SETUP_LOOP blocks and ignored the
exception part. This meant that it allowed continue inside a
try/except but generated buggy code. Now it does the right thing.
|
|
|
|
| |
Add CONTINUE_LOOP to the list of unconditional transfers
|
| |
|
|
|
|
|
|
|
| |
starts a new line.
Also fix undetected typo in visitDict() -- uncovered by recent change
to add lineno attrs to atoms.
|
| |
|
|
|
|
|
| |
XXX The code is still widely inaccurate, but most (all?) of the time
it's an overestimate.
|
|
|
|
|
|
|
|
|
|
| |
As the doc string for _lookupName() explains:
This routine uses a list instead of a dictionary, because a
dictionary can't store two different keys if the keys have the
same value but different types, e.g. 2 and 2L. The compiler
must treat these two separately, so it does an explicit type
comparison before comparing the values.
|
| |
|
|
|
|
|
|
|
| |
Generate SET_LINENO for del statements.
Define klass=1 for PyFlowGraph constructor for a class statement. A
class has no varnames.
|
|
|
|
|
|
|
|
| |
Avoid if/elif/elif/else tests where the final else is supposed to
handle exactly one case instead of all other cases. When the list of
operators is extended, the catchall else treats all new operators as
the last operator in the set of tests. Instead, raise an exception if
an unexpected operator occurs.
|
|
|
|
|
| |
Fix bug in handling of statements like "l[x:y] = 2". The visitor was
treating this as assignments to l, x, and y!
|
|
|
|
|
|
|
|
| |
Use a dictionary instead of a list to map objects to their offsets in
a const/name tuple of a code object.
XXX The conversion is perhaps incomplete, in that we shouldn't have to
do the list2dict to start.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for floor division (// and //=)
The implementation of getChildren() and getChildNodes() is intended to
be faster, because it avoids calling flatten() on every return value.
But it's not clear that it is a lot faster, because constructing a
tuple with just the right values ends up being slow. (Too many
attribute lookups probably.)
The ast.txt file is much more complicated, with funny characters at
the ends of names (*, &, !) to indicate the types of each child node.
The astgen script is also much more complex, making me wonder if it's
still useful.
|
| |
|
|
|
|
| |
contiguous.
|
|
|
|
|
|
| |
varnames should list all the local variables (with arguments first).
The XXX_NAME ops typically occur at the module level and assignment
ops should create locals.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Hard to believe these were never handled before)
Add misc.mangle() that mangles based on the rules in compile.c.
XXX Need to test the corner cases
Update CodeGenerator with a class_name attribute bound to None. If a
particular instance is created within a class scope, the instance's
class_name is bound to that class's name.
Add mangle() method to CodeGenerator that mangles if the class_name
has a class_name in it.
Modify the FunctionCodeGenerator family to handle an extra argument--
the class_name.
Wrap all name ops and attrnames in calls to self.mangle()
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make nested scopes enabled by default
Add is_constant_false() helper so that compiled code and symbols are
consistent with builtin compiler's handling of "if 0:"
Fix doc string handling to be consistent with recent change that
eliminates the doc string from the Module's node attribute.
Add fix to print handling from Evan & Shane.
Track change to visitor api by making "verbose" explicit.
Comment out setting CO_NESTED flag (it's unnecessary in 2.2).
|
|
|
|
|
|
|
|
| |
Evan Simpson's fix. And his explanation:
If you defined two nested functions in a row that refer to the
same non-global variable, the second one will be generated as
though the variable were global.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The use of com_node() introduces a lot of extra stack frames, enough
to cause a stack overflow compiling test.test_parser with the standard
interpreter recursionlimit. The com_node() is a convenience function
that hides the dispatch details, but comes at a very high cost. It is
more efficient to dispatch directly in the callers. In these cases,
use lookup_node() and call the dispatched node directly.
Also handle yield_stmt in a way that will work with Python 2.1
(suggested by Shane Hathaway)
|
|
|
|
|
|
|
| |
Remove _preorder as alias for dispatch and call dispatch directly.
Add an extra optional argument to walk()
XXX Also comment out some code that does debugging prints.
|
| |
|
| |
|