Files
MINGW-packages/mingw-w64-python/0140-fixup-cygpty-isatty.patch
2022-06-10 17:54:24 +02:00

46 lines
1.4 KiB
Diff

From cce2e52c843842a89d945e406ef651a530a33b1d Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Fri, 27 May 2022 20:51:59 +0530
Subject: [PATCH 140/N] fixup! cygpty isatty
---
Python/fileutils.c | 4 ++--
Python/pylifecycle.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Python/fileutils.c b/Python/fileutils.c
index cab07a7..45598c2 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -1786,12 +1786,12 @@ _Py_write_impl(int fd, const void *buf, size_t count, int gil_held)
depending on heap usage). */
if (gil_held) {
Py_BEGIN_ALLOW_THREADS
- if (isatty(fd)) {
+ if (isatty(fd) || is_cygpty(fd)) {
count = 32767;
}
Py_END_ALLOW_THREADS
} else {
- if (isatty(fd)) {
+ if (isatty(fd) || is_cygpty(fd)) {
count = 32767;
}
}
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 916e6d7..6605621 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2886,7 +2886,7 @@ Py_FdIsInteractive(FILE *fp, const char *filename)
int
_Py_FdIsInteractive(FILE *fp, PyObject *filename)
{
- if (isatty((int)fileno(fp))) {
+ if (isatty((int)fileno(fp)) || is_cygpty((int)fileno(fp))) {
return 1;
}
if (!Py_InteractiveFlag) {
--
2.36.1