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

Added weak references support to jlwrap types (for #21 and #158) #207

Closed
wants to merge 1 commit into from

Conversation

amyascwk
Copy link

I've managed to get weak references to work (#158), and have mainly tested it directly with the python weakref module and on julia functions:

using PyCall
@pyimport weakref

po = PyObject(x -> x + 1)  #create jl_FunctionType
r = weakref.ref(po)
r()                        #returns (anonymous function)

po = 1                     #remove reference to the PyObject
gc()                       #run gc
r()                        #returns nothing

I've also tested it on connecting julia functions to matplotlib's figure events:

import PyPlot.plt

plt[:plot]()
fig = plt[:gcf]()
onpress(mev) = println("($(mev[:xdata]),$(mev[:ydata]))")
cid = fig[:canvas][:mpl_connect]("button_press_event", onpress)

Left clicking within the axes outputs pairs of data coordinates at the location of the click.

@amyascwk
Copy link
Author

amyascwk commented Nov 7, 2015

There appears to be an occasional segfault when using matplotlib's event connection to julia functions, especially when redrawing. Will try to identify the problem.

@ronisbr
Copy link

ronisbr commented Jan 22, 2016

hi @amyascwk!
Do you have any news about weak references support?

@goretkin
Copy link
Contributor

I second the request for any news, @amyascwk. Thanks

@amyascwk amyascwk closed this Mar 7, 2017
@amyascwk
Copy link
Author

amyascwk commented Mar 7, 2017

I'm sorry, I'm afraid that I'm unable to keep up with the development of Julia and PyCall at the moment. I will still keep the patched code (which worked partially for Julia 0.2) available, in case anyone wishes to continue working on it before I get the chance to revisit this again.

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

3 participants