Skip to content

Commit

Permalink
Undefine the WITH_EDITLINE macro
Browse files Browse the repository at this point in the history
Since Python 3.10 it is possible to build against libedit explicitly.
This introduced a WITH_EDITLINE macro in pyconfig.h which causes the
readline extension module to include the libedit headers instead of the
readline headers. Homebrew Python 3.11 finally took the plunge and
enabled this macro, causing builds of the extension code to fail with
undeclared identifiers and implicit declarations due to the missing
includes.

I first tried to add `undef_macros=['WITH_EDITLINE']` to the Extension
object in setup.py but that had no effect (probably because pyconfig.h
is included later). The next best thing is less elegant but effective:
undefine it just before it would be used.

This addresses @milosivanovic's build issues in #62.
  • Loading branch information
ludwigschwardt committed Jun 18, 2023
1 parent a39b669 commit a7981fa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Modules/3.x/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# define RESTORE_LOCALE(sl)
#endif

#undef WITH_EDITLINE /* We are building GNU readline */
#ifdef WITH_EDITLINE
# include <editline/readline.h>
#else
Expand Down

0 comments on commit a7981fa

Please sign in to comment.