Serhiy Storchaka
3f22811fef
bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)
7 years ago
Ammar Askar
025eb98dc0
bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)
Also point to start of tokens in parsing errors.
Fixes bpo-34683
7 years ago
Nitish Chandra
3a087beddd
bpo-32836: Remove obsolete code from symtable pass (GH-5680)
When comprehensions switched to using a nested scope, the old
code for generating a temporary name to hold the accumulation
target became redundant, but was never actually removed.
Patch by Nitish Chandra.
8 years ago
Serhiy Storchaka
07ca9afaa8
bpo-10544: Disallow "yield" in comprehensions and generator expressions. (GH-4564)
8 years ago
Serhiy Storchaka
73a7e9b10b
bpo-10544: Deprecate "yield" in comprehensions and generator expressions. (GH-4579)
The current behaviour of yield expressions inside comprehensions and
generator expressions is essentially an accident of implementation - it
arises implicitly from the way the compiler handles yield expressions inside
nested functions and generators.
Since the current behaviour wasn't deliberately designed, and is inherently
confusing, we're deprecating it, with no current plans to reintroduce it.
Instead, our advice will be to use a named nested generator definition
for cases where this behaviour is desired.
8 years ago
Ivan Levkivskyi
8c83c23fa3
bpo-28936: Detect lexically first syntax error first ( #4097 )
Lexically first global and nonlocal syntax errors at given scope should be detected first.
8 years ago
Eric Snow
2ebc5ce42a
bpo-30860: Consolidate stateful runtime globals. ( #3397 )
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
8 years ago
Serhiy Storchaka
f4934ea77d
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
9 years ago
Christian Heimes
517507c6d5
Issue #28100 : Refactor error messages, patch by Ivan Levkivskyi
9 years ago
Yury Selivanov
52c4e7cc84
Issue #28008 : Implement PEP 530 -- asynchronous comprehensions.
9 years ago
Guido van Rossum
6cff8744a0
Issue #27999 : Make "global after use" a SyntaxError, and ditto for nonlocal.
Patch by Ivan Levkivskyi.
9 years ago
Yury Selivanov
eb6364557f
Issue #28003 : Implement PEP 525 -- Asynchronous Generators.
9 years ago
Yury Selivanov
f8cb8a16a3
Issue #27985 : Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
9 years ago
Christian Heimes
45af0c83da
Fix potential NULL pointer dereference in update_symbols()
symtable_analyze() calls analyze_block() with bound=NULL. Theoretically
that NULL can be passed down to update_symbols(). update_symbols() may
deference NULL and pass it to PySet_Contains()
9 years ago
Martin Panter
3ee6270262
Fix typos in code comment and documentation
10 years ago
Victor Stinner
f2c1aa1661
Add ast.Constant
Issue #26146 : Add a new kind of AST node: ast.Constant. It can be used by
external AST optimizers, but the compiler does not emit directly such node.
An optimizer can replace the following AST nodes with ast.Constant:
* ast.NameConstant: None, False, True
* ast.Num: int, float, complex
* ast.Str: str
* ast.Bytes: bytes
* ast.Tuple if items are constants too: tuple
* frozenset
Update code to accept ast.Constant instead of ast.Num and/or ast.Str:
* compiler
* docstrings
* ast.literal_eval()
* Tools/parser/unparse.py
10 years ago
Benjamin Peterson
3cc8f4b969
make recording and reporting errors and nonlocal and global directives more robust ( closes #25973 )
10 years ago
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
10 years ago
Eric V. Smith
235a6f0984
Issue #24965 : Implement PEP 498 "Literal String Interpolation". Documentation is still needed, I'll open an issue for that.
10 years ago
Yury Selivanov
b7666a3093
Issue #24619 : More tests; fix nits in compiler.c
11 years ago
Yury Selivanov
f488fb422a
Issue #19235 : Add new RecursionError exception. Patch by Georg Brandl.
11 years ago
Yury Selivanov
7544508f02
PEP 0492 -- Coroutines with async and await syntax. Issue #24017 .
11 years ago
Benjamin Peterson
025e9ebd0a
PEP 448: additional unpacking generalizations ( closes #2292 )
Patch by Neil Girdhar.
11 years ago
Benjamin Peterson
1dfd247c1b
remove the concept of an unoptimized function scope from the compiler, since it can't happen anymore
11 years ago
Benjamin Peterson
9bdd61338d
remove dead *-import checking code ( closes #24049 )
11 years ago
Benjamin Peterson
305e5aac85
don't scale compiler stack frames if the recursion limit is huge ( closes #19098 )
12 years ago
Victor Stinner
14e461d5b9
Close #11619 : The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
13 years ago
Victor Stinner
9a4fb66966
Issue #18408 : ste_new() initialize all attributes before handling error
If an attribute is not initialized, the destructor can crash
13 years ago
Benjamin Peterson
e2135c6158
move definition to top of block
13 years ago
Benjamin Peterson
e8e14591eb
rather than passing locals to the class body, just execute the class body in the proper environment
13 years ago
Benjamin Peterson
1e93b06007
complain about "global __class__" in a class body ( closes #17983 )
13 years ago
Benjamin Peterson
312595ce3a
hide the __class__ closure from the class body ( #12370 )
13 years ago
Benjamin Peterson
cda75be02a
unify some ast.argument's attrs; change Attribute column offset ( closes #16795 )
Patch from Sven Brauch.
13 years ago
Benjamin Peterson
442f20996d
create NameConstant AST class for None, True, and False literals ( closes #16619 )
13 years ago
Mark Dickinson
ded35aeb9d
Issue #16546 : make ast.YieldFrom argument mandatory.
13 years ago
Nick Coghlan
aab9c2b2ea
Issue #5765 : Apply a hard recursion limit in the compiler
Previously, excessive nesting in expressions would blow the
stack and segfault the interpreter. Now, a hard limit based
on the configured recursion limit and a hardcoded scaling
factor is applied.
13 years ago
Benjamin Peterson
d9c8702c0f
point errors related to nonlocals and globals to the statement declaring them ( closes #10189 )
13 years ago
Benjamin Peterson
e132f527c9
check return value of _PyUnicode_AsString
13 years ago
Christian Heimes
dfaf90da9c
Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
13 years ago
Christian Heimes
55ad6515c9
Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
13 years ago
Christian Heimes
65a0141e14
Partly revert ad3824a90261 and add comment about reference ownership
13 years ago
Christian Heimes
1526582df6
Partly revert ad3824a90261 and add comment about reference ownership
13 years ago
Christian Heimes
837e53a7c2
Closed reference leak of variable 'k' in function ste_new which wasn't decrefed in error cases
13 years ago
Christian Heimes
8c1bce00d2
Closed reference leak of variable 'k' in function ste_new which wasn't decrefed in error cases
13 years ago
Nick Coghlan
0b43bcf528
Close #14857 : fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370 , but also updates unittest.mock to workaround that issue
14 years ago
Benjamin Peterson
527c622926
make YieldFrom its own distinct from Yield ( closes #13780 )
14 years ago
Nick Coghlan
1f7ce62bd6
Implement PEP 380 - 'yield from' ( closes #11682 )
14 years ago
Amaury Forgeot d'Arc
97c1bef6a4
Issue #13343 : Fix a SystemError when a lambda expression uses a global
variable in the default value of a keyword-only argument:
(lambda *, arg=GLOBAL_NAME: None)
14 years ago
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
14 years ago
Benjamin Peterson
9d872e19aa
fix possibily uninitialized memory usage ( closes #12474 )
15 years ago