Though this issue was already resolved...

On 2019/12/13 17:28, Yasuhito FUTATSUKI wrote:
> On 2019/12/13 16:24, Daniel Shahaf wrote:
>> Thanks for the quick fix.  However, it doesn't work on my machine (Debian 
>> stretch).
>>
>> With your latest patch, «svn_config_get_user_config_path(None, None)»
>> calls the C function of the name with «path == NULL» and segfaults 
>> immediately,
>> because the parameter is dereferenced on the first line of the function.  As 
>> to
>> the other case, I get a bogus stack trace:
>>
>> [[[
>> % PYTHONPATH=… lldb -- python3 -c $'from svn.core import *; 
>> svn_config_ensure("/tmp/foo")'
>> (lldb) r
>> Process 19706 launched: '/usr/bin/python3' (x86_64)
>> Process 19706 stopped
>> * thread #1, name = 'python3', stop reason = signal SIGSEGV: invalid address 
>> (fault address: 0x0)
>>      frame #0: 0x0000000000000000
>> error: memory read failed for 0x0
>> (lldb)
>> ]]]
> 
> Thank you for testing. I also tested and same result on FreeBSD
> with Python 3.6. It seems "z*" format in PyArg_ParseTuple() doesn't
> work I expected.

That was my misreading of the spec[1][2]. The argment type for "z*"
should be Py_buffer, not const char *. Similarly, "z#" can convert
str(unicode), bytes, None into "const char *" and int, but it is not
what we want here. Anyway we had to write additional code if we want to
use parse=... feature of SWIG typemap here.

https://docs.python.org/2.7/c-api/arg.html
https://docs.python.org/3/c-api/arg.html

Cheers,
-- 
Yasuhito FUATSUI <futat...@yf.bsdclub.org> / <futat...@poem.co.jp>

Reply via email to