Skip to content

Commit 07cd680

Browse files
committed
Fix logging errors - underlying buffer has been detached (#3690)
2 parents 917b761 + ff7aee6 commit 07cd680

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

changelog.d/3690.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed logging errors: 'underlying buffer has been detached' (issue #1631).

setuptools/dist.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,19 +1194,11 @@ def handle_display_options(self, option_order):
11941194

11951195
# Print metadata in UTF-8 no matter the platform
11961196
encoding = sys.stdout.encoding
1197-
errors = sys.stdout.errors
1198-
newline = sys.platform != 'win32' and '\n' or None
1199-
line_buffering = sys.stdout.line_buffering
1200-
1201-
sys.stdout = io.TextIOWrapper(
1202-
sys.stdout.detach(), 'utf-8', errors, newline, line_buffering
1203-
)
1197+
sys.stdout.reconfigure(encoding='utf-8')
12041198
try:
12051199
return _Distribution.handle_display_options(self, option_order)
12061200
finally:
1207-
sys.stdout = io.TextIOWrapper(
1208-
sys.stdout.detach(), encoding, errors, newline, line_buffering
1209-
)
1201+
sys.stdout.reconfigure(encoding=encoding)
12101202

12111203
def run_command(self, command):
12121204
self.set_defaults()

0 commit comments

Comments
 (0)