Repository navigation
Building 'Modules/_cursesmodule.c' for Win32 #154587
Copy link
Copy link
Closed
Labels
OS-windowsextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Compiling Modules/_cursesmodule.c using clang-cl reveals a stupid bug here:
cpython/Modules/_cursesmodule.c
Lines 1958 to 1963 in eef2349
| #if defined(MS_WINDOWS) | |
| char *buffer[100]; | |
| UINT cp; | |
| cp = GetConsoleOutputCP(); | |
| if (cp != 0) { | |
| PyOS_snprintf(buffer, sizeof(buffer), "cp%u", cp); |
and consequently a compile-error:
Modules/_cursesmodule.c(1963,27): error: incompatible pointer types passing 'char *[100]' to parameter of type 'char *'
[-Wincompatible-pointer-types]
1963 | PyOS_snprintf(buffer, sizeof(buffer), "cp%u", cp);
| ^~~~~~
./Include\pyerrors.h(324,37): note: passing argument to parameter 'str' here
324 | PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
| ^Surely it should be:
--- a/Modules/_cursesmodule.c 2026-07-23 18:30:17
+++ b/Modules/_cursesmodule.c 2026-07-24 11:06:43
@@ -1956,7 +1956,7 @@
{
if (encoding == NULL) {
#if defined(MS_WINDOWS)
- char *buffer[100];
+ char buffer[100];
UINT cp;
cp = GetConsoleOutputCP();
if (cp != 0) {I tried to build with this Curses port: https://github.com/Bill-Gray/PDCursesMod.git
but eventually gave up on all the missing functions.
Apart from a pip install windows-curses, it seems it would be a major task to get
_curses*.pyd to link and work on Windows (from a git-build).
Any pointers?
Linked PRs
- gh-154587: Fix Windows buffer declaration in _cursesmodule #154609
- [3.15] gh-154587: Fix Windows buffer declaration in _cursesmodule (GH-154609) #154931
- [3.14] gh-154587: Fix Windows buffer declaration in _cursesmodule (GH-154609) #154932
- [3.13] gh-154587: Fix Windows buffer declaration in _cursesmodule (GH-154609) #154933
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OS-windowsextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
gvanem commentedon Jul 24, 2026
Edit: strike the above, apart from the compile-error, it was dead easy after I figured out the missing
-DHAVE_x.gh-154587: Fix Windows buffer declaration in _cursesmodule (GH-154609)
serhiy-storchaka commentedon Jul 30, 2026
FYI, last few week I worked on adding support of
curseson Windows. It included the identical fix. Will publish the results soon.[3.13] gh-154587: Fix Windows buffer declaration in _cursesmodule (GH…
[3.14] gh-154587: Fix Windows buffer declaration in _cursesmodule (GH…
[3.15] gh-154587: Fix Windows buffer declaration in _cursesmodule (GH…
pythongh-154587: Fix Windows buffer declaration in _cursesmodule (pyt…