René's URL Explorer Experiment


Title: `readline.set_completer_delims` has no effect with libedit · Issue #112105 · python/cpython · GitHub

Open Graph Title: `readline.set_completer_delims` has no effect with libedit · Issue #112105 · python/cpython

X Title: `readline.set_completer_delims` has no effect with libedit · Issue #112105 · python/cpython

Description: Bug report Bug description: readline.set_completer_delims works fine with GNU readline, but not with libedit. A quick example: import readline readline.set_completer_delims("\n") if "libedit" in getattr(readline, "__doc__", ""): readline...

Open Graph Description: Bug report Bug description: readline.set_completer_delims works fine with GNU readline, but not with libedit. A quick example: import readline readline.set_completer_delims("\n") if "libedit" in ge...

X Description: Bug report Bug description: readline.set_completer_delims works fine with GNU readline, but not with libedit. A quick example: import readline readline.set_completer_delims("\n") if "...

Opengraph URL: https://github.com/python/cpython/issues/112105

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`readline.set_completer_delims` has no effect with libedit","articleBody":"# Bug report\n\n### Bug description:\n\n`readline.set_completer_delims` works fine with GNU readline, but not with libedit.\n\nA quick example:\n\n```python\nimport readline\n\nreadline.set_completer_delims(\"\\n\")\nif \"libedit\" in getattr(readline, \"__doc__\", \"\"):\n    readline.parse_and_bind(\"bind ^I rl_complete\")\nelse:\n    readline.parse_and_bind(\"tab: complete\")\n\ndef completer(text, state):\n    if text == \"$\" and state == 0:\n        return \"$complete\"\n    return None\n\nreadline.set_completer(completer)\n\ninput()\n# Type $ then \u003ctab\u003e\n```\n\nWith GNU readline, it completes correctly, but with libedit, it can't - libedit still considers `$` as a delimiter. You can confirm that by printing the text in `completer` function.\n\nThe issue is in `readline.c`:\n\nhttps://github.com/python/cpython/blob/d4f83e1e3a19e2f881115f20d58ae6a019ddb48f/Modules/readline.c#L576-L581\n\n`readline.c` writes to `rl_completer_word_break_characters`, which works fine [source](https://git.savannah.gnu.org/cgit/readline.git/tree/complete.c#n1079).\n\nHowever, libedit does not do the same thing, it uses `rl_basic_word_break_characters` [instead](https://opensource.apple.com/source/libedit/libedit-40/src/readline.c):\n\n```C\nif (rl_completion_word_break_hook != NULL)\n\tbreakchars = (*rl_completion_word_break_hook)();\nelse\n\tbreakchars = rl_basic_word_break_characters;\n```\n\nThus, writing to `rl_completer_word_break_characters` will not have any effect on libedit. The simplest way I can think of, is to write to both `rl_completer_word_break_characters` and `rl_basic_word_break_characters`. They both exist in GNU readline and libedit, for slightly different purposes.\n\n* GNU readline:\n    * `rl_completer_word_break_characters` is the one that takes effect\n    * `rl_basic_word_break_characters` just keeps a string as default value for `rl_completer_word_break_characters`\n* libedit\n    * `rl_completer_word_break_characters` is not used at all\n    * `rl_basic_word_break_characters` is used for break words\n\nFrom what I can observe, writing to both variables has no unexpected side effect, because `rl_basic_word_break_characters` is not used on CPython with GNU readline.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux, macOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-112106\n* gh-112487\n* gh-112488\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/gaogaotiantian","@type":"Person","name":"gaogaotiantian"},"datePublished":"2023-11-15T04:52:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/112105/cpython/issues/112105"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:990e1e32-e964-f377-5331-87d63bd2bbbe
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA8DE:3BD8F2:20A6458:2D5A71B:6A4F492A
html-safe-nonce3413126e38be9538f872b75dbbcd9a67ddc458ff1191fd248413588f74b8489a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOERFOjNCRDhGMjoyMEE2NDU4OjJENUE3MUI6NkE0RjQ5MkEiLCJ2aXNpdG9yX2lkIjoiNTM2MDE5Mzg5Mzg1MjcyNzU5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac653fc36be13d24cd6cb3833da1e7c0f4afe0372d445fc1c73bc37c90013bd45f
hovercard-subject-tagissue:1994042674
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/112105/issue_layout
twitter:imagehttps://opengraph.githubassets.com/184d1be32ea4d5b07a51d249ac140e3c5810ad42257ef22aacb61d6f8a463e56/python/cpython/issues/112105
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/184d1be32ea4d5b07a51d249ac140e3c5810ad42257ef22aacb61d6f8a463e56/python/cpython/issues/112105
og:image:altBug report Bug description: readline.set_completer_delims works fine with GNU readline, but not with libedit. A quick example: import readline readline.set_completer_delims("\n") if "libedit" in ge...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegaogaotiantian
hostnamegithub.com
expected-hostnamegithub.com
Noneb92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4b249b445842943ed31549e027f57a8ade9881ed
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/112105#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F112105
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F112105
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/112105
Reloadhttps://github.com/python/cpython/issues/112105
Reloadhttps://github.com/python/cpython/issues/112105
Please reload this pagehttps://github.com/python/cpython/issues/112105
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/112105
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.6k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
readline.set_completer_delims has no effect with libedithttps://github.com/python/cpython/issues/112105#top
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/gaogaotiantian
gaogaotiantianhttps://github.com/gaogaotiantian
on Nov 15, 2023https://github.com/python/cpython/issues/112105#issue-1994042674
cpython/Modules/readline.chttps://github.com/python/cpython/blob/d4f83e1e3a19e2f881115f20d58ae6a019ddb48f/Modules/readline.c#L576-L581
d4f83e1https://github.com/python/cpython/commit/d4f83e1e3a19e2f881115f20d58ae6a019ddb48f
sourcehttps://git.savannah.gnu.org/cgit/readline.git/tree/complete.c#n1079
insteadhttps://opensource.apple.com/source/libedit/libedit-40/src/readline.c
gh-112105: Make completer delims work on libedit #112106https://github.com/python/cpython/pull/112106
[3.12] gh-112105: Make completer delims work on libedit (gh-112106) #112487https://github.com/python/cpython/pull/112487
[3.11] gh-112105: Make completer delims work on libedit (gh-112106) #112488https://github.com/python/cpython/pull/112488
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.