Skip to content

Commit 783aff1

Browse files
committed
Wrap long lines
Also revert an useless change
1 parent c4bacc6 commit 783aff1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎Lib/test/test_codecs.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4097,12 +4097,15 @@ def check_encode_strings(self, errors):
40974097
with self.assertRaises(ValueError) as cm:
40984098
self.encode_locale(text)
40994099
errmsg = str(cm.exception)
4100-
self.assertRegex(errmsg, f"Py_EncodeLocale failed: error_pos={error_pos}")
4100+
regex = f"Py_EncodeLocale failed: error_pos={error_pos}"
4101+
self.assertRegex(errmsg, regex)
41014102

41024103
with self.assertRaises(RuntimeError) as cm:
41034104
self.encode_locale_ex(text, errors)
41044105
errmsg = str(cm.exception)
4105-
self.assertRegex(errmsg, f"encode error: pos={error_pos}, reason=encoding error")
4106+
regex = (f"encode error: pos={error_pos}, "
4107+
"reason=encoding error")
4108+
self.assertRegex(errmsg, regex)
41064109
else:
41074110
if errors in ("strict", "surrogateescape"):
41084111
encoded = self.encode_locale(text)

‎Objects/unicodeobject.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5700,7 +5700,7 @@ _Py_EncodeUTF8Ex(const wchar_t *text, char **str, size_t *output_length,
57005700
else if (Py_UNICODE_IS_SURROGATE(ch) && !surrogatepass) {
57015701
/* surrogateescape error handler */
57025702
if (!surrogateescape || !(0xDC80 <= ch && ch <= 0xDCFF)) {
5703-
if (error_pos) {
5703+
if (error_pos != NULL) {
57045704
*error_pos = (size_t)ch_pos;
57055705
}
57065706
if (raw_malloc) {

0 commit comments

Comments
 (0)