summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-06-15 00:00:12 (GMT)
committerGuido van Rossum <guido@python.org>2007-06-15 00:00:12 (GMT)
commit7611d1d35e5006380c41e060d1ec2723a8465b14 (patch)
treec5aa98fd1b769e7a389c4be763a072fbde03a659 /Objects
parentbb5f590323f49c57c5374f2ba7683832e6f1b4ef (diff)
downloadcpython-7611d1d35e5006380c41e060d1ec2723a8465b14.zip
cpython-7611d1d35e5006380c41e060d1ec2723a8465b14.tar.gz
cpython-7611d1d35e5006380c41e060d1ec2723a8465b14.tar.bz2
Patch by Ron Adam to make repr(str8(...)) return something looking like
s'...' instead of '...', allowing it to be distinguished from unicode strings. This doesn't roundtrip -- for now, that's intentional, as the goal is to rip these out rather than to make it a feature, and making them stand out (breaking 8 more tests) helps us track them down so we can rip them out.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 62955b9..dcecd6f 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -835,7 +835,7 @@ PyString_Repr(PyObject *obj, int smartquotes)
static const char *hexdigits = "0123456789abcdef";
register PyStringObject* op = (PyStringObject*) obj;
Py_ssize_t length = PyString_GET_SIZE(op);
- size_t newsize = 2 + 4 * op->ob_size;
+ size_t newsize = 3 + 4 * op->ob_size;
PyObject *v;
if (newsize > PY_SSIZE_T_MAX || newsize / 4 != op->ob_size) {
PyErr_SetString(PyExc_OverflowError,
@@ -867,7 +867,7 @@ PyString_Repr(PyObject *obj, int smartquotes)
;
}
- *p++ = quote;
+ *p++ = 's', *p++ = quote;
for (i = 0; i < op->ob_size; i++) {
/* There's at least enough room for a hex escape
and a closing quote. */