[Updated] D12557: windows: fix stdio with py2exe and py3

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Tue May 10 00:56:02 UTC 2022


mharbison72 added a comment.


  In D12557#193221 <https://phab.mercurial-scm.org/D12557#193221>, @mjacob wrote:
  
  > I’m a bit confused. Shouldn’t it fail already on the line `stdout = _make_write_all(sys.stdout.buffer)` because `sys.stdout` has no attribute `buffer`?
  
  I'm completely baffled.  The change to `_make_write_all(getattr(sys.stderr, 'buffer', sys.stderr))` came from someone else who helped with the initial installer work.  I only applied it after I ran into the exception myself.  I don't see any issue running `thg --nofork` from either the staging area, or from an actual installation.  I'm 99.99% sure that the `--nofork` way was how I was running this in the beginning, because there were so many buried exceptions on startup.
  
  That said, when I run `thgw.exe` with the original `sys.stderr.buffer` line (i.e. a clean copy of hg a932cad26d37 <https://phab.mercurial-scm.org/rHGa932cad26d375823e5b08959550b64155b43a01d>), I get this in `%PROGRAMFILES%\thgw.log` (after running as admin, because it doesn't normally have permission to write a file there):
  
    Traceback (most recent call last):
      File "thg", line 91, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "tortoisehg\hgqt\run.pyc", line 17, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "mercurial\cmdutil.pyc", line 27, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "mercurial\bookmarks.pyc", line 19, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "mercurial\obsutil.pyc", line 16, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "mercurial\diffutil.pyc", line 13, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "mercurial\mdiff.pyc", line 18, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "mercurial\util.pyc", line 54, in <module>
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
      File "<frozen zipimport>", line 259, in load_module
      File "mercurial\utils\procutil.pyc", line 150, in <module>
    AttributeError: 'Blackhole' object has no attribute 'buffer'

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12557/new/

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

To: mharbison72, #hg-reviewers
Cc: mjacob, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220510/c2ccc236/attachment-0001.html>


More information about the Mercurial-patches mailing list