Allow a Py_buffer as data for Rules_match (#152)
* Allow a Py_buffer as data for Rules_match This makes rules matching compatible with data objects `PyArg_ParseTuple` does not consider read-only (even though they might actually be), such a memoryviews. The main change is replacing the `s#` formatter with `s*` and replacing the `(pointer, length)` pair with a `Py_buffer` object accordingly. Additional care must be taken to release the `Py_buffer` on every error path. * Rules_match: zero-initialize data PyArg_ParseTupleAndKeywords does not initialize optional fields unless they are passed, which means we need to zero-initialize the data buffer to be sure the later NULL checks always work. This commit also gets rid of the unneeded has_data flag. * Add test for matching on a memoryview
Showing
Please
register
or
sign in
to comment