Author: breser
Date: Wed Aug 20 11:39:29 2014
New Revision: 1619077
URL: http://svn.apache.org/r1619077
Log:
swig-py: Add close to the core.Stream class.
* subversion/bindings/swig/python/svn/core.py
(Stream.read, Stream.write): Raise a ValueError when the stream isn't open.
(Stream.close): New function.
Patch by: Alexey Neyman <stilor{_at_}att.net>
Modified:
subversion/trunk/subversion/bindings/swig/python/svn/core.py
Modified: subversion/trunk/subversion/bindings/swig/python/svn/core.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/svn/core.py?rev=1619077&r1=1619076&r2=1619077&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/svn/core.py (original)
+++ subversion/trunk/subversion/bindings/swig/python/svn/core.py Wed Aug 20
11:39:29 2014
@@ -169,6 +169,8 @@ class Stream:
self._stream = stream
def read(self, amt=None):
+ if self._stream is None:
+ raise ValueError
if amt is None:
# read the rest of the stream
chunks = [ ]
@@ -183,9 +185,15 @@ class Stream:
return svn_stream_read(self._stream, int(amt))
def write(self, buf):
+ if self._stream is None:
+ raise ValueError
### what to do with the amount written? (the result value)
svn_stream_write(self._stream, buf)
+ def close(self):
+ svn_stream_close(self._stream)
+ self._stream = None
+
def secs_from_timestr(svn_datetime, pool=None):
"""Convert a Subversion datetime string into seconds since the Epoch."""
aprtime = svn_time_from_cstring(svn_datetime, pool)