| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Thanks to Georg Brandl for the patch.
|
|\ |
|
| | |
|
|\ \
| |/
| |
| | |
Patch by John Walker.
|
| |
| |
| |
| | |
Patch by John Walker.
|
|/
|
|
| |
comments to explain what's happening, since it's not so obvious.
|
|
|
|
|
|
|
|
|
|
| |
This commit simplifies async/await tokenization in tokenizer.c,
tokenize.py & lib2to3/tokenize.py. Previous solution was to keep
a stack of async-def & def blocks, whereas the new approach is just
to remember position of the outermost async-def block.
This change won't bring any parsing performance improvements, but
it makes the code much easier to read and validate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes how one-line async-defs and defs are tracked
by tokenizer. It allows to correctly parse invalid code such
as:
>>> async def f():
... def g(): pass
... async = 10
and valid code such as:
>>> async def f():
... async def g(): pass
... await z
As a consequence, is is now possible to have one-line
'async def foo(): await ..' functions:
>>> async def foo(): return await bar()
|
|\ |
|
| | |
|
|\ \
| |/
| |
| | |
on error to fix a resource warning.
|
| |
| |
| |
| | |
fix a resource warning.
|
| | |
|
|\ \
| |/
| |
| | |
imp.reload(). Patch by Thomas Kluyver.
|
| |
| |
| |
| | |
imp.reload(). Patch by Thomas Kluyver.
|
| | |
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Python finalization.
Before the module kept a reference to the builtins module, but the module
attributes are cleared during Python finalization. Instead, keep directly a
reference to the open() function.
This enhancement is not perfect, calling tokenize.open() can still fail if
called very late during Python finalization. Usually, the function is called
by the linecache module which is called to display a traceback or emit a
warning.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
finalization.
Before the module kept a reference to the builtins module, but the module
attributes are cleared during Python finalization. Instead, keep directly a
reference to the open() function.
This enhancement is not perfect, calling tokenize.open() can still fail if
called very late during Python finalization. Usually, the function is called
by the linecache module which is called to display a traceback or emit a
warning.
|
|/ |
|
|\ |
|
| | |
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Original patches by A. Kuchling and G. Rees (#12691).
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Patch based on lines from Georg Brandl, Eric Snow, and Gareth Rees.
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| | |
Replace it with correct logic that raises ValueError for bad input.
Issues #8478 and #12691 reported the incorrect logic.
Add an Untokenize test case and an initial test method.
|
|\ \
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* The first line of Python script could be executed twice when the source
encoding (not equal to 'utf-8') was specified on the second line.
* Now the source encoding declaration on the second line isn't effective if
the first line contains anything except a comment.
* As a consequence, 'python -x' works now again with files with the source
encoding declarations specified on the second file, and can be used again
to make Python batch files on Windows.
* The tokenize module now ignore the source encoding declaration on the second
line if the first line contains anything except a comment.
* IDLE now ignores the source encoding declaration on the second line if the
first line contains anything except a comment.
* 2to3 and the findnocoding.py script now ignore the source encoding
declaration on the second line if the first line contains anything except
a comment.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* The first line of Python script could be executed twice when the source
encoding (not equal to 'utf-8') was specified on the second line.
* Now the source encoding declaration on the second line isn't effective if
the first line contains anything except a comment.
* As a consequence, 'python -x' works now again with files with the source
encoding declarations specified on the second file, and can be used again
to make Python batch files on Windows.
* The tokenize module now ignore the source encoding declaration on the second
line if the first line contains anything except a comment.
* IDLE now ignores the source encoding declaration on the second line if the
first line contains anything except a comment.
* 2to3 and the findnocoding.py script now ignore the source encoding
declaration on the second line if the first line contains anything except
a comment.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/
| |
| | |
now detect Python source code encoding only in comment lines.
|
| |
| |
| |
| | |
now detect Python source code encoding only in comment lines.
|
|/ |
|
|\ |
|
| |
| |
| |
| | |
newline is found. Patch by Ned Batchelder.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
declaration.
|
| | |
|
| |
| |
| |
| | |
Patch by Serhiy Storchaka.
|
| |
| |
| |
| | |
tokenizer.detect_encoding() (when available).
|
|\ \
| |/ |
|
| |
| |
| |
| | |
if the first two lines have non-UTF-8 characters without an encoding declaration.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88498 | brett.cannon | 2011-02-21 19:25:12 -0800 (Mon, 21 Feb 2011) | 8 lines
Issue #11074: Make 'tokenize' so it can be reloaded.
The module stored away the 'open' object as found in the global namespace
(which fell through to the built-in namespace) since it defined its own 'open'.
Problem is that if you reloaded the module it then grabbed the 'open' defined
in the previous load, leading to code that infinite recursed. Switched to
simply call builtins.open directly.
........
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
at startup anymore.
Instead, the re module's standard caching does its work.
|
| | |
|
|/
|
|
|
|
|
|
| |
The module stored away the 'open' object as found in the global namespace
(which fell through to the built-in namespace) since it defined its own 'open'.
Problem is that if you reloaded the module it then grabbed the 'open' defined
in the previous load, leading to code that infinite recursed. Switched to
simply call builtins.open directly.
|