[3.8] bpo-37500: Make sure dead code does not generate bytecode but also detect syntax errors (GH-14612)#15002
Merged
Conversation
…tect syntax errors (pythonGH-14612) https://bugs.python.org/issue37500 Add a new field to the compiler structure that allows to be configured so no bytecode is emitted. In this way is possible to detect errors by walking the nodes while preserving optimizations. https://bugs.python.org/issue37500 (cherry picked from commit 18c5f9d) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
pablogsal
approved these changes
Jul 29, 2019
Contributor
Author
|
@pablogsal: Status check is done, and it's a success ✅ . |
Contributor
Author
|
@pablogsal: Status check is done, and it's a success ✅ . |
1 similar comment
Contributor
Author
|
@pablogsal: Status check is done, and it's a success ✅ . |
tonyandrewmeyer
added a commit
to canonical/operator
that referenced
this pull request
Jun 9, 2026
The key line here is the `-W error` in `tox.ini`. That raises all warnings (the most common are deprecation and resource) to errors, when running the unit tests. The bulk of the rest of the PR is cleaning up tests (and one docstring, because we test those too, via doctest) to properly clean up resources. The changes not in the tests (or docs) need more careful examination: * in `ops.storage` we wrap setup so that if opening the database fails, we properly clean up. Should never happen in practice (no other process should be touching the db) and even if it did, we would close on the crash, but better to tidily manage it, and this also fixes test cases. * in `ops._main` when instantiating the charm if something goes wrong (like the charm `__init__` raising) cleanly close the framework. Definitely could happen in practice, but we would close everyone on the crash. Doing it explicitly is cleaner in general, and helps when running tests. * in `ops.pebble` when handling garage coming back from Pebble, the `urllib.error.HTTPError` is also a response object and carries the open HTTP response body in e.fp (we use it already with `.read()` and so on). Under Python 3.14 there's a tempfile (python/cpython#15002, which looks unrelated but look at the code) so we get a warning on exit for failing to clean up. This could happen in production with a broken Pebble, although again no real consequence, but nice to clean up for the tests and correctness. --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue37500
Add a new field to the compiler structure that allows to be configured
so no bytecode is emitted. In this way is possible to detect errors by
walking the nodes while preserving optimizations.
https://bugs.python.org/issue37500
(cherry picked from commit 18c5f9d)
Co-authored-by: Pablo Galindo Pablogsal@gmail.com
https://bugs.python.org/issue37500