[Python-checkins] r63364 - in python/trunk: Lib/test/test_generators.py Lib/test/test_genexps.py Objects/genobject.c

georg.brandl python-checkins at python.org
Fri May 16 11:34:48 CEST 2008


Author: georg.brandl
Date: Fri May 16 11:34:48 2008
New Revision: 63364

Log:
Make generator repr consistent with function and code object repr.


Modified:
   python/trunk/Lib/test/test_generators.py
   python/trunk/Lib/test/test_genexps.py
   python/trunk/Objects/genobject.c

Modified: python/trunk/Lib/test/test_generators.py
==============================================================================
--- python/trunk/Lib/test/test_generators.py	(original)
+++ python/trunk/Lib/test/test_generators.py	Fri May 16 11:34:48 2008
@@ -927,7 +927,7 @@
 >>> g.__name__
 'f'
 >>> repr(g)  # doctest: +ELLIPSIS
-'<f generator object at ...>'
+'<generator object f at ...>'
 """
 
 # conjoin is a simple backtracking generator, named in honor of Icon's

Modified: python/trunk/Lib/test/test_genexps.py
==============================================================================
--- python/trunk/Lib/test/test_genexps.py	(original)
+++ python/trunk/Lib/test/test_genexps.py	Fri May 16 11:34:48 2008
@@ -92,7 +92,7 @@
 Verify that parenthesis are required when used as a keyword argument value
 
     >>> dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS
-    {'a': <<genexpr> generator object at ...>}
+    {'a': <generator object <genexpr> at ...>}
 
 Verify early binding for the outermost for-expression
 

Modified: python/trunk/Objects/genobject.c
==============================================================================
--- python/trunk/Objects/genobject.c	(original)
+++ python/trunk/Objects/genobject.c	Fri May 16 11:34:48 2008
@@ -288,7 +288,7 @@
 	code_name = PyString_AsString(((PyCodeObject *)gen->gi_code)->co_name);
 	if (code_name == NULL)
 		return NULL;
-	return PyString_FromFormat("<%.200s generator object at %p>",
+	return PyString_FromFormat("<generator object %.200s at %p>",
 				   code_name, gen);
 }
 


More information about the Python-checkins mailing list