[Python-3000-checkins] r56158 - python/branches/py3k-struni/Objects/stringobject.c

guido.van.rossum python-3000-checkins at python.org
Tue Jul 3 16:52:24 CEST 2007


Author: guido.van.rossum
Date: Tue Jul  3 16:52:23 2007
New Revision: 56158

Modified:
   python/branches/py3k-struni/Objects/stringobject.c
Log:
Fix a subtle bug in PyString_Repr().
The smartquote code was deciding whether to use ' or "
by inspecting the *output* area...


Modified: python/branches/py3k-struni/Objects/stringobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/stringobject.c	(original)
+++ python/branches/py3k-struni/Objects/stringobject.c	Tue Jul  3 16:52:23 2007
@@ -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;


More information about the Python-3000-checkins mailing list