Re: [Python-Dev] ImportWarning flood
It's up to the release manager now to decide whether the pitchforks at
Google or the pitchforks in the larger Python community are sharper.
;-)
--Guido (ducks)
On 6/30/06, Shane Hathaway
Guido van Rossum wrote:
On 6/30/06, Jean-Paul Calderone
wrote: How about if someone grovels through import.c and figures out how to make the warning information only show up if the import actually fails?
That would work I think. But it's not easy.
I just posted a patch intended to solve this. With my patch, find_module() collects the warnings in a list and only generates ImportWarning if no package is found. It works, but I have not done extensive testing.
I also discovered and tried to resolve what appear to be memory leaks involving the "copy" variable. If the ImportWarning patch doesn't fly, I'll be happy to post a different patch that only fixes the leaks.
The patch is #1515361:
https://sourceforge.net/tracker/index.php?func=detail&aid=1515361&group_id=5470&atid=305470
Shane
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
On Saturday 01 July 2006 12:55, Guido van Rossum wrote:
It's up to the release manager now to decide whether the pitchforks at Google or the pitchforks in the larger Python community are sharper. ;-)
At this point, I think removing the warning code is the prudent
course. If someone wanted to find an easy and safe way to make it
only be triggered when the import fails, it could stay in. I'm not
convinced that _anything_ in import.c is easy and safe. <wink>
Anthony
--
Anthony Baxter
Anthony Baxter wrote:
On Saturday 01 July 2006 12:55, Guido van Rossum wrote:
It's up to the release manager now to decide whether the pitchforks at Google or the pitchforks in the larger Python community are sharper. ;-)
At this point, I think removing the warning code is the prudent course. If someone wanted to find an easy and safe way to make it only be triggered when the import fails, it could stay in.
I created a patch (#1515361) intended to do just that. https://sourceforge.net/tracker/index.php?func=detail&aid=1515361&group_id=5470&atid=305470 Unfortunately, something appears to be misconfigured in my ISP's mail server, and as a result, my messages aren't making it to this list. So you may not have noticed Guido's re-posting of my message announcing the patch. Shane
Guido van Rossum wrote:
It's up to the release manager now to decide whether the pitchforks at Google or the pitchforks in the larger Python community are sharper. ;-)
--Guido (ducks)
I vaguely recall one of the reasons we went with the warning approach was to find out whether or not dropping __init__.py would cause serious problems - I think we have our answer to that question now :) How does this sound for a way forward?: 2.5b2: - ignore ImportWarning by default (like PendingDeprecationWarning) - include in What's New instructions to enable it via the command line or Python code 2.6: - only show ImportWarning if the import ultimately fails - enable ImporWarning by default - consider allowing a .py extension on a directory name as an alternative to an __init__.py file. Google could then change their sitecustomize.py to enable the warning by default when they roll out 2.5 :) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
participants (4)
-
Anthony Baxter
-
Guido van Rossum
-
Nick Coghlan
-
Shane Hathaway