# HG changeset patch # User Paul Boddie # Date 1479247078 -3600 # Node ID 28821b7f0b00011af68f6343d6b463355f7188f8 # Parent 2ce83f67d8d330c17f814c193116efe97f9c8b3b Import stdout into the local namespace to avoid module import scheduling issues. diff -r 2ce83f67d8d3 -r 28821b7f0b00 lib/__builtins__/io.py --- a/lib/__builtins__/io.py Tue Nov 15 22:55:57 2016 +0100 +++ b/lib/__builtins__/io.py Tue Nov 15 22:57:58 2016 +0100 @@ -20,7 +20,6 @@ """ from native import _read, _write -from sys import stdout class sysfile: @@ -62,6 +61,12 @@ 'nl' is given as a true value. """ + # Import locally to ensure that the object is initialised. + # Otherwise, if imported at the module level, the sys module may not have + # been set up. + + from sys import stdout + # Write to standard output if dest is not specified. dest = dest or stdout