mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
#2630: Implement PEP 3138.
The repr() of a string now contains printable Unicode characters unescaped. The new ascii() builtin can be used to get a repr() with only ASCII characters in it. PEP and patch were written by Atsuo Ishimoto.
This commit is contained in:
parent
ea6d58d9d3
commit
559e5d7f4d
25 changed files with 1271 additions and 974 deletions
|
@ -220,6 +220,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
|||
# define _PyUnicode_IsLinebreak _PyUnicodeUCS2_IsLinebreak
|
||||
# define _PyUnicode_IsLowercase _PyUnicodeUCS2_IsLowercase
|
||||
# define _PyUnicode_IsNumeric _PyUnicodeUCS2_IsNumeric
|
||||
# define _PyUnicode_IsPrintable _PyUnicodeUCS2_IsPrintable
|
||||
# define _PyUnicode_IsTitlecase _PyUnicodeUCS2_IsTitlecase
|
||||
# define _PyUnicode_IsXidStart _PyUnicodeUCS2_IsXidStart
|
||||
# define _PyUnicode_IsXidContinue _PyUnicodeUCS2_IsXidContinue
|
||||
|
@ -317,6 +318,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
|||
# define _PyUnicode_IsLinebreak _PyUnicodeUCS4_IsLinebreak
|
||||
# define _PyUnicode_IsLowercase _PyUnicodeUCS4_IsLowercase
|
||||
# define _PyUnicode_IsNumeric _PyUnicodeUCS4_IsNumeric
|
||||
# define _PyUnicode_IsPrintable _PyUnicodeUCS4_IsPrintable
|
||||
# define _PyUnicode_IsTitlecase _PyUnicodeUCS4_IsTitlecase
|
||||
# define _PyUnicode_IsXidStart _PyUnicodeUCS4_IsXidStart
|
||||
# define _PyUnicode_IsXidContinue _PyUnicodeUCS4_IsXidContinue
|
||||
|
@ -357,6 +359,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
|||
#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
|
||||
#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
|
||||
#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
|
||||
#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
|
||||
|
||||
#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
|
||||
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
|
||||
|
@ -387,6 +390,7 @@ extern const unsigned char _Py_ascii_whitespace[];
|
|||
#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch)
|
||||
#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch)
|
||||
#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch)
|
||||
#define Py_UNICODE_ISPRINTABLE(ch) _PyUnicode_IsPrintable(ch)
|
||||
|
||||
#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch)
|
||||
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
|
||||
|
@ -1533,6 +1537,10 @@ PyAPI_FUNC(int) _PyUnicode_IsNumeric(
|
|||
Py_UNICODE ch /* Unicode character */
|
||||
);
|
||||
|
||||
PyAPI_FUNC(int) _PyUnicode_IsPrintable(
|
||||
Py_UNICODE ch /* Unicode character */
|
||||
);
|
||||
|
||||
PyAPI_FUNC(int) _PyUnicode_IsAlpha(
|
||||
Py_UNICODE ch /* Unicode character */
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue