Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0683d68

Browse filesBrowse files
authored
[3.6] bpo-29571: Use correct locale encoding in test_re (#149) (#153)
``local.getlocale(locale.LC_CTYPE)`` and ``locale.getpreferredencoding(False)`` may give different answers in some cases (such as the ``en_IN`` locale). ``re.LOCALE`` uses the latter, so update the test case to match.
1 parent d372cda commit 0683d68
Copy full SHA for 0683d68

File tree

2 files changed

+6
-1
lines changed
Filter options

2 files changed

+6
-1
lines changed

‎Lib/test/test_re.py

Copy file name to clipboardExpand all lines: Lib/test/test_re.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ def test_ascii_and_unicode_flag(self):
14021402

14031403
def test_locale_flag(self):
14041404
import locale
1405-
_, enc = locale.getlocale(locale.LC_CTYPE)
1405+
enc = locale.getpreferredencoding(False)
14061406
# Search non-ASCII letter
14071407
for i in range(128, 256):
14081408
try:

‎Misc/NEWS

Copy file name to clipboardExpand all lines: Misc/NEWS
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ Documentation
202202
Tests
203203
-----
204204

205+
- Issue #29571: to match the behaviour of the ``re.LOCALE`` flag,
206+
test_re.test_locale_flag now uses ``locale.getpreferredencoding(False)`` to
207+
determine the candidate encoding for the test regex (allowing it to correctly
208+
skip the test when the default locale encoding is a multi-byte encoding)
209+
205210
- Issue #28950: Disallow -j0 to be combined with -T/-l in regrtest
206211
command line arguments.
207212

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.