René's URL Explorer Experiment


Title: Bytecode compilation output depends on order of files compiled · Issue #129724 · python/cpython · GitHub

Open Graph Title: Bytecode compilation output depends on order of files compiled · Issue #129724 · python/cpython

X Title: Bytecode compilation output depends on order of files compiled · Issue #129724 · python/cpython

Description: This is minimal reproduction of this downstream bug report: astral-sh/uv#10619 The output of compileall.compile_file depends on the order in which the files are compiled. This means compilation is non-deterministic if builds are distribu...

Open Graph Description: This is minimal reproduction of this downstream bug report: astral-sh/uv#10619 The output of compileall.compile_file depends on the order in which the files are compiled. This means compilation is ...

X Description: This is minimal reproduction of this downstream bug report: astral-sh/uv#10619 The output of compileall.compile_file depends on the order in which the files are compiled. This means compilation is ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bytecode compilation output depends on order of files compiled","articleBody":"This is minimal reproduction of this downstream bug report: https://github.com/astral-sh/uv/issues/10619\n\nThe output of `compileall.compile_file` depends on the order in which the files are compiled. This means compilation is non-deterministic if builds are distributed over a process pool.\n\nThis becomes a problem when building docker images, where you usually bytecode compile ahead of time for faster startup, and where the hash of the image depends on all files in the image, including the `.pyc` files.\n\nSpecifically, the output of \n\n```python\na = {\"foo\", 2, 3}\n\ndef f():\n    b = {\"foo\", 2, 3}\n```\n\nis different if we previously compiled another file with \n\n```python\nimport foo\n```\n\nReproducer script:\n\n```shell\n#!/bin/bash\n\nset -e\n\nscript=$(cat \u003c\u003c EOF\nimport compileall\nimport sys\n\nfor path in sys.argv[1:]:\n    compileall.compile_file(path)\nEOF\n)\n\ncat \u003c\u003c EOF > a.py\nimport foo\nEOF\n\ncat \u003c\u003c EOF > b.py\na = {\"foo\", 2, 3}\n\ndef f():\n    b = {\"foo\", 2, 3}\nEOF\n\n# Both files\nrm -rf __pycache__\npython3.14 -c \"$script\" a.py b.py\nsha256sum __pycache__/b.cpython-314.pyc\n\n# For debugging\ncp __pycache__/b.cpython-314.pyc b1.cpython-314.pyc\n\n# Single file only\nrm -rf __pycache__\npython3.14 -c \"$script\" b.py\nsha256sum __pycache__/b.cpython-314.pyc\n\n# For debugging\ncp __pycache__/b.cpython-314.pyc b2.cpython-314.pyc\n\n```\n\nThis is caused be different refcounts in the marshalled files:\n\n```python\nimport marshal\nimport sys\n\nwith open(\"b1.cpython-313.pyc\", \"rb\") as f:\n  f.read(16)  # Skip header\n  pyc1 = marshal.load(f)\n\nwith open(\"b2.cpython-313.pyc\", \"rb\") as f:\n  f.read(16)  # Skip header\n  pyc2 = marshal.load(f)\n\nprint(sys.getrefcount(pyc1.co_consts[0]))\nprint(sys.getrefcount(pyc2.co_consts[0]))\n```\n\nThis prints `2` and `3`.\n\nThe original report is from 3.13, i've reproduced it with 3.14.0a4. It happens at least on linux and windows.\n\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-156862\n* gh-159192\n* gh-159193\n* gh-159290\n* gh-159291\n* gh-160628\n* gh-161457\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/konstin","@type":"Person","name":"konstin"},"datePublished":"2025-02-06T12:42:34Z","url":"https://github.com/python/cpython/issues/129724"}

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:a31a80c1-e4c4-8fb5-c17b-628f898befc0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD7EC:3F8AB1:4189009:532F603:6B02086E
html-safe-nonce0d41aaf3d49de5a018d12454fba933480b68a609d55f550e2e284386076c6318
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0VDOjNGOEFCMTo0MTg5MDA5OjUzMkY2MDM6NkIwMjA4NkUiLCJ2aXNpdG9yX2lkIjoiODU4MDM2ODI1NDIyMzEyNDU5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd27084945088c594eeda9c9180c1d6c7f565fab674078d9d4701616363be14ce
hovercard-subject-tagissue:2835430488
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/129724/issue_layout
twitter:imagehttps://opengraph.githubassets.com/661be5202b1debee5408ef1276cd160867231de92fa275150dc03258868eb4cc/python/cpython/issues/129724
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/661be5202b1debee5408ef1276cd160867231de92fa275150dc03258868eb4cc/python/cpython/issues/129724
og:image:altThis is minimal reproduction of this downstream bug report: astral-sh/uv#10619 The output of compileall.compile_file depends on the order in which the files are compiled. This means compilation is ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekonstin
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/129724#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F129724
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%2F129724
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/129724
Reloadhttps://github.com/python/cpython/issues/129724
Reloadhttps://github.com/python/cpython/issues/129724
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/129724
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/129724
Bytecode compilation output depends on order of files compiledhttps://github.com/python/cpython/issues/129724#top
https://github.com/gpshead
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/konstin
konstinhttps://github.com/konstin
on Feb 6, 2025https://github.com/python/cpython/issues/129724#issue-2835430488
astral-sh/uv#10619https://github.com/astral-sh/uv/issues/10619
gh-129724: Make marshalled code output deterministic #156862https://github.com/python/cpython/pull/156862
gh-129724: gh-156504: Make marshal output independent of reference counts #159192https://github.com/python/cpython/pull/159192
gh-129724: Intern string constants in the compiler, not per code object #159193https://github.com/python/cpython/pull/159193
[3.15] gh-129724: gh-156504: Make marshal output independent of reference counts (GH-159192) #159290https://github.com/python/cpython/pull/159290
[3.15] gh-129724: Intern string constants in the compiler, not per code object (GH-159193) #159291https://github.com/python/cpython/pull/159291
gh-129724: improve the news entry wording for gh-159192 and gh-159193 #160628https://github.com/python/cpython/pull/160628
gh-129724: Intern code object names before merging them with constants #161457https://github.com/python/cpython/pull/161457
Nexthttps://github.com/python/cpython/issues/129724?timeline_page=1
konstinhttps://github.com/konstin
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Feb 6, 2025https://github.com/python/cpython/issues/129724#event-16209387761
encukouhttps://github.com/encukou
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Feb 6, 2025https://github.com/python/cpython/issues/129724#event-16211154732
https://github.com/encukou
encukouhttps://github.com/encukou
on Feb 6, 2025https://github.com/python/cpython/issues/129724#issuecomment-2640037450
#78274 (comment)https://github.com/python/cpython/issues/78274#issuecomment-2007066102
https://github.com/konstin
konstinhttps://github.com/konstin
on Feb 6, 2025https://github.com/python/cpython/issues/129724#issuecomment-2640052531
https://github.com/encukou
encukouhttps://github.com/encukou
on Feb 6, 2025https://github.com/python/cpython/issues/129724#issuecomment-2640071787
khmyznikovhttps://github.com/khmyznikov
on Sep 1, 2026https://github.com/python/cpython/issues/129724#event-30379697971
pythongh-129724: Stabilize marshal refleak regressionhttps://github.com/khmyznikov/cpython/commit/eae9b877a763e6b0be0e514a0e1376027db5ba03
pythongh-129724https://github.com/python/cpython/issues/129724
eae9b87https://github.com/khmyznikov/cpython/commit/eae9b877a763e6b0be0e514a0e1376027db5ba03
pythongh-129724: Limit constant cache changes to free-threaded buildshttps://github.com/khmyznikov/cpython/commit/3f056a9782eb3c58b758f999f98917b0127622c9
pythongh-129724https://github.com/python/cpython/issues/129724
3f056a9https://github.com/khmyznikov/cpython/commit/3f056a9782eb3c58b758f999f98917b0127622c9
https://github.com/gpshead
gpsheadhttps://github.com/gpshead
on Oct 4, 2026https://github.com/python/cpython/issues/129724#issuecomment-5975046827
https://github.com/methane
methanehttps://github.com/methane
on Oct 4, 2026https://github.com/python/cpython/issues/129724#issuecomment-5975867202
https://github.com/tran4774
tran4774https://github.com/tran4774
on Oct 8, 2026https://github.com/python/cpython/issues/129724#issuecomment-6053361383
gh-156862https://github.com/python/cpython/pull/156862
gpsheadhttps://github.com/gpshead
on Oct 11, 2026https://github.com/python/cpython/issues/129724#event-32996893943
gpsheadhttps://github.com/gpshead
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
on Oct 11, 2026https://github.com/python/cpython/issues/129724#event-33000293860
gpsheadhttps://github.com/gpshead
on Oct 13, 2026https://github.com/python/cpython/issues/129724#event-33101798056
gh-129724: Intern string constants in the compiler, not per code obje…https://github.com/python/cpython/commit/627eabf31cf9a2ab39761492493e1e06a6526e9b
gh-129724https://github.com/python/cpython/issues/129724
627eabfhttps://github.com/python/cpython/commit/627eabf31cf9a2ab39761492493e1e06a6526e9b
pythongh-159184: Make the marshal order of set elements with equal du…https://github.com/gpshead/cpython/commit/b3dea86b74fba41bdf21da08c68cecc55d66f21b
pythongh-159184https://github.com/python/cpython/issues/159184
b3dea86https://github.com/gpshead/cpython/commit/b3dea86b74fba41bdf21da08c68cecc55d66f21b
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/129724#event-33592106439
github-project-automationhttps://github.com/apps/github-project-automation
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/129724
github-project-automationhttps://github.com/apps/github-project-automation
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/129724
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/129724#event-33592171092
gpsheadhttps://github.com/gpshead
on Oct 24, 2026https://github.com/python/cpython/issues/129724#event-34155559927
[3.15] pythongh-129724: pythongh-156504: Make marshal output independ…https://github.com/gpshead/cpython/commit/8fb8fc3cac793bb66f04a8b58d6eba87402fc7dc
pythongh-129724https://github.com/python/cpython/issues/129724
pythongh-156504https://github.com/python/cpython/issues/156504
8fb8fc3https://github.com/gpshead/cpython/commit/8fb8fc3cac793bb66f04a8b58d6eba87402fc7dc
gh-129724: improve the news entry wording for gh-159192 and gh-159193 (…https://github.com/python/cpython/commit/081f6fba35f2b1be8a3166104237f9682b620f90
gh-129724https://github.com/python/cpython/issues/129724
gh-159192https://github.com/python/cpython/pull/159192
gh-159193https://github.com/python/cpython/pull/159193
…https://github.com/python/cpython/pull/160628
081f6fbhttps://github.com/python/cpython/commit/081f6fba35f2b1be8a3166104237f9682b620f90
gpsheadhttps://github.com/gpshead
on Nov 1, 2026https://github.com/python/cpython/issues/129724#event-34811712302
gh-159184: Make the marshal order of set elements with equal dumps st…https://github.com/python/cpython/commit/3c23ebfdf7750cff757e50e6e8c753f89ce849c6
gh-159184https://github.com/python/cpython/issues/159184
3c23ebfhttps://github.com/python/cpython/commit/3c23ebfdf7750cff757e50e6e8c753f89ce849c6
aiskhttps://github.com/aisk
compileall isn't reproducible #161434https://github.com/python/cpython/issues/161434
on Nov 5, 2026https://github.com/python/cpython/issues/129724#event-35266835407
https://github.com/rossburton
rossburtonhttps://github.com/rossburton
on Nov 5, 2026https://github.com/python/cpython/issues/129724#issuecomment-6664586945
https://github.com/gpshead
gpsheadhttps://github.com/gpshead
on Nov 5, 2026https://github.com/python/cpython/issues/129724#issuecomment-6670027819
gpsheadhttps://github.com/gpshead
on Nov 10, 2026https://github.com/python/cpython/issues/129724#event-35703780799
gh-129724: Intern code object names before merging them with constants (https://github.com/python/cpython/commit/bb8d4fcba98d6aa259e35d401d9748ad231fe106
gh-129724https://github.com/python/cpython/issues/129724
bb8d4fchttps://github.com/python/cpython/commit/bb8d4fcba98d6aa259e35d401d9748ad231fe106
orsenthilhttps://github.com/orsenthil
on Nov 12, 2026https://github.com/python/cpython/issues/129724#event-35872104919
pythongh-129724: Intern code object names before merging them with co…https://github.com/orsenthil/cpython/commit/52951518f162aa18af8cffac2fd54ba9d1609d22
pythongh-129724https://github.com/python/cpython/issues/129724
5295151https://github.com/orsenthil/cpython/commit/52951518f162aa18af8cffac2fd54ba9d1609d22
Li-DongLiang-YunPohttps://github.com/Li-DongLiang-YunPo
on Nov 19, 2026https://github.com/python/cpython/issues/129724#event-36629719075
Merge branch feature/remove-office-wasm-032 into preview/0.3.2https://github.com/alibaba-damo-academy/ScholarSeed/commit/55689097cb39695e8eaa4f5f75383754d72f66eb
5568909https://github.com/alibaba-damo-academy/ScholarSeed/commit/55689097cb39695e8eaa4f5f75383754d72f66eb
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/129724
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/129724
gpsheadhttps://github.com/gpshead
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
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.