Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.9] bpo-13501: allow choosing between readline and libedit #25420

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

Closed
wants to merge 1 commit into from

Conversation

tnir
Copy link

@tnir tnir commented Apr 15, 2021

Backport GH-24189 (bpo-13501) for Python 3.9.


In contrast to macOS, libedit is available as its own include file and
library on Linux systems to prevent file name clashes. So if both
libraries are available on the system, readline is currently chosen by
default; and if only libedit is available, it is not found at all. This
patch adds a way to link against libedit by adding the following
arguments to configure:

--with-readline link against libreadline (the default)
--with-readline=editline link against libeditline
--with-readline=no disable building the readline module
--without-readline (same)

The runtime detection of libedit vs. readline was already done in commit
7105319 (2019-12-04, serge-sans-paille: "bpo-38634: Allow
non-apple build to cope with libedit (GH-16986)").

Fixes: GH-12076 ("bpo-13501 Build or disable readline with Editline")
Fixes: bpo-13501 ("Make libedit support more generic; port readline / libedit to FreeBSD")
Co-authored-by: Enji Cooper (ngie-eign)
Co-authored-by: Martin Panter (vadmium)
Co-authored-by: Robert Marshall (kellinm)

https://bugs.python.org/issue13501

In contrast to macOS, libedit is available as its own include file and
library on Linux systems to prevent file name clashes. So if both
libraries are available on the system, readline is currently chosen by
default; and if only libedit is available, it is not found at all. This
patch adds a way to link against libedit by adding the following
arguments to configure:

  --with-readline           link against libreadline (the default)
  --with-readline=editline  link against libeditline
  --with-readline=no        disable building the readline module
  --without-readline        (same)

The runtime detection of libedit vs. readline was already done in commit
7105319 (2019-12-04, serge-sans-paille: "bpo-38634: Allow
non-apple build to cope with libedit (pythonGH-16986)").

Fixes: pythonGH-12076 ("bpo-13501 Build or disable readline with Editline")
Fixes: bpo-13501 ("Make libedit support more generic; port readline / libedit to FreeBSD")
Co-authored-by: Enji Cooper (ngie-eign)
Co-authored-by: Martin Panter (vadmium)
Co-authored-by: Robert Marshall (kellinm)
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@tnir

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@vstinner
Copy link
Member

@gpshead: Hum, this is a new feature. I'm not comfortable with backporting it.

@tnir: Can you please elaborate why do you need this change? Can't you use libreadline with Python 3.9 for now? Can you wait for Python 3.10, scheduled next October (2021)?

@gpshead
Copy link
Member

gpshead commented Apr 15, 2021

FWIW I didn't create this backport PR. But I think we have made build enabling changes in a 3.x release in the past (the enable optimizations stuff? i'd have to go searching configure.ac history in 3.n branches). Ultimately up to the release manager to decide if we want to accept this in our 3.9 branch.

This is most useful for BSD and Darwin systems, and in environments where LGPL avoidance is required.

@vstinner
Copy link
Member

I'm not going to hold this PR, it's up to you @gpshead ;-) I'm just surprised that it became an issue in 2021, whereas Python was linked to libreadline for years without complains, no?

@tnir
Copy link
Author

tnir commented Apr 23, 2021

@vstinner This could be a new feature on build... With this change, we can have two options: to avoid GPL-licensed component, which helps various environments and companies avoiding GPL, and to compile CPython without readline-dev or libedit-dev in a lower-resource environment.

@vstinner
Copy link
Member

cc @ambv (Python 3.9 Release Manager)

@ambv
Copy link
Contributor

ambv commented Apr 23, 2021

This is a cool enhancement but it's definitely not a bugfix so it's questionable for inclusion in 3.9. Yes, we had somebody force similar changes in the past, he's no longer contributing.

This is a perfect candidate for the upcoming 3.10, especially seeing how 3.9 is already mid-way through its bugfix release lifecycle.

@ambv ambv closed this Apr 23, 2021
@tnir
Copy link
Author

tnir commented Apr 26, 2021

Thanks @ambv @vstinner

@tnir tnir deleted the backport-bpo-13501-for-3.9 branch April 26, 2021 02:01
@vstinner
Copy link
Member

Yep, the feature should already be part of Python 3.10 alpha releases: https://docs.python.org/dev/using/configure.html#cmdoption-with-readline (I recently wrote this whole new page, to document configure options!).

@tnir
Copy link
Author

tnir commented Apr 29, 2021

But, currently I am building Python 3.7, I will need to patch Python 3.7 (and then 3.9 in the future) with this patch 😁 as this patch was rejected.

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

Successfully merging this pull request may close these issues.

7 participants