-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-105323: Add special workround for macOS default editline #108633
Conversation
corona10
commented
Aug 29, 2023
•
edited by bedevere-bot
Loading
edited by bedevere-bot
- Issue: Incompatible function pointer types assigning to 'Function *' at readline module #105323
Misc/NEWS.d/next/Tests/2023-08-29-21-51-04.gh-issue-105223.lqw_5B.rst
Outdated
Show resolved
Hide resolved
@erlend-aasland @ned-deily |
This comment was marked as resolved.
This comment was marked as resolved.
@erlend-aasland @ned-deily
|
Modules/readline.c
Outdated
@@ -1019,10 +1019,16 @@ on_hook(PyObject *func) | |||
static int | |||
#if defined(_RL_FUNCTION_TYPEDEF) | |||
on_startup_hook(void) | |||
{ | |||
#elif defined(__APPLE__) && defined(WITH_EDITLINE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that other distributors and users of Python on macOS may be linking to a libedit that is not the Apple-supplied libedit on macOS. For example, MacPorts supplies their own newer version of libedit. So tests like this might not be appropriate. It needs to be tested (see my comments on the issue).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ned, then how about defining the new macro WITH_APPLE_READLINE
and using it?
(It will only enabled if the user does not designate the readline option through ./configure`)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you established that there aren't also warnings when compiling with versions of editline other than the macOS system one? I literally don't have time to delve into this now as I'm traveling but I did try to do a quick compile with the current MacPorts version of editline I have installed with me and that also produced compile warnings though not exactly the same ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ./configure: Follow apple readline
- ./configure --with-readline=editline: Follow custom editline
- ./configure --with-readline=readline: Follow custom readline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we can add a version check also: RL_READLINE_VERSION==0x0402, all macOS are using identical versions for built-in readline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm traveling but I did try to do a quick compile with the current MacPorts version of editline I have installed with me and that also produced compile warnings though not exactly the same ones.
Well, it's up to which commits of Python you are using.
After we reverted Irit's patch, there is no compiler warning for system one too.
But it does not mean that the issue is solved because we don't use proper parameters for apple system built-in library and in the future clang compiler will not skip such a mistake.
Please see my comment: #108588 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's up to which commits of Python you are using.
After we reverted Irit's patch, there is no compiler warning for system one too.
Umm, sorry, it was not reverted yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you established that there aren't also warnings when compiling with versions of editline other than the macOS system one?
I will test them and share soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay with b89dd4c
I detected the following warnings with homebrew libedit. (./configure --with-readline=editline)
./Modules/readline.c:1269:21: warning: incompatible function pointer types assigning to 'rl_hook_func_t *' (aka 'int (*)(void)') from 'int (const char *, int)' [-Wincompatible-function-pointer-types]
rl_startup_hook = on_startup_hook;
^ ~~~~~~~~~~~~~~~
./Modules/readline.c:1271:23: warning: incompatible function pointer types assigning to 'rl_hook_func_t *' (aka 'int (*)(void)') from 'int (const char *, int)' [-Wincompatible-function-pointer-types]
rl_pre_input_hook = on_pre_input_hook;
And with 67e3a54
there were no compiler warnings.
So I would like to propose updating the policy as I proposed from #108633 (comment)
If people want to custom readline library passing the explicit option looks reasonable and if people want to use the builtin readline library ./configure
will be enough.
configure.ac
Outdated
@@ -5822,13 +5823,20 @@ AC_ARG_WITH( | |||
AS_CASE([$with_readline], | |||
[editline|edit], [with_readline=edit], | |||
[yes|readline], [with_readline=readline], | |||
[no], [], | |||
[no], [with_readline=default], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not feel right; if --with-readline=no
we ... default to system readline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it was my mistake.
configure.ac
Outdated
[Darwin/*], [AC_DEFINE([WITH_APPLE_READLINE], [1]) with_readline=readline], | ||
[with_readline=readline]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You set with_readline=readline
no matter which branch; perhaps you can put that assignment outside the switch.
@ned-deily @ronaldoussoren @erlend-aasland |
I gave up this PR and promote #108665, which has no side effect for every case. |