Browse Source
With the recent change b488a4a848
, a
generating function now has the same layout in memory as a normal bytecode
function, and so can reuse the latter's attribute accessor code to
implement __name__.
pull/3937/head
Damien George
6 years ago
5 changed files with 24 additions and 3 deletions
@ -0,0 +1,16 @@ |
|||
# test __name__ on generator functions |
|||
|
|||
def Fun(): |
|||
yield |
|||
|
|||
class A: |
|||
def Fun(self): |
|||
yield |
|||
|
|||
try: |
|||
print(Fun.__name__) |
|||
print(A.Fun.__name__) |
|||
print(A().Fun.__name__) |
|||
except AttributeError: |
|||
print('SKIP') |
|||
raise SystemExit |
Loading…
Reference in new issue