Message103244
Just bitten by this (through a 3rd party library that uses this pattern) and I'm wondering why it was closed as invalid. Passing a non-empty fromlist string also imports the tail module but without the side effect of double import, so it's not generally harmful. More surprisingly, a colleague discovered accidentally that the same behavior happens if you pass one or more slashes: __import__('pkg', fromlist=['', '/', '//']) imports 'pkg', 'pkg.', 'pkg./' and 'pkg.//' !
I'm not arguing that using fromlist to import the tail module is not a hack, but the behavior for empty strings and slashes (and whatever else causes multiple imports) is clearly a bug. Unless someone is actually relying on this double import behavior (very unlikely), I think it should be fixed. |
|
Date |
User |
Action |
Args |
2010-04-15 18:30:31 | gsakkis | set | recipients:
+ gsakkis, brett.cannon, hauser, mrts |
2010-04-15 18:30:30 | gsakkis | set | messageid: <1271356230.96.0.541053900654.issue2090@psf.upfronthosting.co.za> |
2010-04-15 18:30:29 | gsakkis | link | issue2090 messages |
2010-04-15 18:30:29 | gsakkis | create | |
|