Skip to content

[3.8] bpo-37500: Make sure dead code does not generate bytecode but also detect syntax errors (GH-14612)#15002

Merged
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-18c5f9d-3.8
Jul 29, 2019
Merged

[3.8] bpo-37500: Make sure dead code does not generate bytecode but also detect syntax errors (GH-14612)#15002
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-18c5f9d-3.8

Conversation

@miss-islington

@miss-islington miss-islington commented Jul 29, 2019

Copy link
Copy Markdown
Contributor

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

…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>
@miss-islington

Copy link
Copy Markdown
Contributor Author

@pablogsal: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 9ea738e into python:3.8 Jul 29, 2019
@miss-islington miss-islington deleted the backport-18c5f9d-3.8 branch July 29, 2019 14:47
@miss-islington

Copy link
Copy Markdown
Contributor Author

@pablogsal: Status check is done, and it's a success ✅ .

1 similar comment
@miss-islington

Copy link
Copy Markdown
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants