]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1560617: in pyclbr, return full module name not only for classes,
authorGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 11:06:51 +0000 (11:06 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 11:06:51 +0000 (11:06 +0000)
but also for functions.
 (backport from rev. 52069)

Lib/pyclbr.py
Lib/test/test_pyclbr.py
Misc/NEWS

index 0812e22ff4734ccbb4940064b186c2335ea5f314..53e3b96bfd14687b27ddc509be5a47fd7e6aad5f 100644 (file)
@@ -172,7 +172,7 @@ def _readmodule(module, path, inpackage=None):
                     # else it's a nested def
                 else:
                     # it's a function
-                    dict[meth_name] = Function(module, meth_name, file, lineno)
+                    dict[meth_name] = Function(fullmodule, meth_name, file, lineno)
                 stack.append((None, thisindent)) # Marker for nested fns
             elif token == 'class':
                 lineno, thisindent = start
index ceb7a3d17079ff476b47b89cecd169a55f99fbb6..63b04b1f849246a8099e7f6e25ad14547b12b79b 100644 (file)
@@ -93,6 +93,9 @@ class PyclbrTest(TestCase):
             py_item = getattr(module, name)
             if isinstance(value, pyclbr.Function):
                 self.assert_(isinstance(py_item, (FunctionType, BuiltinFunctionType)))
+                if py_item.__module__ != moduleName:
+                    continue   # skip functions that came from somewhere else
+                self.assertEquals(py_item.__module__, value.module)
             else:
                 self.failUnless(isinstance(py_item, (ClassType, type)))
                 real_bases = [base.__name__ for base in py_item.__bases__]
index 07be792bf28e3350b220dff699bf113f8a4ed209..e0f7ec7b6b6bdac1ed8a4ee9f27c16afc0ebe4f4 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -119,6 +119,9 @@ Extension Modules
 Library
 -------
 
+- Bug #1560617: in pyclbr, return full module name not only for classes,
+  but also for functions.
+
 - Bug #1566602: correct failure of posixpath unittest when $HOME ends
   with a slash.