GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-29514: Check magic number for bugfix release by appeltel · Pull Request #54 · python/cpython Conversation
|
| (2, 7): 62211, | ||
| (3, 5): 3350, | ||
| (3, 6): 3379 | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'd put this table in the test suite rather than in the code - there's no need to have it other than the bytecode stability test case, and if it hasn't been updated when it needs to be we'll get a test failure anyway.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Simplifed to a sigle entry in the test case in 9ea7c52
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| from ._bootstrap import _resolve_name | ||
| from ._bootstrap import spec_from_loader | ||
| from ._bootstrap import _find_spec | ||
| from ._bootstrap_external import EXPECTED_MAGIC_NUMBERS |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
With the table moved to the test suite, this won't be needed any more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
removed in 9ea7c52
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| In exceptional cases, it may be required to change the MAGIC_NUMBER | ||
| for a maintenance release. In this case the change should be | ||
| discussed in dev-python. If a change is required, community |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
dev-python -> python-dev
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
fixed in 9ea7c52
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| EXPECTED_MAGIC_NUMBERS = { | ||
| (2, 7): 62211, | ||
| (3, 5): 3350, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does this mean we're reverting the magic number bump from 3.5.3?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No, but the current special case from the test should just be moved directly into the table of expected magic numbers with a suitable comment.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Simplify the magic number release test by removing EXPECTED_MAGIC_NUMBERS table and making the expected magic number self-contained within the test. BPO: 29514
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty close now, just a couple of suggestions around details of the test execution.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ) = util.test_both(PEP3147Tests, util=importlib_util) | ||
|
|
||
|
|
||
| class MagicNumberTests: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Inherit from unittest.TestCase here
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I initially avoided this and followed the test machinery as I wasn't sure about directly importing importlib.util within this test module, but after looking at the way the test specialization works I don't see how this is an issue. Changed in 1e32a1b.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this module does some interesting things to create "real" test classes in different configurations, but we don't need those kinds of tricks for the new test.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| adjustment to this test case. | ||
| """ | ||
| if sys.version_info.releaselevel not in ('final', 'candidate'): | ||
| return |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This can change to a unittest.skipUnless decorator on the testmethod:
@unittest.skipUnless(sys.version_info.release in ('final', 'release'), 'Only check magic number stability for release candidates and later')
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Done in 1e32a1b
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| actual = int.from_bytes(self.util.MAGIC_NUMBER[:2], 'little') | ||
|
|
||
| msg = ( | ||
| "Candidate and final releases require the current " |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'd start this message with "To avoid breaking backwards compatibility with cached bytecode files that can't be automatically regenerated by the current user, ..."
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Added in 1e32a1b
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Improve the execution of the magic number test by using skipUnless for alpha and beta releases, and directly inheriting from unittest.TestCase rather than using the machinery for the other tests. Also improve the error message to explain the reason for caution in changing the magic number. BPO: 29514
Codecov Report
@@ Coverage Diff @@ ## master #54 +/- ## ========================================== - Coverage 82.37% 82.37% -0.01% ========================================== Files 1427 1428 +1 Lines 350948 350968 +20 ========================================== + Hits 289093 289102 +9 - Misses 61855 61866 +11 Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| actual = int.from_bytes(importlib.util.MAGIC_NUMBER[:2], 'little') | ||
|
|
||
| msg = ( | ||
| "To avoid breaking backwards compatibility with cached bytecode " |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be better to use a multiline string literal if you want such verbose error message?
But I think that "broken *.pyc files compatibility" would be enough.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Then you'd have to dedent it, etc. This message is perfectly legible to me.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ) | ||
| def test_magic_number(self): | ||
| """ | ||
| Each python minor release should generally have a MAGIC_NUMBER |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to write this as a comment rather than a docstring. If you want, add a one-line docstring, but most test methods don't have docstrings.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry @appeltel and @ambv, I had trouble checking out the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @appeltel and @ambv, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This was backported a while back, but I missed updating the labels: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
The versions checked here are 20 years old. Also dllwrap has started to emit a deprecation warning in the latest release spamming the build logs. Fixes python#54
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.