René's URL Explorer Experiment


Title: Match CPython's str subscript TypeError message by kim-jaedeok · Pull Request #8319 · RustPython/RustPython · GitHub

Open Graph Title: Match CPython's str subscript TypeError message by kim-jaedeok · Pull Request #8319 · RustPython/RustPython

X Title: Match CPython's str subscript TypeError message by kim-jaedeok · Pull Request #8319 · RustPython/RustPython

Description: Summary Make str subscripting with a non-integer index raise the same TypeError message as CPython, and drop the expectedFailure marker on string_tests.test_subscript. Before / after ('abc'['def']): message CPython 3.14 string indices must be integers, not 'str' RustPython (before) str indices must be integers or slices or classes that override __index__ operator, not 'str' RustPython (after) string indices must be integers, not 'str' Only the error message differed — indexing itself (int / negative / slice) already behaved correctly. CPython gives str its own wording in unicode_subscript (see python/cpython#88276, fixed in 3.11), distinct from the shared sequence message used by list/tuple/bytes. Approach Add SequenceIndex::try_from_borrowed_object_with_err, which keeps the shared index-parsing logic but lets the caller supply the TypeError raised for a non-index object. try_from_borrowed_object now delegates to it with the existing wording, so every other sequence caller (list/tuple/bytes/bytearray/array/mmap/ struct-sequence) is byte-for-byte unchanged. str::_getitem — the single path shared by __getitem__ and the mapping subscript slot — supplies the CPython-accurate message. Scoped intentionally to str only: CPython declined to unify the sequence messages (python/cpython#75731, rejected), so the other types' wording is left as-is. Testing test_str / test_userstring test_subscript now pass (marker removed). Byte-for-byte match with CPython 3.14.6 for str/object/None/float indices, and for UserString as receiver. list/tuple/bytes messages verified unchanged; rustpython-vm and rustpython-codegen unit tests pass. Summary by CodeRabbit Bug Fixes Improved error messages for invalid string indices. String indexing with a non-integer value now raises a clear TypeError identifying the invalid type. Standardized handling of invalid sequence indices for more consistent behavior.

Open Graph Description: Summary Make str subscripting with a non-integer index raise the same TypeError message as CPython, and drop the expectedFailure marker on string_tests.test_subscript. Before / after ('abc'...

X Description: Summary Make str subscripting with a non-integer index raise the same TypeError message as CPython, and drop the expectedFailure marker on string_tests.test_subscript. Before / after ('abc&...

Opengraph URL: https://github.com/RustPython/RustPython/pull/8319

X: @github

direct link

Domain: Github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ab5606c8-a9a1-0331-47ac-a46cc4339648
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA56C:377B45:B330A8:FFADAF:6A631B5A
html-safe-nonce2629c5f96f7f48b8a60183462271f353413c45052170ac53e2899310ca048af2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTZDOjM3N0I0NTpCMzMwQTg6RkZBREFGOjZBNjMxQjVBIiwidmlzaXRvcl9pZCI6IjIyOTg2NDI5OTIyNDgwNjg5NTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1bc6df889cd5df542fc0116706aaca62ef96d2a0f68b44b872d7aa28903425f9
hovercard-subject-tagpull_request:4083381521
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/RustPython/RustPython/pull/8319/files
twitter:imagehttps://avatars.githubusercontent.com/u/89368498?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/89368498?s=400&v=4
og:image:altSummary Make str subscripting with a non-integer index raise the same TypeError message as CPython, and drop the expectedFailure marker on string_tests.test_subscript. Before / after ('abc'...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None1a6c056e02f174fffc096c521ec0ff6fb83e40a2ec8cb8875466ec1524872dd6
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
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
release6a93e25585f487ddff9e3996c06d5b869d6e1828
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://Github.com/RustPython/RustPython/pull/8319/files#start-of-content
https://Github.com/
Sign in https://Github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F8319%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
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
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%2FRustPython%2FRustPython%2Fpull%2F8319%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=RustPython%2FRustPython
Reloadhttps://Github.com/RustPython/RustPython/pull/8319/files
Reloadhttps://Github.com/RustPython/RustPython/pull/8319/files
Reloadhttps://Github.com/RustPython/RustPython/pull/8319/files
Please reload this pagehttps://Github.com/RustPython/RustPython/pull/8319/files
RustPython https://Github.com/RustPython
RustPythonhttps://Github.com/RustPython/RustPython
Notifications https://Github.com/login?return_to=%2FRustPython%2FRustPython
Fork 1.5k https://Github.com/login?return_to=%2FRustPython%2FRustPython
Star 22.2k https://Github.com/login?return_to=%2FRustPython%2FRustPython
Code https://Github.com/RustPython/RustPython
Issues 294 https://Github.com/RustPython/RustPython/issues
Pull requests 105 https://Github.com/RustPython/RustPython/pulls
Discussions https://Github.com/RustPython/RustPython/discussions
Actions https://Github.com/RustPython/RustPython/actions
Projects https://Github.com/RustPython/RustPython/projects
Models https://Github.com/RustPython/RustPython/models
Wiki https://Github.com/RustPython/RustPython/wiki
Security and quality 0 https://Github.com/RustPython/RustPython/security
Insights https://Github.com/RustPython/RustPython/pulse
Code https://Github.com/RustPython/RustPython
Issues https://Github.com/RustPython/RustPython/issues
Pull requests https://Github.com/RustPython/RustPython/pulls
Discussions https://Github.com/RustPython/RustPython/discussions
Actions https://Github.com/RustPython/RustPython/actions
Projects https://Github.com/RustPython/RustPython/projects
Models https://Github.com/RustPython/RustPython/models
Wiki https://Github.com/RustPython/RustPython/wiki
Security and quality https://Github.com/RustPython/RustPython/security
Insights https://Github.com/RustPython/RustPython/pulse
Sign up for GitHub https://Github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://Github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
kim-jaedeokhttps://Github.com/kim-jaedeok
RustPython:mainhttps://Github.com/RustPython/RustPython/tree/main
kim-jaedeok:str-subscript-typeerror-messagehttps://Github.com/kim-jaedeok/RustPython/tree/str-subscript-typeerror-message
Conversation 8 https://Github.com/RustPython/RustPython/pull/8319
Commits 1 https://Github.com/RustPython/RustPython/pull/8319/commits
Checks 26 https://Github.com/RustPython/RustPython/pull/8319/checks
Files changed 3 https://Github.com/RustPython/RustPython/pull/8319/files
Match CPython's str subscript TypeError message https://Github.com/RustPython/RustPython/pull/8319/files#top
Show all changes 1 commit https://Github.com/RustPython/RustPython/pull/8319/files
6ecda1b Match CPython's str subscript TypeError message kim-jaedeok Jul 16, 2026 https://Github.com/RustPython/RustPython/pull/8319/commits/6ecda1b3a2a98c314a71bac047ab010fd29d2f21
Clear filters https://Github.com/RustPython/RustPython/pull/8319/files
Please reload this pagehttps://Github.com/RustPython/RustPython/pull/8319/files
Please reload this pagehttps://Github.com/RustPython/RustPython/pull/8319/files
string_tests.py https://Github.com/RustPython/RustPython/pull/8319/files#diff-7d8595e2ffcdcbf3222473c387d3f3da8344cfccd6e460dba3e726d2220ab0a7
str.rs https://Github.com/RustPython/RustPython/pull/8319/files#diff-a04ea1f7734fe40189e756196e034e6dedfcd5c82f2925e58cfd51ba7432073a
sliceable.rs https://Github.com/RustPython/RustPython/pull/8319/files#diff-3bd0c9ecde0861199fce3b194f5f0b8f7c309831d2ea2c2752a59adaee3b8e9e
Lib/test/string_tests.pyhttps://Github.com/RustPython/RustPython/pull/8319/files#diff-7d8595e2ffcdcbf3222473c387d3f3da8344cfccd6e460dba3e726d2220ab0a7
View file https://Github.com/RustPython/RustPython/blob/6ecda1b3a2a98c314a71bac047ab010fd29d2f21/Lib/test/string_tests.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://Github.com/RustPython/RustPython/pull/8319/{{ revealButtonHref }}
https://Github.com/RustPython/RustPython/pull/8319/files#diff-7d8595e2ffcdcbf3222473c387d3f3da8344cfccd6e460dba3e726d2220ab0a7
https://Github.com/RustPython/RustPython/pull/8319/files#diff-7d8595e2ffcdcbf3222473c387d3f3da8344cfccd6e460dba3e726d2220ab0a7
crates/vm/src/builtins/str.rshttps://Github.com/RustPython/RustPython/pull/8319/files#diff-a04ea1f7734fe40189e756196e034e6dedfcd5c82f2925e58cfd51ba7432073a
View file https://Github.com/RustPython/RustPython/blob/6ecda1b3a2a98c314a71bac047ab010fd29d2f21/crates/vm/src/builtins/str.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://Github.com/RustPython/RustPython/pull/8319/{{ revealButtonHref }}
https://Github.com/RustPython/RustPython/pull/8319/files#diff-a04ea1f7734fe40189e756196e034e6dedfcd5c82f2925e58cfd51ba7432073a
https://Github.com/RustPython/RustPython/pull/8319/files#diff-a04ea1f7734fe40189e756196e034e6dedfcd5c82f2925e58cfd51ba7432073a
crates/vm/src/sliceable.rshttps://Github.com/RustPython/RustPython/pull/8319/files#diff-3bd0c9ecde0861199fce3b194f5f0b8f7c309831d2ea2c2752a59adaee3b8e9e
View file https://Github.com/RustPython/RustPython/blob/6ecda1b3a2a98c314a71bac047ab010fd29d2f21/crates/vm/src/sliceable.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://Github.com/RustPython/RustPython/pull/8319/{{ revealButtonHref }}
https://Github.com/RustPython/RustPython/pull/8319/files#diff-3bd0c9ecde0861199fce3b194f5f0b8f7c309831d2ea2c2752a59adaee3b8e9e
https://Github.com/RustPython/RustPython/pull/8319/files#diff-3bd0c9ecde0861199fce3b194f5f0b8f7c309831d2ea2c2752a59adaee3b8e9e
coderabbitaihttps://Github.com/apps/coderabbitai
Jul 18, 2026https://Github.com/RustPython/RustPython/pull/8319/files#r3608980768
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://Github.com/RustPython/RustPython/pull/8319/files
youknowonehttps://Github.com/youknowone
Jul 19, 2026https://Github.com/RustPython/RustPython/pull/8319/files#r3609938941
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://Github.com/RustPython/RustPython/pull/8319/files
youknowonehttps://Github.com/youknowone
Jul 19, 2026https://Github.com/RustPython/RustPython/pull/8319/files#r3609985305
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://Github.com/RustPython/RustPython/pull/8319/files
https://Github.com/RustPython/RustPython/pull/8319/files#diff-3bd0c9ecde0861199fce3b194f5f0b8f7c309831d2ea2c2752a59adaee3b8e9e
https://Github.com/RustPython/RustPython/pull/8319/files#diff-3bd0c9ecde0861199fce3b194f5f0b8f7c309831d2ea2c2752a59adaee3b8e9e
Please reload this pagehttps://Github.com/RustPython/RustPython/pull/8319/files
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.