Skip to content

BUG: Use Windows intsafe only for MSVC#65708

Open
dragon-archer wants to merge 2 commits into
pandas-dev:mainfrom
dragon-archer:patch-1
Open

BUG: Use Windows intsafe only for MSVC#65708
dragon-archer wants to merge 2 commits into
pandas-dev:mainfrom
dragon-archer:patch-1

Conversation

@dragon-archer

Copy link
Copy Markdown

When compiling with MSYS2, intsafe.h will indirectly include wingdi.h, in which #define ERROR 0, causing compiling error for typedef enum { ERROR, WARN, SKIP } BadLineHandleMethod;

Also, all MSYS2 compilers (GCC/Clang) supports __builtin_add_overflow, so it's safe to use these builtins.

Detailed error:

FAILED: [code=1] pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj
"gcc" "-Ipandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p" "-Ipandas/_libs/tslibs" "-I../pandas/_libs/tslibs" "-I../../../../../../../../ucrt64/lib/python3.14/site-packages/numpy/_core/include" "-I../pandas/_libs/include" "-ID:/msys64/ucrt64/include/python3.14" "-fvisibility=hidden" "-fdiagnostics-color=always" "-DNDEBUG" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wextra" "-std=c11" "-O3" "-DNPY_NO_DEPRECATED_API=0" "-DCYTHON_USE_TYPE_SPECS=1" "-DNPY_TARGET_VERSION=NPY_1_21_API_VERSION" "-march=nocona" "-msahf" "-mtune=generic" "-O2" "-pipe" "-Wp,-D_FORTIFY_SOURCE=2" "-fstack-protector-strong" "-Wp,-D__USE_MINGW_ANSI_STDIO=1" -MD -MQ pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj -MF "pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj.d" -o pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj "-c" pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/pandas/_libs/tslibs/parsing.pyx.c
In file included from D:/msys64/ucrt64/include/windows.h:71,
                 from D:/msys64/ucrt64/include/rpc.h:16,
                 from D:/msys64/ucrt64/include/wtypesbase.h:7,
                 from D:/msys64/ucrt64/include/intsafe.h:15,
                 from ../pandas/_libs/include/pandas/portable.h:43,
                 from pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/pandas/_libs/tslibs/parsing.pyx.c:1159:
../pandas/_libs/include/pandas/parser/tokenizer.h:81:16: error: expected identifier before numeric constant
   81 | typedef enum { ERROR, WARN, SKIP } BadLineHandleMethod;
      |                ^~~~~
  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.
  • I have reviewed and followed all the contribution guidelines
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md.

When compiling with MSYS2, `intsafe.h` will indirectly include `wingdi.h`, in which `#define ERROR 0`, causing compiling error for `typedef enum { ERROR, WARN, SKIP } BadLineHandleMethod;`

Also, all MSYS2 compilers (GCC/Clang) supports __builtin_add_overflow, so it's safe to use these builtins.

Detailed error:
```
FAILED: [code=1] pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj
"gcc" "-Ipandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p" "-Ipandas/_libs/tslibs" "-I../pandas/_libs/tslibs" "-I../../../../../../../../ucrt64/lib/python3.14/site-packages/numpy/_core/include" "-I../pandas/_libs/include" "-ID:/msys64/ucrt64/include/python3.14" "-fvisibility=hidden" "-fdiagnostics-color=always" "-DNDEBUG" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wextra" "-std=c11" "-O3" "-DNPY_NO_DEPRECATED_API=0" "-DCYTHON_USE_TYPE_SPECS=1" "-DNPY_TARGET_VERSION=NPY_1_21_API_VERSION" "-march=nocona" "-msahf" "-mtune=generic" "-O2" "-pipe" "-Wp,-D_FORTIFY_SOURCE=2" "-fstack-protector-strong" "-Wp,-D__USE_MINGW_ANSI_STDIO=1" -MD -MQ pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj -MF "pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj.d" -o pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/meson-generated_pandas__libs_tslibs_parsing.pyx.c.obj "-c" pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/pandas/_libs/tslibs/parsing.pyx.c
In file included from D:/msys64/ucrt64/include/windows.h:71,
                 from D:/msys64/ucrt64/include/rpc.h:16,
                 from D:/msys64/ucrt64/include/wtypesbase.h:7,
                 from D:/msys64/ucrt64/include/intsafe.h:15,
                 from ../pandas/_libs/include/pandas/portable.h:43,
                 from pandas/_libs/tslibs/parsing.cp314-mingw_x86_64_ucrt_gnu.pyd.p/pandas/_libs/tslibs/parsing.pyx.c:1159:
../pandas/_libs/include/pandas/parser/tokenizer.h:81:16: error: expected identifier before numeric constant
   81 | typedef enum { ERROR, WARN, SKIP } BadLineHandleMethod;
      |                ^~~~~
```
@Alvaro-Kothe

Copy link
Copy Markdown
Member

When compiling with MSYS2, intsafe.h will indirectly include wingdi.h, in which #define ERROR 0, causing compiling error for typedef enum { ERROR, WARN, SKIP } BadLineHandleMethod;

This error should've been fixed by #64849.

Comment thread pandas/_libs/include/pandas/portable.h Outdated
@dragon-archer

Copy link
Copy Markdown
Author

When compiling with MSYS2, intsafe.h will indirectly include wingdi.h, in which #define ERROR 0, causing compiling error for typedef enum { ERROR, WARN, SKIP } BadLineHandleMethod;

This error should've been fixed by #64849.

Oops, I didn't find that before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants