diff options
author | Georg Brandl <georg@python.org> | 2008-06-11 18:37:52 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-06-11 18:37:52 (GMT) |
commit | 559e5d7f4d1155e95fb6f925c927a263f9196935 (patch) | |
tree | 4688423e81e9ffed7a5b2c87c50b55419e8e885a /Include | |
parent | ea6d58d9d3033436b52e84960b9571525a4f5412 (diff) | |
download | cpython-559e5d7f4d1155e95fb6f925c927a263f9196935.zip cpython-559e5d7f4d1155e95fb6f925c927a263f9196935.tar.gz cpython-559e5d7f4d1155e95fb6f925c927a263f9196935.tar.bz2 |
#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.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/object.h | 1 | ||||
-rw-r--r-- | Include/unicodeobject.h | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h index 92388cf..2a7075f 100644 --- a/Include/object.h +++ b/Include/object.h @@ -425,6 +425,7 @@ PyAPI_FUNC(void) _Py_BreakPoint(void); PyAPI_FUNC(void) _PyObject_Dump(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); +PyAPI_FUNC(PyObject *) PyObject_ASCII(PyObject *); PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 7af2eba..63c5d76 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -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 */ ); |