[New-bugs-announce] [issue38005] Coercing strings and non-integer numbers to interpreter ID

Serhiy Storchaka report at bugs.python.org
Mon Sep 2 05:11:14 EDT 2019


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

Is it correct that strings, bytes objects, bytearrays, floats, fractions, decimals can be coerced to an interpreter ID?

>>> import _xxsubinterpreters as interpreters
>>> id = interpreters.InterpreterID('10', force=True)
>>> id == 10
True
>>> id == 10.1
True
>>> id == '1_0'
True
>>> id == bytearray(b'10')
True

Should not the constructor accept only ints and int-like objects and the comparison return True only for integer numbers?

There are other bugs here: raising OverflowError on comparison with large numbers and silencing all errors in some circumstances that can lead to returning a wrong result when errors like KeyboardInterrupt, RecursionError, MemoryError are occurred.

----------
messages: 350972
nosy: eric.snow, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Coercing strings and non-integer numbers to interpreter ID

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


More information about the New-bugs-announce mailing list