← Back to team overview

divmod-dev team mailing list archive

[Merge] lp:~divmod-dev/divmod.org/windowserror-builtin into lp:divmod.org

 

Jean-Paul Calderone has proposed merging lp:~divmod-dev/divmod.org/windowserror-builtin into lp:divmod.org.

Requested reviews:
  Divmod-dev (divmod-dev)
Related bugs:
  Bug #764627 in pocket-lint: "pyflakes complains about missing WindowsError on Unix"
  https://bugs.launchpad.net/pocket-lint/+bug/764627

For more details, see:
https://code.launchpad.net/~divmod-dev/divmod.org/windowserror-builtin/+merge/84407

Change WindowsError to be treated as one of the magic builtins, so it is never warned as an undefined name.

-- 
https://code.launchpad.net/~divmod-dev/divmod.org/windowserror-builtin/+merge/84407
Your team Divmod-dev is requested to review the proposed merge of lp:~divmod-dev/divmod.org/windowserror-builtin into lp:divmod.org.
=== modified file 'Pyflakes/pyflakes/checker.py'
--- Pyflakes/pyflakes/checker.py	2011-11-17 16:21:58 +0000
+++ Pyflakes/pyflakes/checker.py	2011-12-04 20:47:24 +0000
@@ -174,7 +174,7 @@
 
 
 # Globally defined names which are not attributes of the __builtin__ module.
-_MAGIC_GLOBALS = ['__file__', '__builtins__']
+_MAGIC_GLOBALS = ['__file__', '__builtins__', 'WindowsError']
 
 
 

=== modified file 'Pyflakes/pyflakes/test/test_undefined_names.py'
--- Pyflakes/pyflakes/test/test_undefined_names.py	2010-04-13 14:53:04 +0000
+++ Pyflakes/pyflakes/test/test_undefined_names.py	2011-12-04 20:47:24 +0000
@@ -27,6 +27,14 @@
         self.flakes('range(10)')
 
 
+    def test_builtinWindowsError(self):
+        """
+        C{WindowsError} is sometimes a builtin name, so no warning is emitted
+        for using it.
+        """
+        self.flakes('WindowsError')
+
+
     def test_magicGlobalsFile(self):
         """
         Use of the C{__file__} magic global should not emit an undefined name


Follow ups