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

support weak references to pyjlwrap types #158

Closed
stevengj opened this issue Jul 2, 2015 · 0 comments
Closed

support weak references to pyjlwrap types #158

stevengj opened this issue Jul 2, 2015 · 0 comments

Comments

@stevengj
Copy link
Member

stevengj commented Jul 2, 2015

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 the tp_weaklistoffset and tp_weaklist fields.

Probably this is straightforward, but requires some careful digging through the documentation.

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant