Skip to content

Commit ccb0df5

Browse files
evhubclaude
andcommitted
Fix lazy module __setattr__ NameError on Python 2.7
Bypass lazy proxy's custom __setattr__ when setting asyncio.coroutine during _coconut class body, since _coconut is not yet defined. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8d75dd7 commit ccb0df5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

coconut/compiler/header.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ def _coconut_trollius_coroutine(func):
772772
def raise_import_error(*args, **kwargs):
773773
raise err
774774
return raise_import_error
775-
asyncio.coroutine = _coconut_trollius_coroutine
775+
types.ModuleType.__setattr__(asyncio, "coroutine", _coconut_trollius_coroutine)
776776
asyncio_Return = _coconut_lazy_module("trollius", attr="Return")
777777
''',
778778
if_ge='''

0 commit comments

Comments
 (0)