| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
in multiple places. This makes compile()/eval()/etc also inherit the
absolute-import codeflag, like division and with-statement already were.
|
|
|
|
| |
Neal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- IMPORT_NAME takes an extra argument from the stack: the relativeness of
the import. Only passed to __import__ when it's not -1.
- __import__() takes an optional 5th argument for the same thing; it
__defaults to -1 (old semantics: try relative, then absolute)
- 'from . import name' imports name (be it module or regular attribute)
from the current module's *package*. Likewise, 'from .module import name'
will import name from a sibling to the current module.
- Importing from outside a package is not allowed; 'from . import sys' in a
toplevel module will not work, nor will 'from .. import sys' in a
(single-level) package.
- 'from __future__ import absolute_import' will turn on the new semantics
for import and from-import: imports will be absolute, except for
from-import with dots.
Includes tests for regular imports and importhooks, parser changes and a
NEWS item, but no compiler-package changes or documentation changes.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was started by Mike Bland and completed by Guido
(with help from Neal).
This still needs a __future__ statement added;
Thomas is working on Michael's patch for that aspect.
There's a small amount of code cleanup and refactoring
in ast.c, compile.c and ceval.c (I fixed the lltrace
behavior when EXT_POP is used -- however I had to make
lltrace a static global).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
breaks the parser module, because it adds the if/else construct as well as
two new grammar rules for backward compatibility. If no one else fixes
parsermodule, I guess I'll go ahead and fix it later this week.
The TeX code was checked with texcheck.py, but not rendered. There is
actually a slight incompatibility:
>>> (x for x in lambda:0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: iteration over non-sequence
changes into
>>> (x for x in lambda: 0)
File "<stdin>", line 1
(x for x in lambda: 0)
^
SyntaxError: invalid syntax
Since there's no way the former version can be useful, it's probably a
bugfix ;)
|
| |
|
|
|
|
| |
variables
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This code generated a C assertion:
assert 1, ([s for s in x] +
[s for s in x])
pass
assert was completely broken, it needed to use the proper block.
compiler_use_block() is now no longer used, so remove it.
|
| |
|
| |
|
|
|
|
| |
simplifies a lot of error handling code, and fixes many memory leaks.
|
| |
|
| |
|
|
|
|
|
| |
Document more info about the benefits of configuring without
pymalloc when running valgrind
|
|
|
|
|
|
| |
Also converted a bunch of assert(0) to SystemError's.
There are still printfs, etc that need to be cleaned up.
|
|
|
|
| |
with symtable.c
|
|
|
|
|
|
| |
(Call symtable_exit_block or compiler_exit_scope as appropriate)
Use PyMem_Free on c_future since it was allocated with PyMem_Malloc
|
| |
|
|
|
|
|
| |
allocated by compiler_enter_scope(). Change return type for
compiler_exit_scope() to be void.
|
| |
|
|
|
|
| |
fixing problems with EXTENDED_ARG
|
| |
|
|
|
|
| |
the scope of names can be correctly determined.
|
| |
|
|
|
|
|
| |
historically been looked up using LOAD_NAME, not LOAD_GLOBAL.
looked up by LOAD_NAME, not
|
|
|
|
| |
part. Fixes one bug from #1333982.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.
The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
|
| |
|
|
|
|
|
| |
method still needs to support string exceptions, and allow None for the
third argument. Documentation updates are needed, too.
|
| |
|
|
|
|
| |
``class C(): pass`` is no longer a syntax error.
|
|
|
|
| |
with || expressions. Also clarifies intend of 'if' conditional.
|
| |
|
|
|
|
|
|
| |
Add a test in case the underlying assumptions ever change (i.e. the
compiler starts generating code blocks that are not punctuated by
RETURN_VALUE).
|
|
|
|
|
| |
Afterwards, -0.5 loads in a single step and no longer requires a runtime
UNARY_NEGATIVE operation.
|
| |
|
| |
|
|
|
|
| |
of a "in" or "not in" test.
|
|
|
|
|
| |
Inspired by Skip's idea to recognize the throw-away nature of sequences
in this context and to transform their type to one with better performance.
|
|
|
|
| |
Saves space in the presence of code like: (None,)*10000
|
|
|
|
|
| |
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.
|