bpo-29869: Allow underscores in numeric literals in lib2to3.#752
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow these steps to rectify the issue:
Thanks again to your contribution and we look forward to looking at it! |
|
I have completed the above steps. |
|
Could you open an issue for this on bugs.python.org, @nevsan and mention it in the title? (see the contributing guidelines for info.) |
b8581cb to
7d516a6
Compare
|
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 I have a small set of test cases to examine correctness of these regular expressions: https://gist.github.com/nevsan/7fc78dc61d309842406d67d6839b9861 |
7d516a6 to
ed419cc
Compare
|
Updated regular expressions to avoid catastrophic backtracking. Gist updated with new test cases (still passes). |
|
@nevsan looks like Travis disagrees that the tests still pass 😉 |
f7f52ef to
1304141
Compare
1304141 to
2fd46cc
Compare
|
Took a few iterations, but I managed to fix up the regexes. I also added a test case to test numeric literals with underscores (and verified that it fails for the un-patched HEAD). |
|
LGTM |
|
@rhettinger would you mind officially registering your review approval? You can do that by going under "Files changed", clicking the green "Review changes", and then you can choose "Approve" and submit the review. Perk of this is your approval will show up under Reviewers so if another core dev has the time to merge and backport they know someone else already cleared the code. |
|
@nevsan Can you create the PR against the |
I found this while debugging google/yapf#370. The fix is quite simple and quick.