Commit a1cdfd9d authored by Guido van Rossum's avatar Guido van Rossum

Fix a subtle bug in PyString_Repr().

The smartquote code was deciding whether to use ' or "
by inspecting the *output* area...
parent c1f779cb
......@@ -854,8 +854,9 @@ PyString_Repr(PyObject *obj, int smartquotes)
/* figure out which quote to use; single is preferred */
quote = '\'';
if (smartquotes) {
Py_UNICODE *test;
for (test = p; test < p+length; ++test) {
char *test, *start;
start = PyString_AS_STRING(op);
for (test = start; test < start+length; ++test) {
if (*test == '"') {
quote = '\''; /* switch back to single quote */
goto decided;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment