GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-37367: octal escapes applied inconsistently throughout the interpreter and lib by websurfer5 · Pull Request #14654 · python/cpython Conversation
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @@ -0,0 +1,2 @@ | |||
| Byte strings containing octal escape sequences with values greater than 255 | |||
| will now raise ValueError. Patch by Jeffrey Kintscher. | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to mention the previous behavior here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| import tempfile | ||
| import textwrap | ||
| import unittest | ||
| import ast |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please keep the imports sorted alphabetically.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@websurfer5, could you merge the master branch into this PR's branch, resolving the merge conflicts? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please add also a not in the What's New document. Since it is a breaking change it should be in section "Porting to Python 3.11".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| c = b.translate(None, delete=b'e') | ||
| self.assertEqual(c, b'hllo') | ||
|
|
||
| def test_octal_values(self): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It is not correct place for such test. This file is for tests of bytes and bytearray methods, not parsing Python code.
test_string_literals is for parsing string and bytes literals. Add some tests there.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| check(br"[\101]", b"[A]") | ||
| check(br"[\1010]", b"[A0]") | ||
| check(br"[\501]", b"[A]") | ||
| self.assertRaises(ValueError, decode, br"[\501]") |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Move it to test_errors below.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| if (c > 255) { | ||
| PyErr_Format(PyExc_ValueError, | ||
| "octal value must be in range(0, 256)"); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The error message should contain the position of the invalid octal escape sequence. It would be nice if look similar to error message for invalid hexadecimal escape sequence. For example:
"invalid octal escape sequence at position %zd"
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
#91668 was merged instead. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.