This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ammar2, bmwiedemann, matrixise, vstinner, xtreak
Date 2020-04-29.17:13:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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')

Using 64-bit timestamp (PR 19651), treat timestamp as unsigned (PR 9892 and PR 19708) have drawback:

* 64-bit timestamp make .pyc files larger
* unsigned timestamp no longer support timestamp before 1969 which can cause practical issues

"& 0xFFFFFFFF" looks dead simple, uses a fixed size of 4 bytes and doesn't have any limitation of year 2038.

The timestamp doesn't have to be exact. In practice, it sounds very unlikely that two timestamps are equal when compared using (ts1 & 0xFFFFFFFF) == (ts2 & 0xFFFFFFFF). I expect file modification times to be close by a few days, not separated by 2**32 seconds (136 years).

Use hash based .pyc to avoid any issuse with file modification time: it should make Python more deterministic (more "reproducible").
Date User Action Args
2020-04-29 17:13:16vstinnersetrecipients: + vstinner, matrixise, bmwiedemann, ammar2, xtreak
2020-04-29 17:13:16vstinnersetmessageid: <>
2020-04-29 17:13:16vstinnerlinkissue34990 messages
2020-04-29 17:13:16vstinnercreate