Mercurial > hg
view CONTRIBUTING @ 48951:cf99c4af1079
chgserver: remove Python 2 file descriptor logic
Follows up 0bb28b7736bc "chgserver: remove Python 2 support code."
On Python 2, we had to close newfp prior to restoring the original file
description since "delete newfp" would otherwise close the file descriptor
shared with the long-lived fp:
in attachio():
newfp = os.fdopen(fp.fileno(), mode, bufsize)
in _restoreio():
newfp.close() # temporarily close newfp.fileno() (= fp.fileno())
os.dup2(fd, fp.fileno()) # reopen fp.fileno() with original fd
On the other hand, we shouldn't call newfp.close() on Python 3 since
any function calls are proxied to the underlying file object by
procutil.LineBufferedWrapper.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 04 Mar 2022 10:28:46 +0900 |
parents | a492610a2fc1 |
children |
line wrap: on
line source
Our full contribution guidelines are in our wiki, please see: https://www.mercurial-scm.org/wiki/ContributingChanges If you just want a checklist to follow, you can go straight to https://www.mercurial-scm.org/wiki/ContributingChanges#Submission_checklist If you can't run the entire testsuite for some reason (it can be difficult on Windows), please at least run `contrib/check-code.py` on any files you've modified and run `python contrib/check-commit` on any commits you've made (for example, `python contrib/check-commit 273ce12ad8f1` will report some style violations on a very old commit).