aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-16 15:59:28 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-06-16 15:59:28 +0200
commit40ee30181f7f7c71d6b49ceef35b5d3d20b88a6d (patch)
tree4f6813c9aff51c1f467504698456c7c4a1c33244 /Include/genobject.h
parentMerge issue #21669 from 3.4 (diff)
downloadcpython-40ee30181f7f7c71d6b49ceef35b5d3d20b88a6d.tar.gz
cpython-40ee30181f7f7c71d6b49ceef35b5d3d20b88a6d.tar.bz2
cpython-40ee30181f7f7c71d6b49ceef35b5d3d20b88a6d.zip
Issue #21205: Add a new ``__qualname__`` attribute to generator, the qualified
name, and use it in the representation of a generator (``repr(gen)``). The default name of the generator (``__name__`` attribute) is now get from the function instead of the code. Use ``gen.gi_code.co_name`` to get the name of the code.
Diffstat (limited to 'Include/genobject.h')
-rw-r--r--Include/genobject.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Include/genobject.h b/Include/genobject.h
index 65f1ecfd549..23571e663bc 100644
--- a/Include/genobject.h
+++ b/Include/genobject.h
@@ -25,6 +25,12 @@ typedef struct {
/* List of weak reference. */
PyObject *gi_weakreflist;
+
+ /* Name of the generator. */
+ PyObject *gi_name;
+
+ /* Qualified name of the generator. */
+ PyObject *gi_qualname;
} PyGenObject;
PyAPI_DATA(PyTypeObject) PyGen_Type;
@@ -33,6 +39,8 @@ PyAPI_DATA(PyTypeObject) PyGen_Type;
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
+PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *,
+ PyObject *name, PyObject *qualname);
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
PyObject *_PyGen_Send(PyGenObject *, PyObject *);