ext: Use different names for each gen_next method

This commit is contained in:
darktohka 2024-02-10 23:59:26 +02:00 committed by rdb
parent d8775fa01e
commit b049c891d1
3 changed files with 6 additions and 6 deletions

View File

@ -24,7 +24,7 @@ extern struct Dtool_PyTypedObject Dtool_CInterval;
/** /**
* Yields continuously until the interval is done. * Yields continuously until the interval is done.
*/ */
static PyObject *gen_next(PyObject *self) { static PyObject *gen_next_c_interval(PyObject *self) {
const CInterval *ival; const CInterval *ival;
if (!Dtool_Call_ExtractThisPointer(self, Dtool_CInterval, (void **)&ival)) { if (!Dtool_Call_ExtractThisPointer(self, Dtool_CInterval, (void **)&ival)) {
return nullptr; return nullptr;
@ -54,7 +54,7 @@ __await__(PyObject *self) {
// we call this via Python. // we call this via Python.
PyObject *result = PyObject_CallMethod(self, "start", nullptr); PyObject *result = PyObject_CallMethod(self, "start", nullptr);
Py_XDECREF(result); Py_XDECREF(result);
return Dtool_NewGenerator(self, &gen_next); return Dtool_NewGenerator(self, &gen_next_c_interval);
} }
#endif // HAVE_PYTHON #endif // HAVE_PYTHON

View File

@ -227,7 +227,7 @@ readlines(Py_ssize_t hint) {
/** /**
* Yields continuously to read all the lines from the istream. * Yields continuously to read all the lines from the istream.
*/ */
static PyObject *gen_next(PyObject *self) { static PyObject *gen_next_istream(PyObject *self) {
istream *stream = nullptr; istream *stream = nullptr;
if (!Dtool_Call_ExtractThisPointer(self, Dtool_std_istream, (void **)&stream)) { if (!Dtool_Call_ExtractThisPointer(self, Dtool_std_istream, (void **)&stream)) {
return nullptr; return nullptr;
@ -247,7 +247,7 @@ static PyObject *gen_next(PyObject *self) {
*/ */
PyObject *Extension<istream>:: PyObject *Extension<istream>::
__iter__(PyObject *self) { __iter__(PyObject *self) {
return Dtool_NewGenerator(self, &gen_next); return Dtool_NewGenerator(self, &gen_next_istream);
} }
/** /**

View File

@ -132,7 +132,7 @@ static PyObject *get_done_result(const AsyncFuture *future) {
/** /**
* Yields continuously until the task has finished. * Yields continuously until the task has finished.
*/ */
static PyObject *gen_next(PyObject *self) { static PyObject *gen_next_asyncfuture(PyObject *self) {
const AsyncFuture *future = nullptr; const AsyncFuture *future = nullptr;
if (!Dtool_Call_ExtractThisPointer(self, Dtool_AsyncFuture, (void **)&future)) { if (!Dtool_Call_ExtractThisPointer(self, Dtool_AsyncFuture, (void **)&future)) {
return nullptr; return nullptr;
@ -158,7 +158,7 @@ static PyObject *gen_next(PyObject *self) {
*/ */
PyObject *Extension<AsyncFuture>:: PyObject *Extension<AsyncFuture>::
__await__(PyObject *self) { __await__(PyObject *self) {
return Dtool_NewGenerator(self, &gen_next); return Dtool_NewGenerator(self, &gen_next_asyncfuture);
} }
/** /**