| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
bytecodes from the previously saved .pyc files. Fixed by disabling the static
optimization of BINARY_DIVIDE between two constants.
|
| |
|
|
|
|
| |
There is no test for this change, because there is no way to provoke memory errors on demand. Test suite passes, though.
|
|
|
|
|
|
| |
everytime a LOAD_CONSTANT is encountered, created, or overwritten.
Added two tests to cover cases affected by the patch.
|
|
|
|
| |
No longer assumes that the input is NOP free.
|
| |
|
|
|
|
|
|
|
|
| |
* Use simpler, faster two pass algorithm for markblocks().
* Free the blocks variable if not NULL and exiting without change.
* Verify that the rest of the compiler has not set an exception.
* Make the test for tuple of constants less restrictive.
* Embellish the comment for chained conditional jumps.
|
|
|
|
|
|
|
| |
Peepholer could be fooled into misidentifying a tuple_of_constants.
Added code to count consecutive occurrences of LOAD_CONST.
Use the count to weed out the misidentified cases.
Added a unittest.
|
| |
|
|
|
|
|
| |
Rather than introduce new logic, took the approach of making the message
itself more general.
|
| |
|
|
|
|
| |
(Suggested by Michael Hudson.)
|
|
|
|
|
|
|
|
| |
Example:
>>> import dis
>>> dis.dis(compile('1,2,3', '', 'eval'))
0 0 LOAD_CONST 3 ((1, 2, 3))
3 RETURN_VALUE
|
|
|
|
|
| |
"from blah import (foo, bar
baz, bongo)"
|
|
|
|
|
|
|
|
| |
Allows the lineno fixup code to remain simple and not have to deal with
multibyte codings.
* Add an assertion to that effect.
* Remove the XXX comment on the subject.
|
| |
|
|
|
|
| |
(Suggested by Neal Norwitz.)
|
|
|
|
|
|
|
|
|
| |
* Perform the code length check earlier.
* Eliminate the extra PyMem_Free() upon hitting an EXTENDED_ARG.
* Assert that the NOP count used in jump retargeting matches the NOPs
eliminated in the final step.
* Add an XXX note to indicate that more work is being to done to
handle linenotab with intervals > 255.
|
|
|
|
|
|
|
|
|
| |
* Make a pass to eliminate NOPs. Produce code that is more readable,
more compact, and a tiny bit faster. Makes the peepholer more flexible
in the scope of allowable transformations.
* With Guido's okay, bumped up the magic number so that this patch gets
widely exercised before the alpha goes out.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
files and not re-optimized upon import. Saves a bit of startup time while
still remaining decoupled from the rest of the compiler.
As a side benefit, handcoded bytecode is not run through the optimizer
when new code objects are created. Hopefully, a handcoder has already
created exactly what they want to have run.
(Idea suggested by Armin Rigo and Michael Hudson. Initially avoided
because of worries about compiler coupling; however, only the nexus
point needed to be moved so there won't be a conflict when the AST
branch is loaded.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[ 1009560 ] Fix @decorator evaluation order
From the description:
Changes in this patch:
- Change Grammar/Grammar to require
newlines between adjacent decorators.
- Fix order of evaluation of decorators
in the C (compile.c) and python
(Lib/compiler/pycodegen.py) compilers
- Add better order of evaluation check
to test_decorators.py (test_eval_order)
- Update the decorator documentation in
the reference manual (improve description
of evaluation order and update syntax
description)
and the comment:
Used Brett's evaluation order (see
http://mail.python.org/pipermail/python-dev/2004-August/047835.html)
(I'm checking this in for Anthony who was having problems getting SF to
talk to him)
|
|
|
|
| |
top-down. Now matches the PEP.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
[ 1005248 ] new.code() not cleanly checking its arguments
using the result of new.code() can still destroy the sun, but merely
calling the function shouldn't any more.
I also rewrote the existing tests of new.code() to use vastly less
un-bogus arguments, and added tests for the previous insane behaviours.
|
|
|
|
| |
Will backport.
|
|
|
|
| |
.pyc size) after all.
|
|
|
|
|
| |
Hard to believe it ever helped anything, and it hurts finding reference
leaks.
|
| |
|
|
|
|
|
| |
"@ seems the syntax that everybody can hate equally"
Implementation by Mark Russell, from SF #979728.
|
| |
|
|
|
|
|
|
| |
The preceding case statement was missing a terminating "break" stmt,
so fell into the new code by mistake. This caused uncaught out-of-bounds
accesses to the "names" tuple, leading to a variety of insane behaviors.
|
| |
|
| |
|
| |
|
|
|
|
| |
Reduces the cost of "not" to almost zero.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Code contributed by Jiwon Seo.)
The documentation portion of the patch is being re-worked and will be
checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's
rationale for the design decisions on binding behavior (as described in
in his patch comments and in discussions on python-dev).
The test file, test_genexps.py, is written in doctest format and is
meant to exercise all aspects of the the patch. Further additions are
welcome from everyone. Please stress test this new feature as much as
possible before the alpha release.
|
|
|
|
|
|
|
|
| |
def f(a):
if a:
print 5
else:
pass
|
|
|
|
| |
Gives 30% speedup on "a,b=1,2" and 25% on "a,b,c=1,2,3".
|
|
|
|
|
| |
Add a new opcode, LIST_APPEND, and apply it to the code generation for
list comprehensions. Reduces the per-loop overhead by about a third.
|
|
|
|
|
|
|
|
|
|
| |
and left shifts. (Thanks to Kalle Svensson for SF patch 849227.)
This addresses most of the remaining semantic changes promised by
PEP 237, except for repr() of a long, which still shows the trailing
'L'. The PEP appears to promise warnings for operations that
changed semantics compared to Python 2.3, but this is not
implemented; we've suffered through enough warnings related to
hex/oct literals and I think it's best to be silent now.
|
|
|
|
| |
rename LOCAL_GLOBAL to PARAM_GLOBAL.
|
|
|
|
|
|
| |
* Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a) --> PyTuple_New(0)
* Py_BuildValue("O", a) --> Py_INCREF(a)
|
|
|
|
|
|
|
| |
Refactor code so that one helper routine sets error location and
increments st_errors.
Bug fix candidate.
|
| |
|
|
|
|
| |
Will backport to 2.3.1
|
|
|
|
|
| |
Make sure the inner function is not compiled when there is a syntax
error in the default arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes for three related bugs, including errors that caused a script to
be ignored without printing an error message. The key problem was a bad
interaction between syntax warnings and syntax errors. If an
exception was already set when a warning was issued, the warning could
clobber the exception.
The PyErr_Occurred() check in issue_warning() isn't entirely
satisfying (the caller should know whether there was already an
error), but a better solution isn't immediately obvious.
Bug fix candidate.
|
|
|
|
|
|
|
| |
It depended on the previously removed basic block checker to
prevent a jump into the middle of the transformed block.
Clears SF 757818: tuple assignment -- SystemError: unknown opcode
|