[New-bugs-announce] [issue44692] Const unfolding in parser with negative numbers doesn't match float/int behaviour

anthony shaw report at bugs.python.org
Wed Jul 21 01:18:16 EDT 2021


New submission from anthony shaw <anthonyshaw at apache.org>:

Powers with negative bases do not observe the same rules that float_pow/long_pow do when it comes to returning negative results/

Example:

> -2 ** 2
-4

>>> x = -2
>>> y = 2
>>> x ** y
4

>>> -2. ** 2.
-4.0
>>> x = -2.
>>> y = 2.
>>> x ** y
4.0

Tested on 3.8, 3.9 and 3.10, they all have the same bug.

----------
components: Parser
messages: 397922
nosy: anthonypjshaw, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Const unfolding in parser with negative numbers doesn't match float/int behaviour
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44692>
_______________________________________


More information about the New-bugs-announce mailing list