René's URL Explorer Experiment


Title: gh-66428 Stop including all bidirectional "B" characters in line breakers by LoicGrobol · Pull Request #132369 · python/cpython · GitHub

Open Graph Title: gh-66428 Stop including all bidirectional "B" characters in line breakers by LoicGrobol · Pull Request #132369 · python/cpython

X Title: gh-66428 Stop including all bidirectional "B" characters in line breakers by LoicGrobol · Pull Request #132369 · python/cpython

Description: This is not a direct fix to the issue (as it is not clear how/if it should be fixed at this point), but to this comment: I couldn't find a trace of bidirectional B characters being non-tailorable line breaks (classes BK, CR, LF, NL), neither in the line breaking not in the bidirectional algorithm specification. What I think the latter means is that B characters actually only “terminate paragraphs” in the sense of “terminating the effect of directional formatting characters”. Now it is true that \N{PARAGRAPH SEPARATOR} is both B and BK, but does it means that all B characters should be line breaks? In particular what about \N{FILE SEPARATOR}, \N{GROUP SEPARATOR} and \N{RECORD SEPARATOR}, who are all caught by str.splitlines, but have the Combining Mark property (see e.g. the list of line breaks), which should in fact forbid a line break? And the answer by @malemburg At the time this code was written (in 2000), Unicode 3.0 was the current version and in those days, bidirectional B code points were listed as "Paragraph Separator", in particular the important ones CR, LF. See https://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.html and https://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt for details. I don't remember, but it's well possible that I wasn't aware of the CM LineBreak property at the time. I guess the _PyUnicode_IsLinebreak() function should really use the LineBreak.txt file as basis and only include code points which are listed as "Non-tailorable" in that file: https://www.unicode.org/Public/UCD/latest/ucd/LineBreak.txt Perhaps it's time to fix this after 25 years 😄 Patches are welcome ! It turns out that LineBreak.txt is already used to gather the line break categories, but that B was still kept as indicating a line breaker. Looking at the current state of Unicode (16.0) All the characters in B that are non-tailorable line breakers are in the BK, CR, LF or NL categories, so they were already captured. The other characters in B (U+001C, U+001D, U+001E) are all combining marks and shouldn't break lines. So I just removed the bidirectional == "B" condition in the code generating the list of line breakers and that should be it. I think from an API perspective, this only affects str.splitlines(), which at this point is only tested for behaviour against CR, LF and CR+LF and no other line breaker, so I didn't add any test, but I can if it seems useful. In general, I don't expect this to be a huge compatility-breaking change given the conversation in #66428, but don't really know how to check for that apart from searching for the codepoints (in U+ and \x forms) on Github, which didn't return any Python code that would be broken. This is my first PR, so it's very likely I missed something, please let me know! Issue: gh-66428 📚 Documentation preview 📚: https://cpython-previews--132369.org.readthedocs.build/

Open Graph Description: This is not a direct fix to the issue (as it is not clear how/if it should be fixed at this point), but to this comment: I couldn't find a trace of bidirectional B characters being non-tailora...

X Description: This is not a direct fix to the issue (as it is not clear how/if it should be fixed at this point), but to this comment: I couldn't find a trace of bidirectional B characters being non-tai...

Opengraph URL: https://github.com/python/cpython/pull/132369

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e373c193-0e79-5457-2a3c-327b00dbdb2a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC292:17596C:7FE763:A9E479:6A517E64
html-safe-nonced60d41def51c7407b997e141e1a446093ffb8042fe2b52a36f641407745af230
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjkyOjE3NTk2Qzo3RkU3NjM6QTlFNDc5OjZBNTE3RTY0IiwidmlzaXRvcl9pZCI6IjI4OTg5NTgzNTc5ODQ1NDIzMDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf041b2942d540d8e1ffd10c816fe948634d0bdfc3f77794061ed31e03725589e
hovercard-subject-tagpull_request:2451495874
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/132369/files
twitter:imagehttps://avatars.githubusercontent.com/u/14248012?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/14248012?s=400&v=4
og:image:altThis is not a direct fix to the issue (as it is not clear how/if it should be fixed at this point), but to this comment: I couldn't find a trace of bidirectional B characters being non-tailora...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released01c62704ef24df49056c63892a149b775e1353d
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/132369/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F132369%2Ffiles
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%2Fpull%2F132369%2Ffiles
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%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/132369/files
Reloadhttps://github.com/python/cpython/pull/132369/files
Reloadhttps://github.com/python/cpython/pull/132369/files
Please reload this pagehttps://github.com/python/cpython/pull/132369/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/132369/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.7k 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
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
LoicGrobolhttps://github.com/LoicGrobol
python:mainhttps://github.com/python/cpython/tree/main
LoicGrobol:unicode-linebreakshttps://github.com/LoicGrobol/cpython/tree/unicode-linebreaks
Conversation 5 https://github.com/python/cpython/pull/132369
Commits 6 https://github.com/python/cpython/pull/132369/commits
Checks 0 https://github.com/python/cpython/pull/132369/checks
Files changed https://github.com/python/cpython/pull/132369/files
Please reload this pagehttps://github.com/python/cpython/pull/132369/files
gh-66428 Stop including all bidirectional "B" characters in line breakers https://github.com/python/cpython/pull/132369/files#top
Show all changes 6 commits https://github.com/python/cpython/pull/132369/files
e535e89 Remove from linebreak/_PyUnicode_IsLinebreak characters that are bidi… Apr 10, 2025 https://github.com/python/cpython/pull/132369/commits/e535e89b901d71cb7ae591776507e9b35cb71f84
22633de remove the offending characters from the splitlines table Apr 10, 2025 https://github.com/python/cpython/pull/132369/commits/22633de8b339d6672da8081ddbbf360d76ed72e0
dfe0b2e update unicodetype_db.h Apr 10, 2025 https://github.com/python/cpython/pull/132369/commits/dfe0b2e5319459a3c6f5291f740495c35c12b84d
9d3799f Merge branch 'python:main' into unicode-linebreaks Apr 10, 2025 https://github.com/python/cpython/pull/132369/commits/9d3799f7c7219473fb8bd7ac42f9ebbb1934fa7c
eadb0e2 add tentative news blurb Apr 10, 2025 https://github.com/python/cpython/pull/132369/commits/eadb0e21039dd0316188264649187f4ea9a2f751
286ab7b Merge branch 'main' into unicode-linebreaks LoicGrobol May 24, 2025 https://github.com/python/cpython/pull/132369/commits/286ab7ba6ef8386ea7cb476a33a4063e0061254b
Clear filters https://github.com/python/cpython/pull/132369/files
Please reload this pagehttps://github.com/python/cpython/pull/132369/files
Please reload this pagehttps://github.com/python/cpython/pull/132369/files
stdtypes.rst https://github.com/python/cpython/pull/132369/files#diff-08a31a70dd1f6d97aa8dacdce77db4de04c700d9949be1af611a595186aad5b3
2025-04-10-18-26-49.gh-issue-66428.sJ9yJn.rst https://github.com/python/cpython/pull/132369/files#diff-e0bcad409a484bdc18a1aa43526a116129c03a01497d85159d9352cb9e8ce7f8
unicodetype_db.h https://github.com/python/cpython/pull/132369/files#diff-4a48292eae5662155d9ac84d641b02cc3dc2c8c7d14a02e4dc46f1cc7e4dad70
makeunicodedata.py https://github.com/python/cpython/pull/132369/files#diff-17ec60c9bf5044a66fffc2f5bd5b6c4a6df192332bd2762ddf4336a80f8f8f25
Doc/library/stdtypes.rsthttps://github.com/python/cpython/pull/132369/files#diff-08a31a70dd1f6d97aa8dacdce77db4de04c700d9949be1af611a595186aad5b3
View file https://github.com/python/cpython/blob/286ab7ba6ef8386ea7cb476a33a4063e0061254b/Doc/library/stdtypes.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/132369/{{ revealButtonHref }}
https://github.com/python/cpython/pull/132369/files#diff-08a31a70dd1f6d97aa8dacdce77db4de04c700d9949be1af611a595186aad5b3
https://github.com/python/cpython/pull/132369/files#diff-08a31a70dd1f6d97aa8dacdce77db4de04c700d9949be1af611a595186aad5b3
Misc/NEWS.d/next/Core_and_Builtins/2025-04-10-18-26-49.gh-issue-66428.sJ9yJn.rsthttps://github.com/python/cpython/pull/132369/files#diff-e0bcad409a484bdc18a1aa43526a116129c03a01497d85159d9352cb9e8ce7f8
View file https://github.com/python/cpython/blob/286ab7ba6ef8386ea7cb476a33a4063e0061254b/Misc/NEWS.d/next/Core_and_Builtins/2025-04-10-18-26-49.gh-issue-66428.sJ9yJn.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/132369/{{ revealButtonHref }}
Objects/unicodetype_db.hhttps://github.com/python/cpython/pull/132369/files#diff-4a48292eae5662155d9ac84d641b02cc3dc2c8c7d14a02e4dc46f1cc7e4dad70
View file https://github.com/python/cpython/blob/286ab7ba6ef8386ea7cb476a33a4063e0061254b/Objects/unicodetype_db.h
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/132369/files
Tools/unicode/makeunicodedata.pyhttps://github.com/python/cpython/pull/132369/files#diff-17ec60c9bf5044a66fffc2f5bd5b6c4a6df192332bd2762ddf4336a80f8f8f25
View file https://github.com/python/cpython/blob/286ab7ba6ef8386ea7cb476a33a4063e0061254b/Tools/unicode/makeunicodedata.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/132369/{{ revealButtonHref }}
https://github.com/python/cpython/pull/132369/files#diff-17ec60c9bf5044a66fffc2f5bd5b6c4a6df192332bd2762ddf4336a80f8f8f25
https://github.com/python/cpython/pull/132369/files#diff-17ec60c9bf5044a66fffc2f5bd5b6c4a6df192332bd2762ddf4336a80f8f8f25
https://github.com/python/cpython/pull/132369/files#diff-17ec60c9bf5044a66fffc2f5bd5b6c4a6df192332bd2762ddf4336a80f8f8f25
https://github.com/python/cpython/pull/132369/files#diff-17ec60c9bf5044a66fffc2f5bd5b6c4a6df192332bd2762ddf4336a80f8f8f25
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.