-
Notifications
You must be signed in to change notification settings - Fork 186
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
support weak references to pyjlwrap types #158
Comments
amyascwk
added a commit
to amyascwk/PyCall.jl
that referenced
this issue
Oct 30, 2015
galenlynch
added a commit
to galenlynch/PyCall.jl
that referenced
this issue
Oct 30, 2018
I have added [weak reference support][1] for `pyjlwrap` types, following the documentation for Python 3+. Adding weak reference support for Python 2.x seems much the same as in 3.x, however 3.x does not use Py_TPFLAGS_HAVE_WEAKREFS, which also does not seem necessary for 2.x. Simple testing suggests that this is working as expected. Closes JuliaPy#21, JuliaPy#158 [1]: https://docs.python.org/3/extending/newtypes.html#weak-reference-support
stevengj
pushed a commit
that referenced
this issue
Nov 4, 2018
I have added [weak reference support][1] for `pyjlwrap` types, following the documentation for Python 3+. Adding weak reference support for Python 2.x seems much the same as in 3.x, however 3.x does not use Py_TPFLAGS_HAVE_WEAKREFS, which also does not seem necessary for 2.x. Simple testing suggests that this is working as expected. Closes #21, #158 [1]: https://docs.python.org/3/extending/newtypes.html#weak-reference-support
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Complicated Julia objects (like functions) are passed to Python by creating a new Python type that wraps around them and implements the appropriate interfaces (see pytype.jl). However, such wrapped objects currently don't support weak references in Python.
To support weak references, the PyTypeObject documentation indicates that we need to set the
Py_TPFLAGS_HAVE_WEAKREFS
bit and define thetp_weaklistoffset
andtp_weaklist
fields.Probably this is straightforward, but requires some careful digging through the documentation.
The text was updated successfully, but these errors were encountered: