#18 Allow blacklist to support None module

closed-out-of-date
nobody
None
5
2010-07-06
2005-03-21
No

Along with bugs #1004761 and #1093311, I submitted a
patch that applies the blacklist to the "couldn't find
real module" error message reported for some packages.

Then, in researching bug #524370, I noticed that
sometimes the "couldn't find real module" error reports
a module name of None. This might or might not
represent a bug. Anyway, because the module name is
actually the constant None and not "None", it can't be
blacklisted using the current code.

The following patch makes the changes required to allow
None in the blacklist. It would only make sense to
apply this patch if it turns out that it's really
correct for pychecker to be reporting "couldn't find
real module" errors for the None module.

--- warn.py 10 Feb 2005 02:15:01 -0000 1.142
+++ warn.py 21 Mar 2005 19:43:24 -0000
@@ -371,15 +371,19 @@
def getBlackList(moduleList) :
blacklist = []
for badBoy in moduleList :
- if badBoy[-3:] == ".py":
- badBoy = badBoy[0:-3]
- try :
- file, path, flags = imp.find_module(badBoy)
- if file :
- file.close()
- blacklist.append(normalize_path(path))
- except ImportError :
- pass
+ if badBoy is None:
+ if None not in blacklist:
+ blacklist.append(None)
+ else:
+ if badBoy[-3:] == ".py":
+ badBoy = badBoy[0:-3]
+ try :
+ file, path, flags = imp.find_module(badBoy)
+ if file :
+ file.close()
+ blacklist.append(normalize_path(path))
+ except ImportError :
+ pass
return blacklist

Discussion

  • Kenneth J. Pronovici

    I am withdrawing this patch, because I'm sure it's out-of-date after 5 years, and I don't want to take responsibility for it if it is ever applied.

     
  • Kenneth J. Pronovici

    • status: open --> closed-out-of-date
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks