-
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
Fix most of 0.7 depwarns #425
Conversation
ea63d3b
to
75e93fc
Compare
Updated to include more fixes. One depwarn waiting for JuliaLang/Compat.jl#400 and not included. |
Note that getting loading to pass on nightly requires FluxML/MacroTools.jl#57 |
b740a1e
to
68ad517
Compare
Ping. |
1 similar comment
Ping. |
Ping. Added some more fix now that the Compat change is merged. CI pass will still need the MacroTools PR. |
Ping, anyone? @stevengj ? This PR has been sitting here for a month now. And have been updated 3 times to include new fixes............................... |
And ref JuliaPy/Conda.jl#82 (comment) JuliaPy/Conda.jl#67 (comment) about organization permission setup..... |
src/pyinit.jl
Outdated
argv = unsafe_convert(Ptr{Cwchar_t}, argv_s) | ||
ccall(@pysym(:PySys_SetArgvEx), Void, (Cint, Ptr{Ptr{Cwchar_t}}, Cint), 1, &argv, 0) | ||
end | ||
ccall(@pysym(:PySys_SetArgvEx), Void, (Cint, Ptr{UInt32}, Cint), 1, EmptyStringList(), 0) |
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.
Isn't there a simpler way to do this?
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.
Keeping the branch and using Ptr{Cstring}
, Ptr{Cwstring}
and pass in an actual array of string should work too. I did it this way since,
- This eliminate the branch.
- So the code is actually not much longer
- I want to see how easy it is to implement sth like this properly
- It doesn't allocate anything (optimized out on 0.7) (yeah, I know it's just
__init__
)
When 0.6 support is dropped, this can be done with @gc_preserve
without external definition.
ref0 = Ref{UInt32}(0)
@gc_preserve ref0 ccall(@pysym(:PySys_SetArgvEx), Void, (Cint, Ref{Ptr{Void}}, Cint), 1, pointer_from_objref(ref0), 0)
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.
The branch and the performance are irrelevant here. But as your code shows, we don't actually need the branch, since a pointer to a pointer to an array of a 32-bit zero will work in both Python 2 and 3 (even though Python 2 needs only one byte of zero).
I would prefer to just use Ptr{Cwstring}
to pass an an actual array rather than declaring a custom type here.
@yuyichao, I changed the default member privilege to write so you should be able to merge this yourself now – let me know if you can't. |
I can merge this now. I do want to wait for a new nightly though since the code here exposes a base bug.... |
Makes sure that the pointer lifetime is managed by a mutable object.
No description provided.