New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-43414: os.get_terminal_size() should use file descriptors in Windows #93203
Conversation
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
It would be nice to add a test in @unittest.skipUnless(sys.platform == 'win32', 'Windows specific test')
def test_windows_fd(self):
# gh-87580: support arbitrary file descriptors
try:
conout = open('conout$', 'w')
except OSError:
self.skipTest('failed to open conout$')
with conout:
size = os.get_terminal_size(conout.fileno())
self.assertGreaterEqual(size.columns, 0)
self.assertGreaterEqual(size.lines, 0) |
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Modified
os.get_terminal_size()
to use_get_osfhandle(fd)
instead of using hardcoded process standard handles in Windows.Fixes 43414