Skip to content

Commit 6ac393e

Browse files
committed
Add changelog entries
1 parent a22201b commit 6ac393e

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
### Changed
9+
10+
- `console.get_windows_console_features` and `console.detect_legacy_windows` now have an optional `file` parameter https://github.com/Textualize/rich/pull/4072
11+
12+
### Fixed
13+
14+
- Fixed the auto-detection of `Console.legacy_windows` for the stderr stream, when stdout is redirected https://github.com/Textualize/rich/pull/4072
15+
- Fixed legacy Windows rendering for the stderr stream https://github.com/Textualize/rich/pull/4072
16+
817
## [14.3.3] - 2026-02-19
918

1019
### Fixed

rich/_win32_console.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
from rich.style import Style
2323

2424
try:
25-
STDOUT_FILENO = sys.__stdout__.fileno() # type: ignore[union-attr]
25+
STDOUT_FILENO = sys.__stdout__.fileno()
2626
except Exception:
2727
STDOUT_FILENO = 1
2828
try:
29-
STDERR_FILENO = sys.__stderr__.fileno() # type: ignore[union-attr]
29+
STDERR_FILENO = sys.__stderr__.fileno()
3030
except Exception:
3131
STDERR_FILENO = 2
3232

rich/_windows.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
from dataclasses import dataclass
3+
from typing import Optional
34

45

56
@dataclass
@@ -33,13 +34,13 @@ class WindowsConsoleFeatures:
3334

3435
except (AttributeError, ImportError, ValueError):
3536
# Fallback if we can't load the Windows DLL
36-
def get_windows_console_features(fileno: int) -> WindowsConsoleFeatures:
37+
def get_windows_console_features(fileno: Optional[int] = None) -> WindowsConsoleFeatures:
3738
features = WindowsConsoleFeatures()
3839
return features
3940

4041
else:
4142

42-
def get_windows_console_features(fileno: int) -> WindowsConsoleFeatures:
43+
def get_windows_console_features(fileno: Optional[int] = None) -> WindowsConsoleFeatures:
4344
"""Get windows console features.
4445
4546
Returns:

rich/console.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,7 @@ def get_windows_console_features(
577577
return _windows_console_features
578578
from ._windows import get_windows_console_features
579579

580-
fileno = None
581-
if file is not None:
582-
fileno = get_fileno(file)
583-
if fileno is None:
584-
fileno = _STDOUT_FILENO
580+
fileno = get_fileno(file) if file is not None else None
585581

586582
_windows_console_features = get_windows_console_features(fileno)
587583
return _windows_console_features

0 commit comments

Comments
 (0)