mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Fix SF bug #1458903 with AST compiler.
def foo((x)): was getting recognized as requiring tuple unpacking which is not correct. Add tests for this case and the proper way to unpack a tuple of one: def foo((x,)): test_inpsect was incorrect before. I'm not sure why it was passing, but that has been corrected with a test for both functions above. This means the test (and therefore inspect.getargspec()) are broken in 2.4.
This commit is contained in:
parent
6c40359795
commit
33b730e33c
3 changed files with 19 additions and 6 deletions
|
@ -304,10 +304,12 @@ class TestClassesAndFunctions(unittest.TestCase):
|
|||
self.assertArgSpecEquals(A.m, ['self'])
|
||||
|
||||
def test_getargspec_sublistofone(self):
|
||||
def sublistOfOne((foo)): return 1
|
||||
|
||||
def sublistOfOne((foo,)): return 1
|
||||
self.assertArgSpecEquals(sublistOfOne, [['foo']])
|
||||
|
||||
def fakeSublistOfOne((foo)): return 1
|
||||
self.assertArgSpecEquals(fakeSublistOfOne, ['foo'])
|
||||
|
||||
def test_classify_oldstyle(self):
|
||||
class A:
|
||||
def s(): pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue