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

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

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Fri, 13 Dec 2019 03:11:15 +0000

With swig-py3 in trunk:

>>> from svn.core import *
>>> svn_config_get_user_config_path(None, '')
b'/home/daniel/.subversion'
>>> d = _
>>> svn_config_ensure(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "${prefix}/lib/svn-python/libsvn/core.py", line 6014, in svn_config_ensure
    return _core.svn_config_ensure(*args)
TypeError: svn_config_ensure() argument 1 must be str or None, not bytes
>>> svn_config_ensure(d.decode())
>>>

svn_config_get_user_config_path() returns bytes but svn_config_ensure() expects
str. I expected them both to use the same type, since in C they do:
svn_config_get_user_config_path() has a «const char **» output parameter and
svn_config_ensure() has a «const char *» input parameter.

Cheers,

Daniel

P.S. Unrelated issue: «svn_config_get_user_config_path(None, None)» raises
TypeError, even though at the C level the second input parameter, FNAME,
is allowed to be NULL.
Received on 2019-12-13 04:11:28 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.