Message3632
I have noticed differences in __import__ call arguments between Jython
and CPython. See below what module 'name' and 'fromlist' arguments are
when several import statements are used. CPython is used as the reference.
$ jython test.py
--------------------------------------------------
statement: import hell.first_circle
- expected: ('hell.first_circle', None)
- got: ('hell.first_circle', ())
--------------------------------------------------
statement: import hell.first_circle as limbo
- expected: ('hell.first_circle', None)
- got: ('hell.first_circle', ('*',))
--------------------------------------------------
statement: from hell.ninth_circle import *
- expected: ('hell.ninth_circle', ('*',))
- got: ('hell.ninth_circle', ('*',))
--------------------------------------------------
statement: from hell.ninth_circle import antaeus
- expected: ('hell.ninth_circle', ('antaeus',))
- got: ('hell.ninth_circle', ('antaeus',))
--------------------------------------------------
statement: from hell.ninth_circle import antaeus as giant
- expected: ('hell.ninth_circle', ('antaeus',))
- got: ('hell.ninth_circle', ('antaeus',))
*** FAILURE: 2 errors ***
The first failure is minor: () is used instead of None to denote an
empty fromlist.
The second one is a bigger problem IMHO: it sends the wrong signal that
all symbols from hell.first_circle should be imported when only the
module is searched for. While this is not an issue with the standard
__builtin__.__import__ function, it may be a pain when __import__ is
overriden -- that's how I discovered the issue in the first place. I've
produced a modified imp.java file that should address this second issue
(but not the first, empty tuples are still used, so there are still 2
errors even with the patch), see attached diff.txt |
|
Date |
User |
Action |
Args |
2008-10-01 13:13:33 | boisgera | set | recipients:
+ boisgera |
2008-10-01 13:13:33 | boisgera | set | messageid: <1222866813.53.0.199933469401.issue1141@psf.upfronthosting.co.za> |
2008-10-01 13:13:33 | boisgera | link | issue1141 messages |
2008-10-01 13:13:32 | boisgera | create | |
|