D5018: py3: flush stdout

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Oct 12 17:25:55 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This avoids buffering due to mixed print() and sys.stdout.write() by
  profiling code.
  
  And with this, test-profile.t passes on Python 3 \o/.
  
  Honestly, I'd be shocked if there weren't more Python 3 encoding issues lingering
  in the profiling code. That code isn't super high quality and doesn't seem to have
  thorough test coverage.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5018

AFFECTED FILES
  tests/test-profile.t

CHANGE DETAILS

diff --git a/tests/test-profile.t b/tests/test-profile.t
--- a/tests/test-profile.t
+++ b/tests/test-profile.t
@@ -117,11 +117,14 @@
   $ cat > fooprof.py <<EOF
   > from __future__ import absolute_import
   > import contextlib
+  > import sys
   > @contextlib.contextmanager
   > def profile(ui, fp):
   >     print('fooprof: start profile')
+  >     sys.stdout.flush()
   >     yield
   >     print('fooprof: end profile')
+  >     sys.stdout.flush()
   > def extsetup(ui):
   >     ui.write(b'fooprof: loaded\n')
   > EOF



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list