Commit Graph

183 Commits

Author SHA1 Message Date
Yury Selivanov 96ec934e75 Issue #24619: Simplify async/await tokenization.
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.
2015-07-23 15:01:58 +03:00
Yury Selivanov 8fb307cd65 Issue #24619: New approach for tokenizing async/await.
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()
2015-07-22 13:33:45 +03:00
Berker Peksag 50c72d2778 Issue #22064: Improve the misleading message from 2to3 when skipping optional fixers.
Patch by Vinod Kurup.
2015-05-13 13:40:12 +03:00
Berker Peksag 3a81f9ba46 Issue #22064: Improve the misleading message from 2to3 when skipping optional fixers.
Patch by Vinod Kurup.
2015-05-13 13:39:51 +03:00
Yury Selivanov 7544508f02 PEP 0492 -- Coroutines with async and await syntax. Issue #24017. 2015-05-11 22:57:16 -04:00
Serhiy Storchaka bfbfc8deb2 Removed unintentional trailing spaces in text files. 2015-03-29 19:12:58 +03:00
Serhiy Storchaka f4b7a02e93 Issue #21408: The default __ne__() now returns NotImplemented if __eq__()
returned NotImplemented.  Removed incorrect implementations of __ne__().
2015-01-26 09:57:07 +02:00
Benjamin Peterson 82f34ada45 fix instances of consecutive articles (closes #23221)
Patch by Karan Goel.
2015-01-13 09:17:24 -05:00
Serhiy Storchaka db9b65d9e5 Issue #22823: Use set literals in lib2to3. 2014-12-13 21:50:49 +02:00
Zachary Ware 2acbae8016 Issue #22173: Update lib2to3 tests to use unittest test discovery. 2014-10-29 12:24:59 -05:00
Berker Peksag f23530f569 Issue #22186: Fix typos in Lib/.
Patch by Févry Thibault.
2014-10-19 18:04:38 +03:00
Benjamin Peterson 0654be18b3 teach 2to3 about 'yield from' 2014-04-10 00:23:18 -04:00
Benjamin Peterson 4ab92c800a add matrix multiplication operator support to 2to3 2014-04-10 00:12:47 -04:00
Serhiy Storchaka 8f8ec92de8 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang lines in the unittestgui and checkpip scripts.
2014-01-16 17:33:23 +02:00
Serhiy Storchaka b992a0e102 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang line to use python3 executable in the unittestgui script.
2014-01-16 17:15:49 +02:00
Serhiy Storchaka 7282ff6d5b Issue #18960: Fix bugs with Python source code encoding in the second line.
* 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.
2014-01-09 18:41:59 +02:00
Serhiy Storchaka 768c16ce02 Issue #18960: Fix bugs with Python source code encoding in the second line.
* 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.
2014-01-09 18:36:09 +02:00
Ezio Melotti 20719ace97 #19943: merge with 3.3. 2013-12-10 14:06:18 +02:00
Ezio Melotti d082b68786 #19943: fix typo noticed by Jakub Wilk. 2013-12-10 14:05:46 +02:00
Ezio Melotti 5833c00427 #19620: merge with 3.3. 2013-11-25 05:16:09 +02:00
Ezio Melotti 4bcc796acc #19620: Fix typo in docstring (noticed by Christopher Welborn). 2013-11-25 05:14:51 +02:00
Ezio Melotti 6bdd98622e #10712: 2to3 has a new "asserts" fixer that replaces deprecated names of unittest methods. 2013-11-23 21:14:42 +02:00
Serhiy Storchaka 8bdc130121 Issue #19592: Use specific asserts in lib2to3 tests. 2013-11-14 23:49:58 +02:00
Serhiy Storchaka 1eadd6a120 Issue #19592: Use specific asserts in lib2to3 tests. 2013-11-14 23:50:51 +02:00
Serhiy Storchaka 1322f9e2d1 Issue #18037: Do not escape '\u' and '\U' in raw strings. 2013-10-08 21:08:48 +03:00
Serhiy Storchaka 5e596769b0 Issue #18037: Do not escape '\u' and '\U' in raw strings. 2013-10-08 21:07:46 +03:00
Serhiy Storchaka 026af2a597 Issue #18037: 2to3 now escapes '\u' and '\U' in native strings. 2013-10-03 12:10:49 +03:00
Serhiy Storchaka def0a4c298 Issue #18037: 2to3 now escapes '\u' and '\U' in native strings. 2013-10-03 12:08:38 +03:00
Benjamin Peterson b3b0720597 merge 3.3 (#19115) 2013-09-28 15:13:10 -04:00
Benjamin Peterson 3103631f66 fix duplicate test names (closes #19115)
Patch by Xavier de Gaye.
2013-09-28 15:12:37 -04:00
Serhiy Storchaka 935349406a Issue #18873: The tokenize module, IDLE, 2to3, and the findnocoding.py script
now detect Python source code encoding only in comment lines.
2013-09-16 23:57:00 +03:00
Serhiy Storchaka dafea85190 Issue #18873: The tokenize module, IDLE, 2to3, and the findnocoding.py script
now detect Python source code encoding only in comment lines.
2013-09-16 23:51:56 +03:00
Ezio Melotti e0c69161bc #18741: merge with 3.3. 2013-08-17 16:13:22 +03:00
Ezio Melotti b5bc353b88 #18741: fix more typos. Patch by Févry Thibault. 2013-08-17 16:11:40 +03:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Terry Jan Reedy 16b5c13668 Merge 3.3, issue #17047: remove doubled words found in 2.7 to
3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:59:07 -04:00
Terry Jan Reedy 98472b8396 Merge 3.2, issue #17047: remove doubled words found in 2.7 to
3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:58:27 -04:00
Terry Jan Reedy c30b7b16ea Issue #17047: remove doubled words found in 2.7 to 3.4 Lib/*,
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:57:08 -04:00
Giampaolo Rodola' 2f50aaf2ff modernize some modules' code by using with statement around open() 2013-02-12 02:04:27 +01:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov ad28c7f9da Issue #16706: get rid of os.error 2012-12-18 22:02:39 +02:00
Benjamin Peterson 448e81b2da add fixer for reload() -> imp.reload() (closes #11797)\n\nPatch by Laurie Clark-Michalek and Berker Peksag 2012-12-07 22:44:10 -05:00
Benjamin Peterson 4089eec098 merge 3.3 (#16573) 2012-11-29 10:58:43 -05:00
Benjamin Peterson 139891ba82 merge 3.2 (#16573) 2012-11-29 10:56:11 -05:00
Benjamin Peterson 57af38700a enumerate only requires an iterable (closes #16573)
Patch by Jonathan Kotta.
2012-11-29 10:55:22 -05:00
Andrew Svetlov 7d14015e62 Issue #16120: Use |yield from| in stdlib.
Patch by Berker Peksag.
2012-10-06 17:11:45 +03:00
Benjamin Peterson 3331a20464 merge 3.2 2012-09-25 11:53:30 -04:00
Benjamin Peterson 1654d74e9a switch assertion to an explicit ValueError 2012-09-25 11:48:50 -04:00
Ned Deily 4725b13ab3 Issue #15822: Fix installation of lib2to3 grammar pickles to ensure
they are created in the install locations and with the proper timestamp.
(Solution suggested by MvL)
2012-09-08 19:04:47 -07:00