| 1859 | } |
| 1860 | |
| 1861 | static inline PyLongWriter* |
| 1862 | PyLongWriter_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 | |
| 1880 | static inline void |
| 1881 | PyLongWriter_Discard(PyLongWriter *writer) |
nothing calls this directly
no test coverage detected