New submission from Serhiy Storchaka <storchaka+cpyt...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue38005>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to