[IronPython] Bug: module ImportError exception not being raised

Dino Viehland dinov at exchange.microsoft.com
Wed Apr 12 00:49:40 CEST 2006


I've just got around to looking at this, and the repro isn't working for me on beta 5.  I've created a.py and b.py:

a.py:
from b import BClass

class AClass:
    pass

b.py:
from a import AClass

class BClass:
    pass


and then I get:

IronPython 1.0.2280 (Beta) on .NET 2.0.50727.32
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import a
Traceback (most recent call last):
  File , line 0, in input##0
  File , line 0, in __import__##4
  File F:\Product\IronPython\IronPython\Experimental\a.py, line 1, in Initialize
  File , line 0, in __import__##4
  File F:\Product\IronPython\IronPython\Experimental\b.py, line 1, in Initialize
ImportError: cannot import AClass from a

And ditto for import b:

IronPython 1.0.2291 (Beta) on .NET 2.0.50727.32
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import b
Traceback (most recent call last):
  File , line 0, in input##0
  File , line 0, in __import__##4
  File F:\Product\IronPython\IronPython\Experimental\b.py, line 1, in Initialize
  File , line 0, in __import__##4
  File F:\Product\IronPython\IronPython\Experimental\a.py, line 1, in Initialize
ImportError: cannot import BClass from b


I'm wondering if this could be a Mono specific bug.  Could you try one thing and give me the result, start IronPythonConsole.exe w/ -X:ExceptionDetail command line option.

Then after you start spinning hit Ctrl-C ?  That should give you a nice full stack trace of where we were when we were spinning, and if we're lucky we can deduce what's going on from that.



Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Anthony Tarlano
Sent: Thursday, April 06, 2006 1:59 PM
To: Discussion of IronPython
Subject: [IronPython] Bug: module ImportError exception not being raised

Hi,

I found that IronPython Beta 5 is not raising ImportError and just
going into a livelock loop when there is a circular import between two
modules.

Here is the test case where you'll see CPython returning an
ImportError exception and IronPython spining

DELL# ls
a.py  b.py
DELL# cat a.py
from b import BClass

class AClass:
    pass
DELL# cat b.py
from a import AClass

class BClass:
    pass
DELL# python a.py
Traceback (most recent call last):
  File "a.py", line 1, in ?
    from b import BClass
  File "c:\usr\home\tony\ipbug\b.py", line 1, in ?
    from a import AClass
  File "c:\usr\home\tony\ipbug\a.py", line 1, in ?
    from b import BClass
ImportError: cannot import name BClass
DELL# IronPythonConsole a.py          <----------- This command
livelocks and never returns


Regards,

Anthony
_______________________________________________
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