summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-09-30 11:06:55 (GMT)
committerGeorg Brandl <georg@python.org>2006-09-30 11:06:55 (GMT)
commit7037745be72691f7d956a5873a4e925b8485c9a9 (patch)
tree4fcc3876becfaafd446a1d8f9ada36349756e0ab
parent9c9a9ab6340eb2225f57fbef6d6cf9e3da547142 (diff)
downloadcpython-7037745be72691f7d956a5873a4e925b8485c9a9.zip
cpython-7037745be72691f7d956a5873a4e925b8485c9a9.tar.gz
cpython-7037745be72691f7d956a5873a4e925b8485c9a9.tar.bz2
Bug #1560617: in pyclbr, return full module name not only for classes,
but also for functions. (backport from rev. 52069)
-rw-r--r--Lib/pyclbr.py2
-rw-r--r--Lib/test/test_pyclbr.py3
-rw-r--r--Misc/NEWS3
3 files changed, 7 insertions, 1 deletions
diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py
index 0731224..079b38c 100644
--- a/Lib/pyclbr.py
+++ b/Lib/pyclbr.py
@@ -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
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 6d7d5ba..5188bb3 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -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:
diff --git a/Misc/NEWS b/Misc/NEWS
index 56e0e2b..e8a3b08 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -41,6 +41,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.