Commits

Philip Jenvey  committed 45cb84f

we must flush this stream now as streamio's buffering may not have

  • Participants
  • Parent commits 7668e24
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/module/imp/interp_imp.py

             top = stream.readline()
             top += stream.readline()
             stream.seek(0, 0) # reset position
+            stream.flush()
             encoding = pyparse._check_for_encoding(top)
             if encoding is None:
                 encoding = unicodetype.getdefaultencoding(space)

File pypy/module/imp/test/test_import.py

         import encoded
         fd = imp.find_module('line2', encoded.__path__)[0]
         assert fd.encoding == 'iso-8859-1'
+        assert fd.tell() == 0
 
     def test_bad_source_encoding(self):
         import imp