Implemented hook_read_{after,before} callers.

parent 282beeb2
...@@ -126,13 +126,16 @@ cdef public void py_input(object parser, char *buf, int *result, int max_size): ...@@ -126,13 +126,16 @@ cdef public void py_input(object parser, char *buf, int *result, int max_size):
if parser.verbose: if parser.verbose:
print '\npy_input: want to read up to %s bytes' % max_size print '\npy_input: want to read up to %s bytes' % max_size
if hasattr(parser, 'hook_read_before'):
parser.hook_read_before()
try: try:
raw = parser.read(max_size) raw = parser.read(max_size)
except KeyboardInterrupt: except KeyboardInterrupt:
raw = '' raw = ''
if hasattr(parser, 'hook_read'): if hasattr(parser, 'hook_read_after'):
raw = parser.hook_read(raw) raw = parser.hook_read_after(raw)
buflen = PyInt_AsLong(len(raw)) buflen = PyInt_AsLong(len(raw))
result[0] = buflen result[0] = buflen
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment