Issue 17645: assert fails in _Py_Mangle (original) (raw)

Created on 2013-04-06 15:37 by arigo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mem2.py arigo,2013-04-06 15:37 Crasher
mem2x.py arigo,2013-04-06 15:44 Crasher
Messages (6)
msg186135 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2013-04-06 15:37
Run this example on a 32-bit machine with more than 2GB of addressable RAM (e.g. by default, more or less anything but Windows). On Python 2.7 it raises "SystemError: Negative size passed to PyString_FromStringAndSize". On a debug version, it causes an assert in _Py_Mangle() to trigger.
msg186136 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2013-04-06 15:44
Modified the example to run in only 1+GB of RAM, so that it crashes also on 32-bit versions of the Python 2.7 interpreter in Windows (the most common around, I suppose).
msg186149 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-04-06 19:24
New changeset 72f0fd0c4d90 by Antoine Pitrou in branch '3.3': Issue #17645: convert an assert() into a proper exception in _Py_Mangle(). http://hg.python.org/cpython/rev/72f0fd0c4d90 New changeset 6e7c6c06f3ba by Antoine Pitrou in branch 'default': Issue #17645: convert an assert() into a proper exception in _Py_Mangle(). http://hg.python.org/cpython/rev/6e7c6c06f3ba New changeset 0e0a3df5b08d by Antoine Pitrou in branch '2.7': Issue #17645: convert an assert() into a proper exception in _Py_Mangle(). http://hg.python.org/cpython/rev/0e0a3df5b08d
msg186150 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-04-06 19:25
This should be fixed now, thank you!
msg186183 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2013-04-07 08:24
You may want to add a test. This might help notice that comparing an integer of type Py_ssize_t to check if it's greater than PY_SSIZE_T_MAX is bogus in C :-(
msg186187 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-04-07 10:30
The crash is very obscure, I don't think we want to bother with a unit test for that (it took 14 seconds to crash or pass here). > This might help notice that comparing an integer of type Py_ssize_t to > check if it's greater than PY_SSIZE_T_MAX is bogus in C The variables are of type size_t, not Py_ssize_t (which explains why the comparison works).
History
Date User Action Args
2022-04-11 14:57:43 admin set github: 61845
2013-04-07 10:30:49 pitrou set resolution: fixedmessages: +
2013-04-07 08:24:16 arigo set resolution: fixed -> (no value)messages: + stage: resolved -> test needed
2013-04-06 19:25:38 pitrou set status: open -> closedversions: + Python 3.3, Python 3.4nosy: + pitroumessages: + resolution: fixedstage: resolved
2013-04-06 19:24:38 python-dev set nosy: + python-devmessages: +
2013-04-06 15:44:38 arigo set files: + mem2x.pymessages: +
2013-04-06 15:38:41 arigo set type: crashcomponents: + Interpreter Core
2013-04-06 15:37:03 arigo create