classification
Title: Infinite floats don't work in compiled modules on windows
Type: feature request Stage:
Components: Windows Versions:
process
Status: closed Resolution: postponed
Dependencies: Superseder:
Assigned To: tim_one Nosy List: jiba, tim_one (2)
Priority: normal Keywords

Created on 2003-06-20 11:11 by jiba, last changed 2003-06-20 17:06 by tim_one.

Files
File name Uploaded Description Edit Remove
test.py jiba, 2003-06-20 11:11 import this module TWICE (in 2 different interpreter) and it will bug under windows
Messages (3)
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_one) 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_one) Date: 2003-06-20 17:06
Logged In: YES 
user_id=31435

I've added this feature request to PEP 42.
History
Date User Action Args
2003-06-20 11:11:23jibacreate