summaryrefslogtreecommitdiff
path: root/src/lxml/docloader.pxi
diff options
context:
space:
mode:
authorscoder <none@none>2008-10-16 22:41:51 +0200
committerscoder <none@none>2008-10-16 22:41:51 +0200
commit34e3c2d95ea92bfd01664b69d168f86b16a62487 (patch)
tree4266e0a84c9136ebdbb3c492aefdb7f51d6b8050 /src/lxml/docloader.pxi
parent8c5cfdf0027870ebeeee7237ca08ed686427aec7 (diff)
downloadpython-lxml-34e3c2d95ea92bfd01664b69d168f86b16a62487.tar.gz
[svn r3982] r4814@delle: sbehnel | 2008-10-16 22:41:13 +0200
cleanup and simplification --HG-- branch : trunk
Diffstat (limited to 'src/lxml/docloader.pxi')
-rw-r--r--src/lxml/docloader.pxi9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lxml/docloader.pxi b/src/lxml/docloader.pxi
index 3e97443f..f6a6ad6d 100644
--- a/src/lxml/docloader.pxi
+++ b/src/lxml/docloader.pxi
@@ -8,7 +8,7 @@ ctypedef enum _InputDocumentDataType:
cdef class _InputDocument:
cdef _InputDocumentDataType _type
- cdef object _data
+ cdef object _data_bytes
cdef object _filename
cdef object _file
@@ -47,12 +47,13 @@ cdef class Resolver:
argument.
"""
cdef _InputDocument doc_ref
- if not python.PyString_Check(string) and \
- not python.PyUnicode_Check(string):
+ if python.PyUnicode_Check(string):
+ string = python.PyUnicode_AsUTF8String(string)
+ elif not python.PyString_Check(string):
raise TypeError, "argument must be a byte string or unicode string"
doc_ref = _InputDocument()
doc_ref._type = PARSER_DATA_STRING
- doc_ref._data = string
+ doc_ref._data_bytes = string
if base_url is not None:
doc_ref._filename = _encodeFilename(base_url)
return doc_ref