Skip to content

Commit 5e66ad4

Browse files
committed
Fix _io.py initialization in wasm
1 parent 112eea1 commit 5e66ad4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vm/Lib/python_builtins/_io.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ def __init__(self, module):
77
self.__module = module
88
def __getattr__(self, attr):
99
raise RuntimeError(f"the {self.__module!r} module isn't available")
10+
def __bool__(self):
11+
return False
1012

1113
import sys
1214
try:
@@ -39,7 +41,7 @@ def __getattr__(self, attr):
3941
SEEK_END = 2
4042

4143
valid_seek_flags = {0, 1, 2} # Hardwired values
42-
if hasattr(os, 'SEEK_HOLE') :
44+
if os and hasattr(os, 'SEEK_HOLE') :
4345
valid_seek_flags.add(os.SEEK_HOLE)
4446
valid_seek_flags.add(os.SEEK_DATA)
4547

0 commit comments

Comments
 (0)