[New-bugs-announce] [issue27333] validate_step in rangeobject.c, incorrect code logic but right result

Xiang Zhang report at bugs.python.org
Thu Jun 16 12:36:25 EDT 2016


New submission from Xiang Zhang:

Here is a drawback in validate_step of rangeobject. PyNumber_AsSsize_t returns clipped value and won't set an exception when the argument *exc* is set NULL. So if step overflows, istep is always PY_SSIZE_MAX or PY_SSIZE_MIN. But the following code is to check if istep is -1 and there is an exception. The code actually conflicts. But fortunately the result is always right. I suggest to make the code logic right.

----------
files: incorrect_logic_in_validate_step.patch
keywords: patch
messages: 268677
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: validate_step in rangeobject.c, incorrect code logic but right result
Added file: http://bugs.python.org/file43419/incorrect_logic_in_validate_step.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27333>
_______________________________________


More information about the New-bugs-announce mailing list