mirror of
https://github.com/W3SLAV/micropython.git
synced 2025-06-21 21:15:35 -04:00

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
|