[pypy-svn] r55309 - pypy/dist/pypy/lib
fijal at codespeak.net
fijal at codespeak.net
Tue May 27 19:03:41 CEST 2008
Author: fijal
Date: Tue May 27 19:03:40 2008
New Revision: 55309
Modified:
pypy/dist/pypy/lib/pyexpat.py
Log:
Few more checkers, now it passes the test suite
Modified: pypy/dist/pypy/lib/pyexpat.py
==============================================================================
--- pypy/dist/pypy/lib/pyexpat.py (original)
+++ pypy/dist/pypy/lib/pyexpat.py Tue May 27 19:03:40 2008
@@ -32,6 +32,12 @@
XML_Parse = lib.XML_Parse
XML_Parse.args = [XML_Parser, ctypes.c_char_p, ctypes.c_int, ctypes.c_int]
XML_Parse.result = ctypes.c_int
+currents = ['CurrentLineNumber', 'CurrentColumnNumber',
+ 'CurrentByteIndex']
+for name in currents:
+ func = getattr(lib, 'XML_Get' + name)
+ func.args = [XML_Parser]
+ func.result = c_int
handler_names = [
'StartElement',
@@ -148,8 +154,11 @@
def ExternalEntity(unused, context, base, sysId, pubId):
self._flush_character_buffer()
conv = self.conv
- return real_cb(conv(context), conv(base), conv(sysId),
- conv(pubId))
+ res = real_cb(conv(context), conv(base), conv(sysId),
+ conv(pubId))
+ if res is None:
+ return 0
+ return res
CB = ctypes.CFUNCTYPE(c_int, c_void_p, *([c_char_p] * 4))
return CB(ExternalEntity)
@@ -254,6 +263,8 @@
def __getattr__(self, name):
if name == 'buffer_text':
return self.buffer is not None
+ elif name in currents:
+ return getattr(lib, 'XML_Get' + name)(self.itself)
return self.__dict__[name]
def ParseFile(self, file):
More information about the Pypy-commit
mailing list