[IronPython] Differences between Ironpython and CPython 2.4

Dino Viehland dinov at exchange.microsoft.com
Thu Oct 12 19:49:20 CEST 2006


If you run IronPython w/ -X:ExceptionDetail you'll see where the exception is getting thrown from IronPython.  Put a break point there and look at the values that are coming into that function.  Then you should be able to compare that simple operation to the one in CPython and see if they're both behaving the same.

If they are both behaving the same you'll need to step back and see how we're getting those values as being different then from CPython (I'm saying this because 0.0 ** -2 throws in both CPython & IronPython).  Maybe we're returning 0 somewhere that CPython isn't causing you to get the exception later on.  For that you'll need to start looking at what code paths you're going to get to the __pow__ call and compare the results along the way.  The easiest way to do that might be to log the outputs of the operations and diff them and spot the difference.

Once you've found the operation that's differing you should be able to do a side by side comparison of IronPython & CPython and see what's wrong.  Let us know and we can get a bug filed on it :).

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of walgri
Sent: Thursday, October 12, 2006 10:25 AM
To: users at lists.ironpython.com
Subject: [IronPython] Differences between Ironpython and CPython 2.4

Hello,

I have been trying IronPython with the Unum module
(http://home.tiscali.be/be052320/Unum.html) which, in about 400 locs, adds a complete and seamless measure units support to Python.

In Cpython2.4 I can write code like this:

Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> from unum.units.si import *
>>> 1*M
1.000 [m]
>>> 1*N/(2*M**2)
0.500 [N/m2]
>>>

Whereas in Ironpython (both official and community edition) I get the following error:

IronPython 1.0.2463 on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.
>>> from unum.units.si import *
>>> 1*M
1.000 [m]
>>> 1*N/(2*M**2)
Traceback (most recent call last):
  File , line 0, in <stdin>##142
  File C:\tempor\IPCE-1.0r2\IPCE-1.0r2\Lib\unum\__init__.py, line 566,in __repr__
  File C:\tempor\IPCE-1.0r2\IPCE-1.0r2\Lib\unum\__init__.py, line 558,in __str__
  File C:\tempor\IPCE-1.0r2\IPCE-1.0r2\Lib\unum\__init__.py, line 253,in normalize
  File C:\tempor\IPCE-1.0r2\IPCE-1.0r2\Lib\unum\__init__.py, line 213,in replaced
  File C:\tempor\IPCE-1.0r2\IPCE-1.0r2\Lib\unum\__init__.py, line 389,in __pow__
ZeroDivisionError: 0.0 cannot be raised to a negative power
>>>

I can investigate further but need some directions.
I understand that this can be a very specific issue, but any help would be really appreciated.

Best regards,
Walgri
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list