-
Notifications
You must be signed in to change notification settings - Fork 189
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
RFC: Use invokelatest in jl_Function_call #416
Conversation
So @vtjnash should correct me here, but I think this is the wrong place to do it. Instead, pyjulia should update the worldcounter in the ptls whenever it has imported some code. I'm just not sure if there's currently a C Api for that. |
src/callback.jl
Outdated
@@ -8,7 +8,7 @@ | |||
################################################################ | |||
|
|||
# Define a Python method/function object from f(PyPtr,PyPtr)::PyPtr. | |||
# Requires f to be a top-level function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
On the other hand, I also don't really see a downside to doing this here. |
src/callback.jl
Outdated
@@ -32,11 +32,16 @@ function jl_Function_call(self_::PyPtr, args_::PyPtr, kw_::PyPtr) | |||
try | |||
f = unsafe_pyjlwrap_to_objref(self_)::Function | |||
if kw_ == C_NULL | |||
ret = PyObject(f(convert(PyAny, args)...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package still works on 0.5, so you need a check here e.g. isdefined(Base, :invokelatest)
.
|
remove debugging printout
5372b9c
to
df1d16c
Compare
Updated. @vtjnash I don't know whether that PR is doing its job, but there's a simple repro of the issue this solves, here: JuliaPy/pyjulia#105 (comment) |
Codecov Report
@@ Coverage Diff @@
## master #416 +/- ##
==========================================
+ Coverage 66.04% 66.22% +0.17%
==========================================
Files 17 17
Lines 1511 1516 +5
==========================================
+ Hits 998 1004 +6
+ Misses 513 512 -1
Continue to review full report at Codecov.
|
Ok, so the underlying problem here will be addressed by JuliaLang/julia#22987. However, we should probably still merge this here to fix this on current versions of 0.6. Once base is merged, we can put in an appropriate version check. |
Thanks! |
Fixes JuliaPy/pyjulia#105
I thought it would also fix #343, but the example in that issue description seems to work fine for me on 0.6 release without this PR (but the issue is still open).
Directly calls
Core._apply_latest
with a closure over kw args as in JuliaLang/julia#22646 for 0.6.cc @TsurHerman