mirror of
https://github.com/python/cpython
synced 2024-10-06 16:15:35 +00:00
Silence VS 2010 signed/unsigned warnings.
This commit is contained in:
parent
6ecf8ce364
commit
b05c0738d8
|
@ -13591,7 +13591,10 @@ PyUnicode_Format(PyObject *format, PyObject *args)
|
||||||
c = PyUnicode_READ(fmtkind, fmt, fmtpos++);
|
c = PyUnicode_READ(fmtkind, fmt, fmtpos++);
|
||||||
if (c < '0' || c > '9')
|
if (c < '0' || c > '9')
|
||||||
break;
|
break;
|
||||||
if (width > (PY_SSIZE_T_MAX - (c - '0')) / 10) {
|
/* Since c is unsigned, the RHS would end up as unsigned,
|
||||||
|
mixing signed and unsigned comparison. Since c is between
|
||||||
|
'0' and '9', casting to int is safe. */
|
||||||
|
if (width > (PY_SSIZE_T_MAX - ((int)c - '0')) / 10) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"width too big");
|
"width too big");
|
||||||
goto onError;
|
goto onError;
|
||||||
|
@ -13626,7 +13629,7 @@ PyUnicode_Format(PyObject *format, PyObject *args)
|
||||||
c = PyUnicode_READ(fmtkind, fmt, fmtpos++);
|
c = PyUnicode_READ(fmtkind, fmt, fmtpos++);
|
||||||
if (c < '0' || c > '9')
|
if (c < '0' || c > '9')
|
||||||
break;
|
break;
|
||||||
if (prec > (INT_MAX - (c - '0')) / 10) {
|
if (prec > (INT_MAX - ((int)c - '0')) / 10) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"prec too big");
|
"prec too big");
|
||||||
goto onError;
|
goto onError;
|
||||||
|
|
Loading…
Reference in a new issue