René's URL Explorer Experiment


Title: Deprecate the tuple API (`object[index]`) of structseq types (ex: os.stat_result) · Issue #155358 · python/cpython · GitHub

Open Graph Title: Deprecate the tuple API (`object[index]`) of structseq types (ex: os.stat_result) · Issue #155358 · python/cpython

X Title: Deprecate the tuple API (`object[index]`) of structseq types (ex: os.stat_result) · Issue #155358 · python/cpython

Description: Hi, I propose deprecating the tuple API (object[index]) of the following structseq objects: _interpchannels.ChannelInfo _lsprof.profiler_entry _lsprof.profiler_subentry _thread._ExceptHookArgs grp.struct_group os.sched_param os.stat_resu...

Open Graph Description: Hi, I propose deprecating the tuple API (object[index]) of the following structseq objects: _interpchannels.ChannelInfo _lsprof.profiler_entry _lsprof.profiler_subentry _thread._ExceptHookArgs grp....

X Description: Hi, I propose deprecating the tuple API (object[index]) of the following structseq objects: _interpchannels.ChannelInfo _lsprof.profiler_entry _lsprof.profiler_subentry _thread._ExceptHookArgs grp....

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecate the tuple API (`object[index]`) of structseq types (ex: os.stat_result)","articleBody":"Hi,\n\nI propose deprecating the tuple API (`object[index]`) of the following structseq objects:\n\n* `_interpchannels.ChannelInfo`\n* `_lsprof.profiler_entry`\n* `_lsprof.profiler_subentry`\n* `_thread._ExceptHookArgs`\n* `grp.struct_group`\n* `os.sched_param`\n* `os.stat_result`\n* `os.statvfs_result`\n* `os.terminal_size`\n* `os.times_result`\n* `os.uname_result`\n* `os.waitid_result`\n* `pwd.struct_passwd`\n* `resource.struct_rusage`\n* `signal.struct_siginfo`\n* `sys.UnraisableHookArgs`\n* `sys._emscripten_info`\n* `sys.asyncgen_hooks`\n* `sys.flags`\n* `sys.float_info`\n* `sys.getwindowsversion`\n* `sys.hash_info`\n* `sys.int_info`\n\nThe tuple API of the following structseq objects is kept, since it's useful:\n\n* `sys.version_info`: for example, `sys.version_info[:2]` is commonly used.\n* `curses.ncurses_version`: same rationale than `sys.version_info`.\n* `time.struct_time`: for example, `y, m, d, hh, mm, ss = struct_time[:6]` is used to unpack a time struct.\n\n---\n\nIn the early days of Python, it was tedious to create an object with attributes in C. So to keep the implementation simple, many functions returned simply a tuple (trivial to build in C). Example on Python 1.5 (yes, Python version one!):\n\n```\n$ ./python\nPython 1.5.2 (#1, Aug  7 2026, 17:03:12)  [GCC 16.1.1 20260515 (Red Hat 16.1.1-2) on linux7\nCopyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam\n>>> import os\n>>> st=os.stat(\".\")\n>>> type(st)\n\u003ctype 'tuple'>\n>>> st\n(16877, 60670004, 43, 1, 1000, 1000, 476, 1786114992, 1786114992, 1786114992)\n```\n\nThe `stat` module provides indices to state struct members:\n\n```\n# Indices for stat struct members in the tuple returned by os.stat()\n\nST_MODE  = 0\nST_INO   = 1\nST_DEV   = 2\nST_NLINK = 3\nST_UID   = 4\nST_GID   = 5\nST_SIZE  = 6\nST_ATIME = 7\nST_MTIME = 8\nST_CTIME = 9\n```\n\nFor example, `st[stat.ST_INO]` gets the inode number.\n\n---\n\nOver time, APIs became more and more complex and the **`structseq`** type was added to Python 2.2. It preserves the tuple API (`object[index]`), but adds also named attributes to object.\n\nFor example, `st.st_ino` gets the inode number. The tuple API is kept for backward compatibility.\n\n`os.stat_result` has a complex history:\n\n* At the beginning, `os.stat()` simply returned a tuple of 10 integers.\n* Python 2.2 changed `os.stat()` result type to `os.stat_result` to give access to attribute by name, but keep the tuple API for **backward compatibility**.\n* Python 2.3 added `os.stat_float_times(True)` which allowed to get timestamps as float: timestamps remain integers by default. Only `st.st_atime`, `st.st_ctime` and `st.st_mtime` can be float. `st[7]`, `st[8]` and `st[9]` are always integers, for **backward compatibility**.\n* Python 2.5 switched timestamps to float by default.\n* Python 3.3 added `st_atime_ns`, `st_ctime_ns` and `st_mtime_ns`.\n\nSo timestamps are stored in 3 formats in Python 3.15:\n\n* integer (tuple API: seconds) for backward compatibility with Python 2.2 and older (yep, that's quite old!);\n* float for `st_[acm]time` (seconds);\n* integer for `st_[acm]time_ns` (nanoseconds).\n\nI would prefer to deprecate this tuple API. It's time to move on to named attributes introduced in Python 2.3!\n\n---\n\nLast years, new `structseq` objects were added with the tuple API even if these new objects didn't have to provide a backward compatibility with a previous tuple API. It's just because `structseq` doesn't give the choice, the tuple API is always provided.\n\n---\n\nBy the way, later, `_PyNamespace_New()` and `types.SimpleNamespace` were added to Python 3.3 to create a simple object with attributes from a dictionary (attribute name => attribute value). For example, `sys.implementation` uses this API.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-155359\n* gh-155362\n* gh-155364\n* gh-155366\n* gh-155367\n* gh-155368\n* gh-155510\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2026-08-07T17:59:40Z","url":"https://github.com/python/cpython/issues/155358"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:326d4de4-49de-f5b4-3bdc-96c9c07022de
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD182:4BB79:40F0EA9:52D50CB:6B022F3A
html-safe-noncebbc2725bf0307b0df19e469735ecd410eed06eea8ffbc15c31da93e6a5136c12
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTgyOjRCQjc5OjQwRjBFQTk6NTJENTBDQjo2QjAyMkYzQSIsInZpc2l0b3JfaWQiOiI5MTMxMjM5NTU3MDE3MjUxNjQyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac71203f7aba9ee0e44e2e0803af153294812569ceadf13be561f4df6de5a3d468
hovercard-subject-tagissue:5092739998
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/155358/issue_layout
twitter:imagehttps://opengraph.githubassets.com/09fa05638d881bade2aea6feddbe8dee387763c55bfe057a52fbf7265387d775/python/cpython/issues/155358
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/09fa05638d881bade2aea6feddbe8dee387763c55bfe057a52fbf7265387d775/python/cpython/issues/155358
og:image:altHi, I propose deprecating the tuple API (object[index]) of the following structseq objects: _interpchannels.ChannelInfo _lsprof.profiler_entry _lsprof.profiler_subentry _thread._ExceptHookArgs grp....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevstinner
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
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
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/155358#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F155358
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F155358
Sign uphttps://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/155358
Reloadhttps://github.com/python/cpython/issues/155358
Reloadhttps://github.com/python/cpython/issues/155358
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/155358
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/155358
Deprecate the tuple API (object[index]) of structseq types (ex: os.stat_result)https://github.com/python/cpython/issues/155358#top
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Aug 7, 2026https://github.com/python/cpython/issues/155358#issue-5092739998
gh-155358: [WIP] Deprecate tuple API of structseq objects #155359https://github.com/python/cpython/pull/155359
gh-155358: Use named attributes with pwd and grp modules #155362https://github.com/python/cpython/pull/155362
gh-155358: Use named attributes with urllib.parse module #155364https://github.com/python/cpython/pull/155364
gh-155358: Use named attributes with os module #155366https://github.com/python/cpython/pull/155366
gh-155358: Use named attributes with test.support.script_helper #155367https://github.com/python/cpython/pull/155367
gh-155358: Convert sys structseq types to heap types #155368https://github.com/python/cpython/pull/155368
gh-155358: Add test.support.check_immutable_type() #155510https://github.com/python/cpython/pull/155510
vstinnerhttps://github.com/vstinner
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Aug 7, 2026https://github.com/python/cpython/issues/155358#event-29133464538
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Aug 7, 2026https://github.com/python/cpython/issues/155358#issuecomment-5220826476
https://discuss.python.org/t/deprecate-the-tuple-api-object-index-of-structseq-objects-like-os-stat-result/108464https://discuss.python.org/t/deprecate-the-tuple-api-object-index-of-structseq-objects-like-os-stat-result/108464
picnixzhttps://github.com/picnixz
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
on Aug 7, 2026https://github.com/python/cpython/issues/155358#event-29141163344
vstinnerhttps://github.com/vstinner
on Aug 7, 2026https://github.com/python/cpython/issues/155358#event-29143502878
pythongh-155358: Convert sys structseq types to heap typeshttps://github.com/vstinner/cpython/commit/7b531b6ed6800844e33c68bab3074f21e820964f
pythongh-155358https://github.com/python/cpython/issues/155358
7b531b6https://github.com/vstinner/cpython/commit/7b531b6ed6800844e33c68bab3074f21e820964f
pythongh-155358: Convert sys structseq types to heap typeshttps://github.com/vstinner/cpython/commit/713244ea8c672cba03adc3c48385da6ea45e9130
pythongh-155358https://github.com/python/cpython/issues/155358
713244ehttps://github.com/vstinner/cpython/commit/713244ea8c672cba03adc3c48385da6ea45e9130
gh-155358: Use named attributes with test.support.script_helper (#155367https://github.com/python/cpython/commit/38235c0e8034467b9589748161d9f8ebe74d6471
gh-155358https://github.com/python/cpython/issues/155358
#155367https://github.com/python/cpython/pull/155367
38235c0https://github.com/python/cpython/commit/38235c0e8034467b9589748161d9f8ebe74d6471
gh-155358: Use named attributes with pwd and grp modules (#155362)https://github.com/python/cpython/commit/f8cfa0cd593a0034628e36bd5b5e082af6541a78
gh-155358https://github.com/python/cpython/issues/155358
#155362https://github.com/python/cpython/pull/155362
f8cfa0chttps://github.com/python/cpython/commit/f8cfa0cd593a0034628e36bd5b5e082af6541a78
gh-155358: Use named attributes with os module (#155366)https://github.com/python/cpython/commit/2e519ddf413018582436ca1600994887ef2345ea
gh-155358https://github.com/python/cpython/issues/155358
#155366https://github.com/python/cpython/pull/155366
2e519ddhttps://github.com/python/cpython/commit/2e519ddf413018582436ca1600994887ef2345ea
gh-155358: Add test.support.check_immutable_type() (#155510)https://github.com/python/cpython/commit/219768ff531fc0686de623139562ee9f9537df98
gh-155358https://github.com/python/cpython/issues/155358
#155510https://github.com/python/cpython/pull/155510
219768fhttps://github.com/python/cpython/commit/219768ff531fc0686de623139562ee9f9537df98
mbeijenhttps://github.com/mbeijen
on Aug 14, 2026https://github.com/python/cpython/issues/155358#event-29455504792
pythongh-155358: Use named attributes with test.support.script_helper (…https://github.com/mbeijen/cpython/commit/f381c9eff19c6cdc5cecdfeaf19f1ea64e8a88ce
pythongh-155358https://github.com/python/cpython/issues/155358
…https://github.com/python/cpython/pull/155367
f381c9ehttps://github.com/mbeijen/cpython/commit/f381c9eff19c6cdc5cecdfeaf19f1ea64e8a88ce
pythongh-155358: Use named attributes with pwd and grp modules (pytho…https://github.com/mbeijen/cpython/commit/d20b79f49ee18641b65a4b8812133efae6d967c5
pythongh-155358https://github.com/python/cpython/issues/155358
pytho…https://github.com/python/cpython/pull/155362
d20b79fhttps://github.com/mbeijen/cpython/commit/d20b79f49ee18641b65a4b8812133efae6d967c5
pythongh-155358: Use named attributes with os module (python#155366)https://github.com/mbeijen/cpython/commit/4f804907eadb7fb46845eac073df6901618de1dd
pythongh-155358https://github.com/python/cpython/issues/155358
python#155366https://github.com/python/cpython/pull/155366
4f80490https://github.com/mbeijen/cpython/commit/4f804907eadb7fb46845eac073df6901618de1dd
pythongh-155358: Add test.support.check_immutable_type() (python#155510)https://github.com/mbeijen/cpython/commit/f77bdfdd6075f82eba0ef6f7d878c364b7f86b76
pythongh-155358https://github.com/python/cpython/issues/155358
python#155510https://github.com/python/cpython/pull/155510
f77bdfdhttps://github.com/mbeijen/cpython/commit/f77bdfdd6075f82eba0ef6f7d878c364b7f86b76
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Aug 31, 2026https://github.com/python/cpython/issues/155358#issuecomment-5482084508
https://discuss.python.org/t/deprecate-the-tuple-api-object-index-of-structseq-objects-like-os-stat-result/108464/19https://discuss.python.org/t/deprecate-the-tuple-api-object-index-of-structseq-objects-like-os-stat-result/108464/19
vstinnerhttps://github.com/vstinner
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 31, 2026https://github.com/python/cpython/issues/155358#event-30295169703
vstinnerhttps://github.com/vstinner
on Aug 31, 2026https://github.com/python/cpython/issues/155358#event-30296552135
gh-155358: Use named attributes with urllib.parse module (#155364)https://github.com/python/cpython/commit/1855c6c40b02a5c8e75de2832dbb6cbd24351f1b
gh-155358https://github.com/python/cpython/issues/155358
#155364https://github.com/python/cpython/pull/155364
1855c6chttps://github.com/python/cpython/commit/1855c6c40b02a5c8e75de2832dbb6cbd24351f1b
clin1234https://github.com/clin1234
on Sep 12, 2026https://github.com/python/cpython/issues/155358#event-31023913759
pythongh-155358: Use named attributes with urllib.parse module (pytho…https://github.com/clin1234/cpython/commit/89fb164a2e0a619f466887889f76b662dcade749
pythongh-155358https://github.com/python/cpython/issues/155358
pytho…https://github.com/python/cpython/pull/155364
89fb164https://github.com/clin1234/cpython/commit/89fb164a2e0a619f466887889f76b662dcade749
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/155358
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/155358
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%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.