Commit 8e8838cf authored by Stefan Behnel's avatar Stefan Behnel

support really long paddings in f-string formatting of C integers

parent ef57fb78
...@@ -570,14 +570,14 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value) { ...@@ -570,14 +570,14 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value) {
/////////////// CIntToPyUnicode.proto /////////////// /////////////// CIntToPyUnicode.proto ///////////////
static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, int width, char padding_char, char format_char); static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t width, char padding_char, char format_char);
/////////////// CIntToPyUnicode /////////////// /////////////// CIntToPyUnicode ///////////////
//@requires: BuildPyUnicode //@requires: BuildPyUnicode
// NOTE: inlining because most arguments are constant, which collapses lots of code below // NOTE: inlining because most arguments are constant, which collapses lots of code below
static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, int width, char padding_char, char format_char) { static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t width, char padding_char, char format_char) {
// simple and conservative C string allocation on the stack: each byte gives at most 3 digits, plus sign // simple and conservative C string allocation on the stack: each byte gives at most 3 digits, plus sign
char digits[sizeof({{TYPE}})*3+2]; char digits[sizeof({{TYPE}})*3+2];
// dpos points to end of digits array + 1 at the beginning to allow for pre-decrement looping // dpos points to end of digits array + 1 at the beginning to allow for pre-decrement looping
...@@ -652,7 +652,7 @@ static PyObject* __Pyx_PyUnicode_Build(Py_ssize_t ulength, char* chars, int clen ...@@ -652,7 +652,7 @@ static PyObject* __Pyx_PyUnicode_Build(Py_ssize_t ulength, char* chars, int clen
PyObject *uval; PyObject *uval;
Py_ssize_t uoffset = ulength - clength; Py_ssize_t uoffset = ulength - clength;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_COMPILING_IN_CPYTHON
int i; Py_ssize_t i;
#if PY_MAJOR_VERSION > 3 || PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3 #if PY_MAJOR_VERSION > 3 || PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3
// Py 3.3+ (post PEP-393) // Py 3.3+ (post PEP-393)
void *udata; void *udata;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment