]> granicus.if.org Git - python/commitdiff
Bug #1560617: in pyclbr, return full module name not only for classes,
authorGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 11:06:47 +0000 (11:06 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 30 Sep 2006 11:06:47 +0000 (11:06 +0000)
but also for functions.

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

index 073122417d7b4849e7ad409e231dc86fa70f1d91..079b38c411518d451177587461acb609df5b7276 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 6d7d5ba96ec4387581a2581bdf32077a580afd54..5188bb350269f60f215f82cb3578de77a66a17a9 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)))
                 if py_item.__module__ != moduleName:
index 0c673f42d37f8a479742754019cc66c92fdac0dd..d63ffb28e371f030aac53e4bd6d2ceeba7c985ee 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -63,6 +63,9 @@ Core and builtins
 Library
 -------
 
+- Bug #1560617: in pyclbr, return full module name not only for classes,
+  but also for functions.
+
 - Bug #1457823: cgi.(Sv)FormContentDict's constructor now takes
   keep_blank_values and strict_parsing keyword arguments.