Closed feisuzhu closed 3 years ago
Can you test the wheels https://github.com/libgit2/pygit2/actions/runs/711340943 ?
Probably not……
Additionally, after fixing the offending line
proxy_opts.url = ffi.new('char[]', to_bytes(proxy))
things become weird
Should be localhost
not localhostP
It's not 100% reproducible, but definitely would show up after times.
Do you think you could make a PR with a unit test showing the error?
ping @sathieu
I'm just using the AUTO mode (proxy=True
) together with https://github.com/libgit2/libgit2/pull/5796, this works perfectly. Need to dig in ffi to understand the problem.
@feisuzhu Have you tried:
proxy_opts.url = ffi.string(proxy)
Ref: https://cffi.readthedocs.io/en/latest/ref.html#ffi-string-ffi-unpack
@feisuzhu Have you tried:
proxy_opts.url = ffi.string(proxy)
Ref: https://cffi.readthedocs.io/en/latest/ref.html#ffi-string-ffi-unpack
No, no, no. Sorry for the noise ...
I'm just using the AUTO mode (
proxy=True
) together with libgit2/libgit2#5796, this works perfectly. Need to dig in ffi to understand the problem.
Can confirm, I end up using proxy=True
too.
@feisuzhu Have you tried:
proxy_opts.url = ffi.new('char[]', proxy)
ffi has a doc about memory ownership.
Otherwise @jdavid, maybe we should drop support for proxy=url
?
@feisuzhu Have you tried:
proxy_opts.url = ffi.new('char[]', proxy)
ffi has a doc about memory ownership.
Otherwise @jdavid, maybe we should drop support for
proxy=url
?
IMHO ffi.new('char[]', to_bytes(proxy))
returns an owned reference(to_bytes
returns Python bytes
, not another cdata
), so the problem lies elsewhere.
I'll try again though.
@feisuzhu Yes but the result of to_bytes(proxy)
is released as soon a this line is done.
@sathieu
Did some experiment, found that it's ffi.new('char[]', xxx)
should be kept referenced, not the bytes
.
If I keep the char[]
referenced in global the issue disappears.
Pushed a commit. Can you try with the wheels at https://github.com/libgit2/pygit2/actions/runs/774665500#artifacts ?
We are expecting the proxy feature and it seems landed on master (https://github.com/libgit2/pygit2/pull/1063). We have been waiting for a long time.