summaryrefslogtreecommitdiff
path: root/src/lxml/serializer.pxi
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2013-12-23 11:57:06 +0100
committerStefan Behnel <stefan_ml@behnel.de>2013-12-23 11:57:06 +0100
commit9693d735e014a39fe697c5c76177287ffdc2a06d (patch)
treee6696bce444a3f8fbf3bc6d2e91292b33645d5d5 /src/lxml/serializer.pxi
parentab93c7098d4dbad55da60c15f6464e5fcd78bec7 (diff)
downloadpython-lxml-9693d735e014a39fe697c5c76177287ffdc2a06d.tar.gz
fix attribute error on error handling in xmlfile()
Diffstat (limited to 'src/lxml/serializer.pxi')
-rw-r--r--src/lxml/serializer.pxi9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi
index 04f70a81..544a364d 100644
--- a/src/lxml/serializer.pxi
+++ b/src/lxml/serializer.pxi
@@ -649,7 +649,7 @@ cdef class _IncrementalFileWriter:
cdef tree.xmlOutputBuffer* _c_out
cdef bytes _encoding
cdef const_char* _c_encoding
- cdef object _target
+ cdef _FilelikeWriter _target
cdef list _element_stack
cdef int _status
@@ -660,7 +660,8 @@ cdef class _IncrementalFileWriter:
encoding = b'ASCII'
self._encoding = encoding
self._c_encoding = _cstr(encoding) if encoding is not None else NULL
- self._target = _create_output_buffer(outfile, self._c_encoding, compresslevel, &self._c_out)
+ self._target = _create_output_buffer(
+ outfile, self._c_encoding, compresslevel, &self._c_out)
def __dealloc__(self):
if self._c_out is not NULL:
@@ -871,8 +872,8 @@ cdef class _IncrementalFileWriter:
cdef _handle_error(self, int error_result):
if error_result != xmlerror.XML_ERR_OK:
- if self._writer is not None:
- self._writer._exc_context._raise_if_stored()
+ if self._target is not None:
+ self._target._exc_context._raise_if_stored()
_raiseSerialisationError(error_result)
@cython.final