[IronPython] warnings module

Dino Viehland dinov at exchange.microsoft.com
Thu Dec 29 17:24:10 CET 2005

We've actually already made a change for the next release to be fully compatible with the warnings test here.   The wiki is just a little out of date right now.

We've switched the exceptions over to using old-style classes and also improved the interop story between Python exceptions and CLR exceptions.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo
Sent: Thursday, December 29, 2005 1:44 AM
To: users at lists.ironpython.com
Subject: [IronPython] warnings module

I looked at RegressionTests wiki page and saw several mentions of
warnings module not working. As I know this problem from working on
PyPy, I want to inform you.

The problem is this:

$ python
Python 2.4.2 (#2, Nov 20 2005, 17:04:48)
[GCC 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import types
>>> isinstance(Exception, types.ClassType)

$ py.py
PyPy 0.8.0 in StdObjSpace on top of Python 2.4.2 (startuptime: 3.20 secs)
>>>> import types
>>>> isinstance(Exception, types.ClassType)

Now, warnings.py does rather harmful sanity check, checking whether
warnings to be filtered is instance of old-style class. There is no
justification for this, and I think it's up to implementors to decide
whether exceptions are old-style or new-style. PyPy's patched
warnings.py is available from

The only difference is commenting out of two lines where
types.ClassType check appears.

With patched warnings.py, IronPython passes test_warnings, and
warnings module seems to work in general.

Hope this help,
Seo Sanghyeon
users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list