This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Infinite floats don't work in compiled modules on windows
Type: enhancement Stage:
Components: Windows Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: jiba, mark.dickinson, tim.peters
Priority: normal Keywords:

Created on 2003-06-20 11:11 by jiba, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.py jiba, 2003-06-20 11:11 import this module TWICE (in 2 different interpreter) and it will bug under windows
Messages (4)
msg16542 - (view) Author: Jiba (jiba) Date: 2003-06-20 11:11
On windows, let's consider the following Python module :


# test.py
INFINITY = 10E40000
print INFINITY


When imported the first time (import test), it displays
"1.#inf" as expected.
But if you quit the Python interpreter, lauch a new one
and import the module again, it displays "1.0" !

The bug occurs only when the module is loaded from the
compiled file (test.pyc), and not when the source file
(test.py) is loaded and compiled.

BTW infinity behaves differently under Linux and
windows (under Linux, they are displayed as "inf", and
float("inf") is ok).

The bug seems to be windows-specific (never seen on
Linux). I tested it with Python 2.2.3 and 2.3b.

BTW infinity behaves differently under Linux and
windows (under Linux, they are displayed as "inf", and
float("inf") is ok).
msg16543 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-06-20 17:06
Logged In: YES 
user_id=31435

Sorry, all behavior wrt infinities (and NaNs, and signed zeroes) 
is a platform- and release-dependent accident.  I've added a 
link to this report in PEP 42, under the "Non-accidental IEEE-
754 support" feature request heading.

On most platforms you can worm around your specific problem 
by doing

INFINITY = 1e200 * 1e200

instead.

The business about how infinities display, and whether they 
can be read back in, is another batch of accidents inherited 
from the platform C I/O routines.
msg16544 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-06-20 17:06
Logged In: YES 
user_id=31435

I've added this feature request to PEP 42.
msg113918 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-14 17:54
Reclassifying as out of date.  Infinity and NaN handling in Python 2.7 and later is consistent across platforms;  those versions of Python contain their own code for reading and writing floats, instead of depending on the system libraries.
History
Date User Action Args
2022-04-10 16:09:21adminsetgithub: 38689
2010-08-14 17:54:44mark.dickinsonsetresolution: postponed -> out of date
messages: + msg113918
2010-08-14 16:49:44ezio.melottisetnosy: + mark.dickinson
2003-06-20 11:11:23jibacreate