Commit 5ffad664 authored by Georg Brandl's avatar Georg Brandl

Make generator repr consistent with function and code object repr.

parent a8eaf8fa
......@@ -927,7 +927,7 @@ Test the __name__ attribute and the repr()
>>> 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
......
......@@ -92,7 +92,7 @@ Verify that parenthesis are required when used as a keyword argument value
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
......
......@@ -288,7 +288,7 @@ gen_repr(PyGenObject *gen)
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);
}
......
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