summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-08-22 14:28:20 (GMT)
committerGitHub <noreply@github.com>2023-08-22 14:28:20 (GMT)
commit6541fe4ad7b96ab96ee5c596b60814a93346dd27 (patch)
tree1ee22f64291b37e7a1b04bcdfcf37f3dc5f18404 /Python
parenta541e01537cc07b326cc37cc29412b816bc2b4fc (diff)
downloadcpython-6541fe4ad7b96ab96ee5c596b60814a93346dd27.zip
cpython-6541fe4ad7b96ab96ee5c596b60814a93346dd27.tar.gz
cpython-6541fe4ad7b96ab96ee5c596b60814a93346dd27.tar.bz2
Ignore _Py_write_noraise() result: cast to (void) (#108291)
Code using _Py_write_noraise() usually cannot report. Ignore errors is the least surprising behavior for users.
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c2
-rw-r--r--Python/traceback.c10
-rw-r--r--Python/tracemalloc.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 263ead3..9837e0f 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -57,7 +57,7 @@
# undef BYTE
#endif
-#define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str))
+#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, (int)strlen(str))
#ifdef __cplusplus
diff --git a/Python/traceback.c b/Python/traceback.c
index bddb876..61ace38 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -25,7 +25,7 @@
#define OFF(x) offsetof(PyTracebackObject, x)
-#define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str))
+#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, (int)strlen(str))
#define MAX_STRING_LENGTH 500
#define MAX_FRAME_DEPTH 100
#define MAX_NTHREADS 100
@@ -1047,7 +1047,7 @@ _Py_DumpDecimal(int fd, size_t value)
value /= 10;
} while (value);
- _Py_write_noraise(fd, ptr, end - ptr);
+ (void)_Py_write_noraise(fd, ptr, end - ptr);
}
/* Format an integer as hexadecimal with width digits into fd file descriptor.
@@ -1072,7 +1072,7 @@ _Py_DumpHexadecimal(int fd, uintptr_t value, Py_ssize_t width)
value >>= 4;
} while ((end - ptr) < width || value);
- _Py_write_noraise(fd, ptr, end - ptr);
+ (void)_Py_write_noraise(fd, ptr, end - ptr);
}
void
@@ -1125,7 +1125,7 @@ _Py_DumpASCII(int fd, PyObject *text)
}
if (!need_escape) {
// The string can be written with a single write() syscall
- _Py_write_noraise(fd, str, size);
+ (void)_Py_write_noraise(fd, str, size);
goto done;
}
}
@@ -1135,7 +1135,7 @@ _Py_DumpASCII(int fd, PyObject *text)
if (' ' <= ch && ch <= 126) {
/* printable ASCII character */
char c = (char)ch;
- _Py_write_noraise(fd, &c, 1);
+ (void)_Py_write_noraise(fd, &c, 1);
}
else if (ch <= 0xff) {
PUTS(fd, "\\x");
diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c
index f8ad939..7d294ea 100644
--- a/Python/tracemalloc.c
+++ b/Python/tracemalloc.c
@@ -1247,7 +1247,7 @@ tracemalloc_get_traceback(unsigned int domain, uintptr_t ptr)
}
-#define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str))
+#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, (int)strlen(str))
static void
_PyMem_DumpFrame(int fd, frame_t * frame)