Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Py_RETURN_(TRUE|FALSE) macros instead of manual reference counting #42

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions greenlet.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ The running greenlet's stack_start is undefined but not NULL.
} while (0)
#endif /* !Py_CLEAR */

/* Python < 2.4 support */
#if PY_VERSION_HEX < 0x02040000
#ifndef Py_RETURN_TRUE
# define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
#endif
#ifndef Py_RETURN_FALSE
# define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
#endif
#endif

/* Python <= 2.5 support */
#if PY_MAJOR_VERSION < 3
#ifndef Py_REFCNT
Expand Down Expand Up @@ -1229,13 +1239,10 @@ static int green_setdict(PyGreenlet* self, PyObject* val, void* c)

static PyObject* green_getdead(PyGreenlet* self, void* c)
{
PyObject* res;
if (PyGreenlet_ACTIVE(self) || !PyGreenlet_STARTED(self))
res = Py_False;
Py_RETURN_FALSE;
else
res = Py_True;
Py_INCREF(res);
return res;
Py_RETURN_TRUE;
}

static PyObject* green_getrun(PyGreenlet* self, void* c)
Expand Down