Fix a subtle bug in PyString_Repr().

The smartquote code was deciding whether to use ' or "
by inspecting the *output* area...
This commit is contained in:
Guido van Rossum 2007-07-03 14:52:23 +00:00
parent c1f779cb01
commit a1cdfd9dc2
1 changed files with 3 additions and 2 deletions

View File

@ -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;