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 eric.snow
Recipients barry, brett.cannon, doko, eric.snow, ncoghlan, petr.viktorin
Date 2017-02-11.01:37:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486777031.09.0.952857867061.issue29514@psf.upfronthosting.co.za>
In-reply-to
Content
This is strictly a problem for the system Python, right?  In that case, can't the dist package clear __pycache__ under the system site-packages directory (and any other user-read-only dirs) during install of the updated Python?

Is the concern that upgrading Python may force all .pyc files to be re-written (perhaps unnecessarily)?  If so, I'm not clear on why it's okay between major versions but not minor ones.  Frequency perhaps?  Is the cost of re-compiling all .pyc files (which mostly won't happen all at the same time) significant enough to warrant changing the status quo, particularly since the magic number rarely changes in a minor release?

As one (poor) alternative, we could require re-compiling a .pyc file only if it contains the affected bytecode(s).  Granted, that would probably require associating every bytecode with a magic number.  The required comparison would likely be more expensive than just re-compiling. :/

Another alternative would be to leverage sys.dont_write_bytecode somehow.
History
Date User Action Args
2017-02-11 01:37:11eric.snowsetrecipients: + eric.snow, barry, brett.cannon, doko, ncoghlan, petr.viktorin
2017-02-11 01:37:11eric.snowsetmessageid: <1486777031.09.0.952857867061.issue29514@psf.upfronthosting.co.za>
2017-02-11 01:37:11eric.snowlinkissue29514 messages
2017-02-11 01:37:09eric.snowcreate