[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 947629916a5ecb1f6f6792e9b9234e084c5bf274 by Mariatta in branch 
'master':
bpo-29869: Add Nevada Sanchez to Misc/ACKS (GH-1125)
https://github.com/python/cpython/commit/947629916a5ecb1f6f6792e9b9234e084c5bf274


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

PR has been merged and backported to 3.6.
I also added Nevada Sanchez to Misc/ACKS.
Thanks all :)

--
resolution:  -> fixed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1260

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 2cdf087d1fd48f7d0f95b5a0b31b9a624fa84751 by Mariatta in branch 
'3.6':
[3.6] bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-1119) 
(GH-1122)
https://github.com/python/cpython/commit/2cdf087d1fd48f7d0f95b5a0b31b9a624fa84751


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1259

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset a6e395dffadf8c5124903c01ad69fefa36b1a935 by Mariatta (Nevada 
Sanchez) in branch 'master':
bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-1119)
https://github.com/python/cpython/commit/a6e395dffadf8c5124903c01ad69fefa36b1a935


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Nevada Sanchez

Changes by Nevada Sanchez :


--
pull_requests: +1257

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Nevada Sanchez, please create your PR against the master branch.
Once that is merged, we will backport it to the 3.6 branch.

Thanks :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 84c2d75489a84174d8993aea292828662e35a50f by Mariatta in branch 
'3.6':
Revert "bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-752)" 
(GH-1109)
https://github.com/python/cpython/commit/84c2d75489a84174d8993aea292828662e35a50f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1250

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-04-13 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:


New changeset 97a40b7a5b2979fb17e1751c139fd4ba1ebd5276 by Mariatta (Nevada 
Sanchez) in branch '3.6':
bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-752)
https://github.com/python/cpython/commit/97a40b7a5b2979fb17e1751c139fd4ba1ebd5276


--
nosy: +Mariatta

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Nevada Sanchez

Nevada Sanchez added the comment:

Good point. Updated.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suggest to use my regular expression for haxadedecimals. Your regular 
expression starves from catastrophic backtracking. Compare two examples:

re.match(r'0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?'+r'\b', '0x'+'0'*100+'z')
re.match(r'0[xX](?:_?[\da-fA-F]+)+[lL]?'+r'\b', '0x'+'0'*100+'z')

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Nevada Sanchez

Nevada Sanchez added the comment:

Thanks, it seems I misspoke. Glad I tested it!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Georg Brandl

Georg Brandl added the comment:

> In particular, we must have at least one digit following `0[xXbBoO]` and must 
> be before any underscores.

This is not true (but your test file does the right thing).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Nevada Sanchez

Nevada Sanchez added the comment:

The existing regular expressions weren't actually strict enough as is, so I 
made them even more correct. In particular, we must have at least one digit 
following `0[xXbBoO]` and must be before any underscores.

I have a small set of test cases to examine correctness of these regular 
expressions: https://gist.github.com/nevsan/7fc78dc61d309842406d67d6839b9861

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Python uses more strong rules for underscores in numerical literals. 
Underscores are acceptable between digits and between the base prefix and 
digit. For example the regular expression for hexadecimals is 
r'0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?'.

Underscores also are acceptable in the exponent of float literals:

Exponent = r'[eE][-+]?\d+(?:_\d+)*'

--
nosy: +georg.brandl, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-21 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-21 Thread Nevada Sanchez

Changes by Nevada Sanchez :


--
pull_requests: +668

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-21 Thread Nevada Sanchez

New submission from Nevada Sanchez:

The following should work in Python 3.6

```
from lib2to3.pgen2 import driver
from lib2to3 import pytree
from lib2to3 import pygram

_GRAMMAR_FOR_PY3 = pygram.python_grammar_no_print_statement.copy()
parser_driver = driver.Driver(_GRAMMAR_FOR_PY3, convert=pytree.convert)
tree = parser_driver.parse_string('100_1\n', debug=False)
```

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 289951
nosy: nevsan
priority: normal
severity: normal
status: open
title: Underscores in numeric literals not supported in lib2to3.
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com