Skip to content

Commit 7e242c9

Browse files
committed
Minor fixes to is_awaitable (handle async bound methods). Updated to latest PyScript.
1 parent 4f6aa2d commit 7e242c9

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<meta name="viewport" content="width=device-width,initial-scale=1.0">
1010

1111
<!-- PyScript CSS -->
12-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.8.2/core.css">
12+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
1313

1414
<!-- This script tag bootstraps PyScript -->
15-
<script type="module" src="https://pyscript.net/releases/2024.8.2/core.js"></script>
15+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
1616
<style>
1717
body {
1818
font-family: sans-serif;

index2.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<meta name="viewport" content="width=device-width,initial-scale=1.0">
1010

1111
<!-- PyScript CSS -->
12-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.8.2/core.css">
12+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
1313

1414
<!-- This script tag bootstraps PyScript -->
15-
<script type="module" src="https://pyscript.net/releases/2024.8.2/core.js"></script>
15+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
1616
<style>
1717
body {
1818
font-family: sans-serif;

upytest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ def is_awaitable(obj):
8080
if is_micropython:
8181
# MicroPython doesn't appear to have a way to determine if a closure is
8282
# an async function except via the repr. This is a bit hacky.
83-
if "<closure <generator>" in repr(obj):
83+
r = repr(obj)
84+
if "<closure <generator>" in r:
8485
return True
86+
# Same applies to bound methods.
87+
if "<bound_method" in r and "<generator>" in r:
88+
return True
8589
return inspect.isgeneratorfunction(obj)
8690

8791
return inspect.iscoroutinefunction(obj)

0 commit comments

Comments
 (0)