Skip to content

bpo-34990: Treat the pyc header's mtime in compileall as an unsigned int - #19708

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
ammaraskar:compileall_Y23K
Aug 24, 2021
Merged

bpo-34990: Treat the pyc header's mtime in compileall as an unsigned int#19708
serhiy-storchaka merged 3 commits into
python:mainfrom
ammaraskar:compileall_Y23K

Conversation

@ammaraskar

@ammaraskarammaraskar commented Apr 25, 2020

Copy link
Copy Markdown
Member

Created with @matrixise's blessing to continue their work. This is an alternative to changing the timestamps to 64-bit. Should last for a while.

I didn't update Tools/checkpyc.py like the original PR there pending a decision on a bug I made to remove it

https://bugs.python.org/issue34990

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to mimick importlib._bootstrap_external which uses:

def _pack_uint32(x):
"""Convert a 32-bit integer to little-endian."""
return (int(x) & 0xFFFFFFFF).to_bytes(4, 'little')

@serhiy-storchaka

Copy link
Copy Markdown
Member

See my comments to #9892. If they be addressed it would be merged a long time ago.

Comment threadLib/compileall.py Outdated
Comment threadLib/test/test_compileall.py Outdated
Comment threadLib/test/test_zipimport.py Outdated
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
@ammaraskar

Copy link
Copy Markdown
MemberAuthor

Updated to just drop the number down to the lower 32-bits like importlib._bootstrap_external

Not sure if the new test I added is safe though, as in can we assume that file-systems in general will support timestamps of larger than 32-bit?

Comment threadLib/test/test_compileall.py Outdated
Comment threadLib/test/test_compileall.py Outdated
Comment threadLib/test/test_zipimport.py
Comment threadLib/test/test_zipimport.py Outdated

@serhiy-storchakaserhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment threadLib/test/test_compileall.py Outdated
Comment threadMisc/NEWS.d/next/Library/2020-04-24-20-39-38.bpo-34990.3SmL9M.rst Outdated
@ammaraskar

Copy link
Copy Markdown
MemberAuthor

@serhiy-storchaka Just a little ping, is this ready to go or are there any other changes that should be made here?

@ammaraskarammaraskar added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 23, 2021
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @ammaraskar for commit 91b54fd 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 23, 2021
@serhiy-storchakaserhiy-storchaka added needs backport to 3.9 needs backport to 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Aug 24, 2021
@serhiy-storchaka

Copy link
Copy Markdown
Member

Sorry, I missed that this PR was not merged yet.

@serhiy-storchaka

Copy link
Copy Markdown
Member

@ammaraskar, please merge this branch with main.

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @ammaraskar for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 24, 2021
…int (pythonGH-19708)
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
(cherry picked from commit bb21e28)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
@bedevere-bot

Copy link
Copy Markdown

GH-27928 is a backport of this pull request to the 3.10 branch.

@bedevere-bot

Copy link
Copy Markdown

GH-27929 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 24, 2021
…int (pythonGH-19708)
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
(cherry picked from commit bb21e28)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
@ammaraskar

Copy link
Copy Markdown
MemberAuthor

Thank you for merging Serhiy, I was asleep when you LGTM'd :)

ammaraskar added a commit that referenced this pull request Aug 24, 2021
…igned int (GH-19708)
(cherry picked from commit bb21e28)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
ammaraskar added a commit that referenced this pull request Aug 24, 2021
…signed int (GH-19708)
(cherry picked from commit bb21e28)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
@ammaraskar
ammaraskar deleted the compileall_Y23K branch August 24, 2021 15:12
@bmwiedemannbmwiedemannmannequin mentioned this pull request Apr 10, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bugAn unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@ammaraskar@serhiy-storchaka@bedevere-bot@miss-islington@vstinner@the-knights-who-say-ni