[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: swig-py3 str/bytes difference in svn_config_*()

From: Yasuhito FUTATSUKI <futatuki_at_poem.co.jp>
Date: Sat, 14 Dec 2019 13:19:26 +0900

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 <futatuki_at_yf.bsdclub.org> / <futatuki_at_poem.co.jp>
Received on 2019-12-14 05:21:00 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.