[BUG][BLD] revert DEF component of #21878 #21919
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#21878 introduced a subtle build problem that is not caught by the CI. Running
python setup.py build_ext --inplace
followed bypython3 setup.py build_ext --inplace
causes compile-time errors in py3 (or if running these in the opposite order, errors in py2). These are fixed by runningpython setup.py clean
in between.This reverts the relevant changes.
For anyone curious: cython supports syntax:
and these IF/ELSE conditions get evaluated at compile-time. #21878 incorrectly assumed that "compile-time" in this context meant ".c -> .so" time, not ".pyx -> .c" time. In this we used:
so after running
setup.py build_ext --inplace
in py2, the ".c" file we end up with has already gotten rid of the PY3 branches. When we runpython3 setup.py build_ext --inplace
cython uses the existing .c file, tries to compile it to .so, and breaks.