| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add :c:func:`Py_HashBuffer` to the limited C API. Patch by Victor Stinner. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Need limited C API version 3.16 for Py_HashBuffer() | ||
| #define Py_LIMITED_API 0x03100000 | ||
|
|
||
| #include "parts.h" | ||
| #include "util.h" | ||
|
|
||
|
|
||
| static PyObject* | ||
| long_from_hash(Py_hash_t hash) | ||
| { | ||
| Py_BUILD_ASSERT(sizeof(long long) >= sizeof(hash)); | ||
| return PyLong_FromLongLong(hash); | ||
| } | ||
|
|
||
|
|
||
| // Test Py_HashBuffer() | ||
| static PyObject* | ||
| hash_buffer(PyObject *Py_UNUSED(module), PyObject *args) | ||
| { | ||
| char *ptr; | ||
| Py_ssize_t len; | ||
| if (!PyArg_ParseTuple(args, "y#", &ptr, &len)) { | ||
| return NULL; | ||
| } | ||
|
|
||
| Py_hash_t hash = Py_HashBuffer(ptr, len); | ||
| return long_from_hash(hash); | ||
| } | ||
|
|
||
|
|
||
| static PyMethodDef test_methods[] = { | ||
| {"hash_buffer", hash_buffer, METH_VARARGS}, | ||
| {NULL}, | ||
| }; | ||
|
|
||
| int | ||
| _PyTestLimitedCAPI_Init_Hash(PyObject *m) | ||
| { | ||
| return PyModule_AddFunctions(m, test_methods); | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityCould you put 3.16 additions at the end?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI created #157990 to group stable_abi.toml entries per Python version.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.