[issue2588] A bug in demandimport raises an AttributeError for modules which have already been imported
Anthony Lalande
bugs at mercurial.selenic.com
Tue Jan 11 21:52:33 UTC 2011
New submission from Anthony Lalande <anthony.lalande at gmail.com>:
It seems that there is a divergence between the way demandimport populates
module namespaces, and the way the native __import__ function does.
In short, it is possible to have something like:
import package.foo
and, when one tries to access package.foo later *in the same source file*, get
an error:
AttributeError: 'module' object has no attribute 'foo'
I've put together a very simple test case, which demonstrates the problem. It
is packaged in the form of a Mercurial extension which doesn't implement any
commands. To replicate:
hg --config "extensions.ditest=/path/to/demandimport_test"
I've derived two workarounds (documented within the sample code), but without
getting buried in how CPython implements the __import__ call at a very low
level, I'm not yet sure how to fix...?
Any help would be greatly appreciated!
----------
files: demandimport_test.tgz
messages: 14879
nosy: tonyboy
priority: bug
status: unread
title: A bug in demandimport raises an AttributeError for modules which have already been imported
____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2588>
____________________________________________________
-------------- next part --------------
Ð,M íÝjãFÇÕB)ÕMïÚÛÅ ¤>K/MÈÂBãÒ
¶YÛ³¶5f4×ïÒ7èËô²Ó3²8Ú8 (Yr~¬2ÍsþGg¥Í£4áó
j X¦Æ±m;(Ýnq´]},Ç ÏñÃ0ôÁv/ì4¿Ûä$.å8U®jûa·Ñè#óû¸<~"$·üo
r5Xzs<ûüï^åÿÀõ\ô:®v#w¿îão¾4>7£~9wP¢Û¯ðçâO[EÿýÐ?y×ÿøÇýþ¯Æ¿ÿå¿ñ÷õ.]µ¹-3fõÙuÆ"áé/þÖ?ýîõç»Nøýk¿É]%·õß´úïÕ¿ë:þMýû¡Oúo½£<GC±ô+mÓìt:çóhgc at Y²4ã"% #F¤bM0lP¿¨WXr5ÍpÒæH9Ìs³Y <ÖsfÙÏ\ñÙåB2K¤ìp}¦¢:HÆLsðßïBN#)ò4=§
EÁLDÉþÁí.®îp¹¯»×÷cG³Ùêðê
Dq̲eå|Ç(CXNx<^)ËpðÆ>°×©H)¹ÙT.ÓjÀµÕYzø¹ ÉÖ7çª £9(»¾7âm1̼Án"OáM'
à©Ôg0r=YåÃÞS¶P§ÓT,Ñi³,qf<ÓÃËèûó1Wãr´o¯,¤·3_Á"FÇFfYVaFd!õ"vÏ1Ü)ýËbÅì:¢Jg[åq0ÊÓmbY»ÕDªþjÁzð*Û
W ð¼ôÉGÀ3ñ¥ñºñpÃ=S?Ì.g9ÏØÏÐüx_mûjε7HExo«ÃêTÈp¹ÔM¯]<ªñ<wïì^ûD#Ådæ¹¼þÕå«/wi*¹ZÛ©Ù¦ÑÞ
1Í`Ƨ£²lz»&ûëX:ÆrDv"¥½Ú¡ÐCâèýÝ«nÅxÆ̧Î
/»êÿ*à* ðyØõýê+ ýüï:ôüoÇ«ÿCêÿgÏmý7þ-ôowoêßÒÔÔÿEÕ^ÕÚU~:äØ46ëµÈµ§þÃR&Û¨î®_v6k§¶ÂËåý£×} ¼ýûß O=Ô׳zÿÛ5þoô%Ð}ù¿ò?º=ùßµ}»Kù¿
jüo
F"
Õ xÿï8aá; ç;<^ýÿ£Aõÿ³§Fÿ
ªÿAß×úÇÿÿ»ÿ[¡6ÿ5øýwÛ÷?c
ÿzÿÓÿ
ÊÿÏý7¨þíëÿ
ýû.ÕPÿ/«ÍÄÀCò¿çõ¿k{äÿVx¼üÿÖ üÿì©ÑêXþ/ôï!ÕíPÿâ)êÛëþ·Cò+<^þ?3(ÿ?{êòsêß"ÿ{Ýú÷Côßñ,ʲõÝ}1|ÏbU}ÍÅvú.KAAAAAAñÉð?ÆÏ P
More information about the Mercurial-devel
mailing list