From c768b68340f73b69c00d1c5c1bf289e2c9f2a136 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 22 Oct 2010 09:40:03 +0200 Subject: [PATCH] #544: Allow ``.pyw`` as a source file extension. --- CHANGES | 2 ++ sphinx/ext/autodoc.py | 2 +- sphinx/util/__init__.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 9a03a384b..f0e6759fa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 1.0.4 (Sep 17, 2010) ============================ +* #544: Allow ``.pyw`` as a source file extension. + * #524: Open intersphinx inventories in binary mode on Windows, since version 2 contains zlib-compressed data. diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index adf08bcde..55253e8ab 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -659,7 +659,7 @@ class Documenter(object): # parse right now, to get PycodeErrors on parsing (results will # be cached anyway) self.analyzer.find_attr_docs() - except PycodeError, err: + except PycodeError: # no source file -- e.g. for builtin and C modules self.analyzer = None # at least add the module.__file__ as a dependency diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index ed27fe640..ccb18e2bf 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -204,7 +204,7 @@ def get_module_source(modname): lfilename = filename.lower() if lfilename.endswith('.pyo') or lfilename.endswith('.pyc'): filename = filename[:-1] - elif not lfilename.endswith('.py'): + elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')): raise PycodeError('source is not a .py file: %r' % filename) if not path.isfile(filename): raise PycodeError('source file is not present: %r' % filename)