Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(63)

Unified Diff: Objects/unicodectype.c

Issue 767: [issue2630] repr() should not escape non-ASCII characters (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/branches/py3k/
Patch Set: Created 3 months, 3 weeks ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side by-side-diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld r292