Skip to content

Commit ae133ef

Browse files
authored
Merge pull request #148 from Distributive-Network/Xmader/fix/stdio-class-method
fix: stdio.write may be monkeypatched at runtime to be a class method
2 parents 19f04e5 + 932b441 commit ae133ef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/pythonmonkey/require.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@
5959
globalThis.python.pythonMonkey.isCompilableUnit = pm.isCompilableUnit
6060
globalThis.python.pythonMonkey.nodeModules = node_modules
6161
globalThis.python.print = print
62-
globalThis.python.stdout.write = sys.stdout.write
63-
globalThis.python.stderr.write = sys.stderr.write
64-
globalThis.python.stdout.read = sys.stdout.read
65-
globalThis.python.stderr.read = sys.stderr.read
62+
globalThis.python.stdout.write = lambda s: sys.stdout.write(s)
63+
globalThis.python.stderr.write = lambda s: sys.stderr.write(s)
64+
globalThis.python.stdout.read = lambda n: sys.stdout.read(n)
65+
globalThis.python.stderr.read = lambda n: sys.stderr.read(n)
6666
globalThis.python.eval = eval
6767
globalThis.python.exec = exec
6868
globalThis.python.getenv = os.getenv

0 commit comments

Comments
 (0)