Ok, I've confirmed the repro works in B3 but is broken in B4. Indeed it looks like we're just more compatible w/ CPython than we were before. I'm going to go ahead and close the bug.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dino Viehland Sent: Tuesday, September 09, 2008 8:10 PM To: Discussion of IronPython Subject: Re: [IronPython] Regression with importing in pre b5 Well I guess it's not legal because CPython isn't allowing it :) But more interestingly after consulting http://www.python.org/doc/essays/packages.html I think it's because "from foo import bar" results in foo being searched in two locations. First is the containing modules __path__ list. 2nd is the normal module lookup process which enumerates sys.path and wouldn't know to prepend the test package when doing the search. So in this case from galaxy_map import GalaxyMap should work and find the templates local GalaxyMap because __path__ will be consulted first. Also from test.templates.galaxy_map - not to mention your relative imports solution. I actually failed to try this in b3 to see if it'll work but maybe it does. I'll check that but it's starting to sound like the import rules just got more correct w/ some other bug fix. But if you can find a repro that works in CPython but not IronPython I would definitely be interested. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Eloff Sent: Tuesday, September 09, 2008 7:08 PM To: Discussion of IronPython Subject: Re: [IronPython] Regression with importing in pre b5 I tried to reproduce it and failed. I went back in time in the svn to look at the original code that triggers it, and it uses the importing format you use here. As you point out this won't run under IronPython or CPython. Granted it fails spectacularly under IronPython, but maybe that failure can be reproduced in CPython as well. I don't know as I have been unable to reproduce it so far outside of the original environment. Parent "test" package has a file called galaxy_map that contains a class GalaxyMap as well, which is imported by interface after "from test import templates" But I tried that in your test setup below and I got nothing but the same simple failure. Bottom line, is "from subpkg import foo" illegal? It's not a regression if it shouldn't have worked in b3 anyway. I'm sure you'd agree that your time is better spent on fixing things that should work. But if "from subpkg import foo" is allowable in some cases, then it may be worth fixing this bug. I'm willing to put in the effort required to make a reproduction if you still want to fix this, just let me know. -Dan On Tue, Sep 9, 2008 at 6:53 PM, Dino Viehland <[EMAIL PROTECTED]> wrote: > Do you have more info on this one? I've setup a package structure like: > > test\ > __init__.py: > print 'test.__init__' > import interface > interface.py: > print 'test.interface' > import templates > templates\ > __init__.py: > print 'test.templates.__init__' > from templates.galaxy_map import GalaxyMap > # passes if I remove templates. > galaxy_map.py: > print 'test.templates.galaxy_map' > class GalaxyMap: pass > > > this fails on both CPython & IronPython because of "from templates.galaxy_map > import GalaxyMap" but it doesn't do the import twice behavior you were > seeing. It also passes if I change from templates.galaxy_map ... to just > from galaxy_map ... so I'm guessing I haven't setup the repro 100% > accurately. Can you point me at what I'm doing wrong? Maybe there's another > package somewhere that collides with one of these names or something else > strange? > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Eloff > Sent: Friday, September 05, 2008 11:04 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Regression with importing in pre b5 > > On Sat, Sep 6, 2008 at 12:04 AM, Curt Hagenlocher <[EMAIL PROTECTED]> wrote: >> On Fri, Sep 5, 2008 at 5:16 PM, Dan Eloff <[EMAIL PROTECTED]> wrote: >>> I'm going to make a lot of work for you guys before the day is out :) >>> Maybe I should be posting these to the Issue Tracker? I'm just >>> concerned they will get lost in the noise. >> >> Absolutely. Any problems you find *please* enter them as bugs into Codeplex! >> > > Be careful what you wish for :) > > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=18346 > > -Dan > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com