--- /dev/null
+Fix compilation for platforms without :data:`!O_CLOEXEC`. The issue was
+introduced with Python 3.12b1 in :gh:`103295`. Patch by Erlend Aasland.
char filename[100];
pid_t pid = getpid();
// Use nofollow flag to prevent symlink attacks.
- int flags = O_WRONLY | O_CREAT | O_APPEND | O_NOFOLLOW | O_CLOEXEC;
+ int flags = O_WRONLY | O_CREAT | O_APPEND | O_NOFOLLOW;
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
snprintf(filename, sizeof(filename) - 1, "/tmp/perf-%jd.map",
(intmax_t)pid);
int fd = open(filename, flags, 0600);