Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-102471, PEP 757: Add PyLong import and export API#121339
New issue
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
f4fdbf2c2e568ef0d9525b19764f6f7fd11080e0791a7902fb70a6dd07552a70d0f942762c33a20be7a3d92bf1eb3b02a2caca2d74221a4937b1d49d70a1214aa25f690973d45d3e224c7d7cb2a3d601ac04926806b196b3e8d29686c68c2a8fd669a04f9d0b2be94aca98ad1167d75e5e53a5bc24789f0422f9da529a483db44f31d2863ed663511816798d033bd6536b87d494d852ea72ff8353d584b577598ab08cd55eaebef303248c70a26f9788a62fe45517ab92007d16d3cb80File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -144,35 +144,11 @@ pylong_aspid(PyObject *module, PyObject *arg) | ||
| static PyObject * | ||
| layout_to_dict(const PyLongLayout *layout) | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| { | ||
| return Py_BuildValue("{sisisisi}", | ||
| "bits_per_digit", (int)layout->bits_per_digit, | ||
| "digit_size", (int)layout->digit_size, | ||
| "digits_order", (int)layout->digits_order, | ||
| "digit_endianness", (int)layout->digit_endianness); | ||
| } | ||
| @@ -185,6 +161,9 @@ pylong_export(PyObject *module, PyObject *obj) | ||
| } | ||
| if (export_long.digits == NULL) { | ||
| assert(export_long.negative == 0); | ||
| assert(export_long.ndigits == 0); | ||
| assert(export_long.digits == NULL); | ||
| return PyLong_FromInt64(export_long.value); | ||
vstinner marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| // PyLong_FreeExport() is not needed in this case | ||
| } | ||
| @@ -209,6 +188,7 @@ pylong_export(PyObject *module, PyObject *obj) | ||
| Py_DECREF(item); | ||
| } | ||
| assert(export_long.value == 0); | ||
| PyObject *res = Py_BuildValue("(iN)", export_long.negative, digits); | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| PyLong_FreeExport(&export_long); | ||
| @@ -228,6 +208,7 @@ pylongwriter_create(PyObject *module, PyObject *args) | ||
| { | ||
| int negative; | ||
| PyObject *list; | ||
| // TODO(vstinner): write test for negative ndigits and digits==NULL | ||
| if (!PyArg_ParseTuple(args, "iO!", &negative, &PyList_Type, &list)) { | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| return NULL; | ||
| } | ||
Uh oh!
There was an error while loading.Please reload this page.