Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 42143:0dc62647aff0
Fix a subtle bug in PyString_Repr().
The smartquote code was deciding whether to use ' or "
by inspecting the *output* area...
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 03 Jul 2007 14:52:23 +0000 |
| parents | f65672b8e7d1 |
| children | bd6acfdb47d2 |
line wrap: on
line diff
--- a/Objects/stringobject.c Tue Jul 03 08:25:58 2007 +0000 +++ b/Objects/stringobject.c Tue Jul 03 14:52:23 2007 +0000 @@ -854,8 +854,9 @@ /* 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;
