( )⚙ D2587 cext: accept arguments as Py_buffer

This is an archive of the discontinued Mercurial Phabricator instance.

cext: accept arguments as Py_buffer
ClosedPublic

Authored by indygreg on Mar 3 2018, 11:28 AM.

Details

Summary

The s*/y* value formatters receive a Py_buffer instead of a char *.
This value format is more flexible in the types that it allows.

We change bdiff() to accept any object that conforms to the buffer
protocol. We validate the buffers are contiguous and have a single
dimension.

This allows memoryview instances to be handled by the function, so
we revert a recent change to cast arguments to bytes before calling
this function.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Mar 3 2018, 11:28 AM
yuja accepted this revision.Mar 3 2018, 3:02 PM
This revision is now accepted and ready to land.Mar 3 2018, 3:02 PM
This revision was automatically updated to reflect the committed changes.