We've noticed a strange occurance on Python 2.4.3 w/ the floating point value
1.79769313486232e+308 and how it interacts w/ a .pyc. Given x.py:
def foo():
print str(1.79769313486232e+308)
print str(1.79769313486232e+308) == "1.#INF"
The 1st time you run this you get the correct value, but if you reload the
module after a .pyc is created then you get different results (and the
generated byte code appears to have changed).
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import x
>>> import dis
>>> dis.dis(x.foo)
2 0 LOAD_GLOBAL 0 (str)
3 LOAD_CONST 1 (1.#INF)
6 CALL_FUNCTION 1
9 PRINT_ITEM
10 PRINT_NEWLINE
3 11 LOAD_GLOBAL 0 (str)
14 LOAD_CONST 1 (1.#INF)
17 CALL_FUNCTION 1
20 LOAD_CONST 2 ('1.#INF')
23 COMPARE_OP 2 (==)
26 PRINT_ITEM
27 PRINT_NEWLINE
28 LOAD_CONST 0 (None)
31 RETURN_VALUE
>>> reload(x)
<module 'x' from 'x.pyc'>
>>> dis.dis(x.foo)
2 0 LOAD_GLOBAL 0 (str)
3 LOAD_CONST 1 (1.0)
6 CALL_FUNCTION 1
9 PRINT_ITEM
10 PRINT_NEWLINE
3 11 LOAD_GLOBAL 0 (str)
14 LOAD_CONST 1 (1.0)
17 CALL_FUNCTION 1
20 LOAD_CONST 2 ('1.#INF')
23 COMPARE_OP 2 (==)
26 PRINT_ITEM
27 PRINT_NEWLINE
28 LOAD_CONST 0 (None)
31 RETURN_VALUE
>>> ^Z
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com