Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 83160:72f0fd0c4d90 3.3
Issue #17645: convert an assert() into a proper exception in _Py_Mangle().
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sat, 06 Apr 2013 21:21:04 +0200 |
| parents | ffb2fa900cb7 |
| children | 74eb5f978471 6e7c6c06f3ba |
line wrap: on
line diff
--- a/Python/compile.c Sat Apr 06 21:14:43 2013 +0300 +++ b/Python/compile.c Sat Apr 06 21:21:04 2013 +0200 @@ -248,8 +248,11 @@ } plen -= ipriv; - assert(1 <= PY_SSIZE_T_MAX - nlen); - assert(1 + nlen <= PY_SSIZE_T_MAX - plen); + if (plen + nlen >= PY_SSIZE_T_MAX - 1) { + PyErr_SetString(PyExc_OverflowError, + "private identifier too large to be mangled"); + return NULL; + } maxchar = PyUnicode_MAX_CHAR_VALUE(ident); if (PyUnicode_MAX_CHAR_VALUE(privateobj) > maxchar)
