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: Raising an exception in __trunc__ gives a segmentation fault.
Type: crash Stage: resolved
Components: Interpreter Core Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: benjamin.peterson, mark.dickinson, python-dev
Priority: high Keywords: patch

Created on 2013-04-13 15:57 by mark.dickinson, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue17715.patch mark.dickinson, 2013-04-13 16:16 review
Messages (5)
msg186735 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-04-13 15:57
Python 3.4.0a0 (default:838fdf3bb0c6, Apr 13 2013, 16:54:22) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class A:
...     def __trunc__(self): 1/0
... 
>>> int(A())
Segmentation fault

It looks as though the problem is in PyNumber_Long, where there's an unchecked return value for PyEval_CallObject.
msg186740 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-04-13 16:07
Also affects 3.3.  2.7 seems to be okay.
msg186745 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-04-13 16:16
Here's a patch.
msg186755 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-04-13 16:41
LGTM
msg186757 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-04-13 16:46
New changeset 52bd2035e70a by Mark Dickinson in branch '3.3':
Issue #17715: Add missing NULL Check to PyNumber_Long.
http://hg.python.org/cpython/rev/52bd2035e70a

New changeset 5358ee70f831 by Mark Dickinson in branch 'default':
Issue #17715: Merge fix from 3.3.
http://hg.python.org/cpython/rev/5358ee70f831
History
Date User Action Args
2022-04-11 14:57:44adminsetgithub: 61915
2013-04-13 16:46:48mark.dickinsonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-04-13 16:46:23python-devsetnosy: + python-dev
messages: + msg186757
2013-04-13 16:41:22benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg186755
2013-04-13 16:16:23mark.dickinsonsetstage: patch review
2013-04-13 16:16:15mark.dickinsonsetfiles: + issue17715.patch
keywords: + patch
messages: + msg186745
2013-04-13 16:07:04mark.dickinsonsetmessages: + msg186740
versions: + Python 3.3
2013-04-13 15:57:33mark.dickinsoncreate