From aa0b20ee85025593ad629841be413d541d6dec40 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Fri, 20 Sep 2024 02:49:39 -0600 Subject: [PATCH] remove mention of static_assert compilation error (#76) --- docs/debugging.md | 60 ----------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/docs/debugging.md b/docs/debugging.md index b97ed20..6a47da3 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -239,64 +239,4 @@ slower than a compiled version, so you should default to installing the wheel in CI instead of compiling Cython, which can take up to a few minutes on some CI runners. -### Cython compilation errors arising from `static_assert` - -This error arises from a limitation in Cython that exposes a CPython -implementation detail. Under clang, the issue manifests in error messages like -the following example, generated by building scikit-learn with a C99 compilation -environment: - -``` -In file included from sklearn/__check_build/_check_build.cpython-313t-darwin.so.p/sklearn/__check_build/_check_build.pyx.c:4315: -In file included from /path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_frame.h:13: -/path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_code.h:537:15: error: expected parameter declarator -static_assert(COLD_EXIT_INITIAL_VALUE > ADAPTIVE_COOLDOWN_VALUE, - ^ -/path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_backoff.h:125:33: note: expanded from macro 'COLD_EXIT_INITIAL_VALUE' -#define COLD_EXIT_INITIAL_VALUE 64 - ^ -In file included from sklearn/__check_build/_check_build.cpython-313t-darwin.so.p/sklearn/__check_build/_check_build.pyx.c:4315: -In file included from /path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_frame.h:13: -/path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_code.h:537:15: error: expected ')' -/path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_backoff.h:125:33: note: expanded from macro 'COLD_EXIT_INITIAL_VALUE' -#define COLD_EXIT_INITIAL_VALUE 64 - ^ -/path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_code.h:537:14: note: to match this '(' -static_assert(COLD_EXIT_INITIAL_VALUE > ADAPTIVE_COOLDOWN_VALUE, - ^ -/path/to/python/3.13.0b3t/include/python3.13t/internal/pycore_code.h:537:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] - static_assert(COLD_EXIT_INITIAL_VALUE > ADAPTIVE_COOLDOWN_VALUE, - ^ - int -``` - -Free-threading support in Cython relies CPython internals. In particular, Cython -will generate code that in some situations includes an internal CPython header, -`pycore_frame.h`. This header, in turn, includes another header `pycore_code.h` -that makes use of `static_assert`, a construct defined in the C11 standard. This -is problematic for a compiler assuming compliance with C99. - -In practice we have found the easiest way to fix this is to update the standard -used to build C code to either C11 or C17. In the meson build configuration for -a simple C project, this looks like: - -```meson -project( - 'my-project', - 'c', - default_options: [ - 'c_std=c17', - ], -) -``` - -Note that C17 corrected defects, removed optional requirements, and did not add -any new features compared with C11, so requiring C11 support may be more onerous than -C17. The CPython codebase currently assumes a compiler with at least partial C11 -support, and we have found for all major compilers (including MSVC) that -updating the assumed C standard is not a big problem as of mid-2024. There are -some C11 features that MSVC and other compilers are missing, so please open an -issue if this ends up being a big problem for your project or a subset of your -userbase. - [^1]: This feature is not correctly working on `lldb` after CPython 3.12.