On 14. 06. 21 14:17, Miro Hrončok wrote:
>> I see one problem with the Rust bindings for CPython / libpython,
>> where the test suite now fails with Python 3.10:
>>
https://koschei.fedoraproject.org/package/rust-cpython?
>>
>> Looking at the build log, the new test failures seem to be caused by
>> either API removals or subtle behaviour changes:
>>
>> - TypeError: 'float' object cannot be interpreted as an integer
>
> Indeed. wrap it in int() or math.floor()/ceil() as needed.
>
> I suspect this is related to:
>
>
https://docs.python.org/3.10/whatsnew/3.10.html#other-language-changes
>
> """
> Builtin and extension functions that take integer arguments no longer accept
> Decimals, Fractions and other objects that can be converted to integers only
> with a loss (e.g. that have the __int__() method but do not have the
> __index__() method).
https://bugs.python.org/issue37999
> """
Can I get the Python traceback somehow? The rust thing (object?) seem to have:
PyErr { ptype: <class 'TypeError'>, pvalue: Some("'float'
object cannot be
interpreted as an integer"), ptraceback: None }
Not sure ... looking at the sources for the tests:
It seems that this just will not work as expected for some float ->
int -> float roundtrip conversions any longer, due to the changes in
python 3.10.
Fabio