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

Add weakref support for pyjlwrap types #606

Merged
merged 1 commit into from
Nov 4, 2018

Conversation

galenlynch
Copy link
Contributor

@galenlynch galenlynch commented Oct 30, 2018

I have added weak reference support 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/PyPlot.jl#21
Closes #158

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
Copy link
Member

stevengj commented Nov 4, 2018

The HAVE_WEAKREFS flag is not needed since it is part of Py_TPFLAGS_DEFAULT. Apparently this flag became obsolete in Python 2.1 when types became responsible for initializing the weakref field to NULL themselves.

@stevengj stevengj merged commit 31296cd into JuliaPy:master Nov 4, 2018
@galenlynch galenlynch deleted the weak_refs branch November 5, 2018 13:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants