mirror of
https://github.com/python/cpython
synced 2024-10-14 17:59:38 +00:00
gh-111140: minor docs typos cleanup in the C example API calls. (#118612)
This commit is contained in:
parent
b4f8eb0de2
commit
b744fa5d3e
|
@ -390,7 +390,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
|
||||||
Usage example::
|
Usage example::
|
||||||
|
|
||||||
int32_t value;
|
int32_t value;
|
||||||
Py_ssize_t bytes = PyLong_AsNativeBits(pylong, &value, sizeof(value), -1);
|
Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);
|
||||||
if (bytes < 0) {
|
if (bytes < 0) {
|
||||||
// Failed. A Python exception was set with the reason.
|
// Failed. A Python exception was set with the reason.
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -418,7 +418,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
|
||||||
called twice: first to determine the buffer size, then to fill it::
|
called twice: first to determine the buffer size, then to fill it::
|
||||||
|
|
||||||
// Ask how much space we need.
|
// Ask how much space we need.
|
||||||
Py_ssize_t expected = PyLong_AsNativeBits(pylong, NULL, 0, -1);
|
Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);
|
||||||
if (expected < 0) {
|
if (expected < 0) {
|
||||||
// Failed. A Python exception was set with the reason.
|
// Failed. A Python exception was set with the reason.
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -430,7 +430,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// Safely get the entire value.
|
// Safely get the entire value.
|
||||||
Py_ssize_t bytes = PyLong_AsNativeBits(pylong, bignum, expected, -1);
|
Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, bignum, expected, -1);
|
||||||
if (bytes < 0) { // Exception has been set.
|
if (bytes < 0) { // Exception has been set.
|
||||||
free(bignum);
|
free(bignum);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue