| Index: Objects/unicodectype.c |
| =================================================================== |
| --- Objects/unicodectype.c (revision 62744) |
| +++ Objects/unicodectype.c (working copy) |
| @@ -21,6 +21,7 @@ |
| #define UPPER_MASK 0x80 |
| #define XID_START_MASK 0x100 |
| #define XID_CONTINUE_MASK 0x200 |
| +#define HEX_ESCAPE_MASK 0x400 |
| typedef struct { |
| const Py_UNICODE upper; |
| @@ -675,6 +676,17 @@ |
| return _PyUnicode_ToNumeric(ch) != -1.0; |
| } |
| +/* Returns 1 for Unicode characters to be hex-escaped when repr()ed, |
| + 0 otherwise. */ |
| + |
| +int _PyUnicode_IsHexEscaped(Py_UNICODE ch) |
| +{ |
| + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); |
| + |
| + return (ctype->flags & HEX_ESCAPE_MASK) != 0; |
| +} |
| + |
| + |
| #ifndef WANT_WCTYPE_FUNCTIONS |
| /* Returns 1 for Unicode characters having the bidirectional type |