[Python-checkins] r52070 - in python/branches/release24-maint: Lib/pyclbr.py Lib/test/test_pyclbr.py Misc/NEWS

georg.brandl python-checkins at python.org
Sat Sep 30 13:06:52 CEST 2006


Author: georg.brandl
Date: Sat Sep 30 13:06:51 2006
New Revision: 52070

Modified:
   python/branches/release24-maint/Lib/pyclbr.py
   python/branches/release24-maint/Lib/test/test_pyclbr.py
   python/branches/release24-maint/Misc/NEWS
Log:
Bug #1560617: in pyclbr, return full module name not only for classes,
but also for functions.
 (backport from rev. 52069)

Modified: python/branches/release24-maint/Lib/pyclbr.py
==============================================================================
--- python/branches/release24-maint/Lib/pyclbr.py	(original)
+++ python/branches/release24-maint/Lib/pyclbr.py	Sat Sep 30 13:06:51 2006
@@ -172,7 +172,7 @@
                     # 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

Modified: python/branches/release24-maint/Lib/test/test_pyclbr.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_pyclbr.py	(original)
+++ python/branches/release24-maint/Lib/test/test_pyclbr.py	Sat Sep 30 13:06:51 2006
@@ -93,6 +93,9 @@
             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__]

Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Sat Sep 30 13:06:51 2006
@@ -119,6 +119,9 @@
 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.
 


More information about the Python-checkins mailing list