[Python-3000-checkins] r60979 - in python/branches/py3k: Lib/test/test_inspect.py Misc/NEWS Python/ast.c
christian.heimes
python-3000-checkins at python.org
Sat Feb 23 16:01:07 CET 2008
Author: christian.heimes
Date: Sat Feb 23 16:01:06 2008
New Revision: 60979
Modified:
python/branches/py3k/Lib/test/test_inspect.py
python/branches/py3k/Misc/NEWS
python/branches/py3k/Python/ast.c
Log:
Patch from Georg Brandl: Fix co_lineno of decorated function and class objects. If you see an error in test_inspect please delete all pyc files.
Modified: python/branches/py3k/Lib/test/test_inspect.py
==============================================================================
--- python/branches/py3k/Lib/test/test_inspect.py (original)
+++ python/branches/py3k/Lib/test/test_inspect.py Sat Feb 23 16:01:06 2008
@@ -239,7 +239,7 @@
fodderFile = mod2
def test_wrapped_decorator(self):
- self.assertSourceEqual(mod2.wrapped, 16, 17)
+ self.assertSourceEqual(mod2.wrapped, 14, 17)
def test_replacing_decorator(self):
self.assertSourceEqual(mod2.gone, 9, 10)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Sat Feb 23 16:01:06 2008
@@ -363,6 +363,8 @@
Library
-------
+- inspect.getsource() includes the decorators again.
+
- Issue #1916. Added isgenerator() and isgeneratorfunction() to inspect.py.
- #1224: Fixed bad url parsing when path begins with double slash.
Modified: python/branches/py3k/Python/ast.c
==============================================================================
--- python/branches/py3k/Python/ast.c (original)
+++ python/branches/py3k/Python/ast.c Sat Feb 23 16:01:06 2008
@@ -1015,6 +1015,12 @@
} else if (TYPE(CHILD(n, 1)) == classdef) {
thing = ast_for_classdef(c, CHILD(n, 1), decorator_seq);
}
+ /* we count the decorators in when talking about the class' or
+ * function's line number */
+ if (thing) {
+ thing->lineno = LINENO(n);
+ thing->col_offset = n->n_col_offset;
+ }
return thing;
}
More information about the Python-3000-checkins
mailing list