You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the uses of buffer() here were just to do a non-copying
slice - i.e. buffer(data, p) is equivalent to data[p:], but it points to
the existing memory used for data rather than copying it.
I'm proposing this change for discussion: it replaces the buffer calls
with standard slicing. If bytes objects are passed in, this will copy
data, with some potential performance loss - how much depends on how
many times we're slicing each chunk of data. The tests are not
measurably slower.
If the overhead of copying is significant, the caller of the parsing
machinery can pass in a memoryview object, on which slices should be
non-copying. I think this should mostly work with no changes to this
code, but if that's important, we should obviously test it.
This reduces the number of test failures on Python 3 to 251 (26
failures, 225 errors). Tests still pass on Python 2.
0 commit comments