#18121: Patch Cython with PyTypeObject members
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.6
Component: packages: | Resolution:
standard | Merged in:
Keywords: sd66 | Reviewers:
Authors: Jeroen Demeyer | Work issues:
Report Upstream: Fixed upstream, | Commit:
but not in a stable release. | 77e38d28e608521c7a79decf16bfb3f09b089737
Branch: | Stopgaps:
u/jdemeyer/patch_cython_with_pytypeobject_members|
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:27 vdelecroix]:
> `PyWeakref_GetObject` is defined in ` cpython.weakref` as
> {{{
> PyObject* PyWeakref_GetObject(object ref)
> # Return the referenced object from a weak reference, ref. If the
> # referent is no longer live, returns None.
> }}}
Yes, and that is the same signature as with which it is defined in
`coerce_dict.pyx`. Apparently we're only referencing things we're holding
reference. Its return type is also correctly typed, since it returns a
*borrowed* reference, so the normal use of storing the returned value into
an `<object>` leads exactly to the INCREF required to ensure the object
doesn't get deallocated.
I am pretty sure that if this is now available in cpython.weakref, we can
cimport it from there rather than explicitly "cdef extern" it from
"Python.h". Of course, there will be absolutely no difference to the
eventual code generated either.
--
Ticket URL: <http://trac.sagemath.org/ticket/18121#comment:28>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.