Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python3.7.1: `10**3.5`: could not convert string to float: 3.5

I'm really confused on why this is happening to me:

Python 3.7.1 (default, Nov  5 2018, 14:07:04) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 10**3.5
ValueError: could not convert string to float: 3.5

Could someone shine a light? As you can see, this is a plain input – what I thought would be a float literal.

I've tried to take away the ipython complexity, and run in isolated mode, and but still:

python3 -I -c "float('3.5')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: could not convert string to float: '3.5'

Is my python3.7 broken, is my understanding broken, or what am I looking at?

I ruled out encoding problems by putting shown code into a file and hexdumping that. It's clean ascii, as it should be, with a 0x2e for a dot, and a 0x0a as a line ending:

xxd testfile.py
00000000: 332e 350a                                3.5.
python3 -I testfile.py
ValueError: could not convert string to float: 3.5

OS: Fedora 29 on an x86_64 with 16 GB of RAM.

like image 511
Marcus Müller Avatar asked Nov 06 '22 21:11

Marcus Müller


1 Answers

The problem was caused by Fedora seemingly doing a glibc update without my interaction.

An extensiver-than-should-have-been investigation with GDB revealed that libc functionality was being called incorrectly.

So I rebooted. Problem seems solved.

like image 102
Marcus Müller Avatar answered Nov 14 '22 23:11

Marcus Müller