e2e22e3d7e
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__.
17 lines
250 B
Python
17 lines
250 B
Python
# 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
|