diff --git a/src/gevent/_gevent_cgreenlet.pxd b/src/gevent/_gevent_cgreenlet.pxd index 246773e..fbc6107 100644 --- a/src/gevent/_gevent_cgreenlet.pxd +++ b/src/gevent/_gevent_cgreenlet.pxd @@ -16,12 +16,14 @@ cdef InvalidSwitchError cdef extern from "greenlet/greenlet.h": ctypedef class greenlet.greenlet [object PyGreenlet]: - # Defining this as a void* means we can't access it as a python attribute - # in the Python code; but we can't define it as a greenlet because that doesn't - # properly handle the case that it can be NULL. So instead we inline a getparent - # function that does the same thing as the green_getparent accessor but without - # going through the overhead of generic attribute lookup. - cdef void* parent + pass + + # Defining this as a void* means we can't access it as a python attribute + # in the Python code; but we can't define it as a greenlet because that doesn't + # properly handle the case that it can be NULL. So instead we inline a getparent + # function that does the same thing as the green_getparent accessor but without + # going through the overhead of generic attribute lookup. + cdef void* PyGreenlet_GET_PARENT(greenlet s) # These are actually macros and so must be included # (defined) in each .pxd, as are the two functions @@ -36,13 +38,13 @@ cdef inline greenlet getcurrent(): cdef inline object get_generic_parent(greenlet s): # We don't use any typed functions on the return of this, # so save the type check by making it just an object. - if s.parent != NULL: - return s.parent + if PyGreenlet_GET_PARENT(s) != NULL: + return PyGreenlet_GET_PARENT(s) cdef inline SwitchOutGreenletWithLoop get_my_hub(greenlet s): # Must not be called with s = None - if s.parent != NULL: - return s.parent + if PyGreenlet_GET_PARENT(s) != NULL: + return PyGreenlet_GET_PARENT(s) cdef bint _greenlet_imported