Message335168
math.prod introduced with issue35606 seems to segfault when zero is present on some cases like start or middle of the iterable. I couldn't find the exact cause of this. This also occurs in optimized builds.
# Python information built with ./configure && make
➜ cpython git:(master) ./python.exe
Python 3.8.0a1+ (heads/master:8a03ff2ff4, Feb 11 2019, 00:13:49)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
# Segfaults with range(10), [0, 1, 2, 3] and [1, 0, 2, 3]
➜ cpython git:(master) ./python.exe -X faulthandler -c 'import math; print(math.prod(range(10)))'
Fatal Python error: Floating point exception
Current thread 0x00007fff7939f300 (most recent call first):
File "<string>", line 1 in <module>
[1] 40465 floating point exception ./python.exe -X faulthandler -c 'import math; print(math.prod(range(10)))'
➜ cpython git:(master) ./python.exe -X faulthandler -c 'import math; print(math.prod([0, 1, 2, 3]))'
Fatal Python error: Floating point exception
Current thread 0x00007fff7939f300 (most recent call first):
File "<string>", line 1 in <module>
[1] 40414 floating point exception ./python.exe -X faulthandler -c 'import math; print(math.prod([0, 1, 2, 3]))'
➜ cpython git:(master) ./python.exe -X faulthandler -c 'import math; print(math.prod([1, 0, 2, 3]))'
Fatal Python error: Floating point exception
Current thread 0x00007fff7939f300 (most recent call first):
File "<string>", line 1 in <module>
[1] 40425 floating point exception ./python.exe -X faulthandler -c 'import math; print(math.prod([1, 0, 2, 3]))'
# No segfault when zero is at the end and floats seem to work fine.
➜ cpython git:(master) ./python.exe -X faulthandler -c 'import math; print(math.prod([1, 2, 3, 0]))'
0
➜ cpython git:(master) ./python.exe -c 'import math; print(math.prod(map(float, range(10))))'
0.0 |
|
Date |
User |
Action |
Args |
2019-02-10 19:08:57 | xtreak | set | recipients:
+ xtreak, rhettinger, pablogsal |
2019-02-10 19:08:53 | xtreak | set | messageid: <1549825733.5.0.0745476001214.issue35959@roundup.psfhosted.org> |
2019-02-10 19:08:53 | xtreak | link | issue35959 messages |
2019-02-10 19:08:53 | xtreak | create | |
|