This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: assert fails in _Py_Mangle
Type: crash Stage: test needed
Components: Interpreter Core Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: arigo, pitrou, python-dev
Priority: normal Keywords:

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:43adminsetgithub: 61845
2013-04-07 10:30:49pitrousetresolution: fixed
messages: + msg186187
2013-04-07 08:24:16arigosetresolution: fixed -> (no value)
messages: + msg186183
stage: resolved -> test needed
2013-04-06 19:25:38pitrousetstatus: open -> closed

versions: + Python 3.3, Python 3.4
nosy: + pitrou

messages: + msg186150
resolution: fixed
stage: resolved
2013-04-06 19:24:38python-devsetnosy: + python-dev
messages: + msg186149
2013-04-06 15:44:38arigosetfiles: + mem2x.py

messages: + msg186136
2013-04-06 15:38:41arigosettype: crash
components: + Interpreter Core
2013-04-06 15:37:03arigocreate