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

Re: [swig-py3][patch] interfacing bytes object instead of str

From: Yasuhito FUTATSUKI <futatuki_at_poem.co.jp>
Date: Fri, 28 Dec 2018 02:42:15 +0900

On 12/27/18 1:01 PM, Troy Curtis wrote:
> The only real functionality changes I'm concerned with on the changes are dropping str() conversion on a couple of the API inputs since previously providing any object with a suitable __str__ method would work, but would now be broken. But a simple way of supporting Py2 and Py3 isn't a "gimme", so didn't want to block this patch on that.

I see. So I've revise it and str/bytes conversion in unit tests as a first
step of followup to r1849784.

[in subversion/bindings/swig/python/tests]

* client.py (SubversionClientTestCase.test_update4): not to encode
  os.path.sep if it is already bytes object

* core.py (SubversionCoreTestCase.test_stream_write): not to encode
  fname if it is already bytes object

* delta.py (DeltaTestCase.testTxWindowHandler_stream_IF,
  DeltaTestCase.testTxWindowHandler_Stream_IF): not to encode fname if it
  is already bytes object

* fs.py (SubversionFSTestCase.setUp): not to encode self.tmpfile if it
  is already bytes object

* trac/versioncontrol/main.py (Node.__init__): revise change to strip
  str() on r1849784; if path is already bytes, use it for self.path.
  othewise ensure self.path is str, and if it is not bytes (i.e. in case
  of py3), encode it to bytes

* trac/versioncontrol/svn_fs.py (SubversionNode.__init__): don't use
  IS_PY3 condition, just store a unicode string in the exception object.
  - remove unnecessary variable IS_PY3 and therefore unnecessary import
   of sys module
  - (SubversionNode.getproperties): revise change to strip str() on
   r1849784; if value is already bytes, use it for prop[name]. othewise
   ensure value is str, and if it is not bytes (i.e. in case of py3),
   encode it to bytes for consistency of the type of prop[name]

* utils.py (Temper.alloc_empty_dir, Temper.alloc_empty_repo): ensure
  suffix arg for tempfile.mkdtemp() is unicode (for py3 < 3.5)

Cheers,

-- 
Yasuhito FUTATSUKI

Received on 2018-12-27 18:43:12 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.