mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Allow decorators and return annotations to be used together (fixes SF#1697248)
This commit is contained in:
parent
4138bfec0a
commit
71011e2c2b
2 changed files with 7 additions and 2 deletions
|
@ -322,7 +322,12 @@ class GrammarTests(unittest.TestCase):
|
|||
self.assertEquals(f.__annotations__,
|
||||
{'b': 1, 'c': 2, 'e': 3, 'g': 6, 'h': 7, 'j': 9,
|
||||
'k': 11, 'return': 12})
|
||||
|
||||
# Check for SF Bug #1697248 - mixing decorators and a return annotation
|
||||
def null(x): return x
|
||||
@null
|
||||
def f(x) -> list: pass
|
||||
self.assertEquals(f.__annotations__, {'return': list})
|
||||
|
||||
# test MAKE_CLOSURE with a variety of oparg's
|
||||
closure = 1
|
||||
def f(): return closure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue