Skip to content

Commit 2b492b6

Browse files
committed
News about repr() and 8-bit characters, and setlocale() in the
readline module.
1 parent 628e3bf commit 2b492b6

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ Type/class unification and new-style classes
6666
Core and builtins
6767
-----------------
6868

69+
- The repr() function for 8-bit strings now preserves all characters
70+
that are considered printable in the current locale. (Previously,
71+
all bytes that are not printable ASCII would be encoded in hex.)
72+
This requires the user to set the current locale; in the initial "C"
73+
locale the old behavior is maintained. [SF patch 479898]
74+
6975
- Unicode file name processing for Windows (PEP 277) is implemented.
7076
All platforms now have an os.path.supports_unicode_filenames attribute,
7177
which is set to True on Windows NT/2000/XP, and False elsewhere.
@@ -348,6 +354,17 @@ Extension modules
348354
Library
349355
-------
350356

357+
- Importing the readline module now no longer has the side effect of
358+
calling setlocale(LC_CTYPE, ""). The initial "C" locale, or
359+
whatever locale is explicitly set by the user, is preserved. If you
360+
want repr() of 8-bit strings in your preferred encoding to preserve
361+
all printable characters of that encoding, you have to add the
362+
following code to your $PYTHONSTARTUP file or to your application's
363+
main():
364+
365+
import locale
366+
locale.setlocale(locale.LC_CTYPE, "")
367+
351368
- shutil.move was added. shutil.copytree now reports errors as an
352369
exception at the end, instead of printing error messages.
353370

0 commit comments

Comments
 (0)