MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / PyLongWriter_Create

Function PyLongWriter_Create

asyncpg/protocol/record/pythoncapi_compat.h:1861–1878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1859}
1860
1861static inline PyLongWriter*
1862PyLongWriter_Create(int negative, Py_ssize_t ndigits, void **digits)
1863{
1864 if (ndigits <= 0) {
1865 PyErr_SetString(PyExc_ValueError, "ndigits must be positive");
1866 return NULL;
1867 }
1868 assert(digits != NULL);
1869
1870 PyLongObject *obj = _PyLong_New(ndigits);
1871 if (obj == NULL) {
1872 return NULL;
1873 }
1874 _PyLong_SetSignAndDigitCount(obj, negative?-1:1, ndigits);
1875
1876 *digits = _PyLong_GetDigits(obj);
1877 return (PyLongWriter*)obj;
1878}
1879
1880static inline void
1881PyLongWriter_Discard(PyLongWriter *writer)

Callers

nothing calls this directly

Calls 2

_PyLong_GetDigitsFunction · 0.85

Tested by

no test coverage detected