Make generator repr consistent with function and code object repr.
This commit is contained in:
parent
a8eaf8faf3
commit
5ffad6646e
|
@ -927,7 +927,7 @@ Test the __name__ attribute and the repr()
|
||||||
>>> g.__name__
|
>>> g.__name__
|
||||||
'f'
|
'f'
|
||||||
>>> repr(g) # doctest: +ELLIPSIS
|
>>> repr(g) # doctest: +ELLIPSIS
|
||||||
'<f generator object at ...>'
|
'<generator object f at ...>'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# conjoin is a simple backtracking generator, named in honor of Icon's
|
# 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
|
Verify that parenthesis are required when used as a keyword argument value
|
||||||
|
|
||||||
>>> dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS
|
>>> 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
|
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);
|
code_name = PyString_AsString(((PyCodeObject *)gen->gi_code)->co_name);
|
||||||
if (code_name == NULL)
|
if (code_name == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return PyString_FromFormat("<%.200s generator object at %p>",
|
return PyString_FromFormat("<generator object %.200s at %p>",
|
||||||
code_name, gen);
|
code_name, gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue