bpo-31975 (PEP 565): Show DeprecationWarning in __main__#4458
Conversation
|
@brettcannon Something I noticed while making this, is that we don't currently have a test that ensures the C level filter initialisation is consistent with the Python level default filter initialisation at https://github.com/python/cpython/blob/3.6/Lib/warnings.py#L506 I'm thinking this may be a good opportunity to address that, by adding a variant of the test added by the PR that forces the subprocess to reload the Python warnings module without the C accelerator module before printing the contents of the filter list. |
Sorry, something went wrong.
|
It's also suspicious that |
Sorry, something went wrong.
|
It would probably be easier to refactor that code into a function so that you can write a test which tracks what changed in Python prior to launching. |
Sorry, something went wrong.
2e6f917 to
661cc5c
Compare
December 6, 2017 08:37
661cc5c to
7210640
Compare
December 30, 2017 04:48
- primary change is to add a new default filter entry for 'default::DeprecationWarning:__main__' - secondary change is an internal one to cope with plain strings in the warning module's internal filter list (this avoids the need to create a compiled regex object early on during interpreter startup)
While CPython doesn't implicitly import `warnings` at startup, some other implementations might do so. Explicitly clearing the module cache ensures the subprocess also gets the pure Python version, no matter what.
d1dbf6d to
39200c3
Compare
December 30, 2017 05:02
|
I worked out why the new test was passing even though I hadn't updated the pure Python implementation: the pure Python version wasn't configuring the new The PR has been rebased on the current master branch, and I've fixed the issue reference to point to the right place. |
Sorry, something went wrong.
|
The Windows failure looks like it's just due to the fact I'm not using universal newlines mode when reading data from the subprocess, so the Windows line endings are confusing matters. |
Sorry, something went wrong.
|
@vstinner @brettcannon OK, I think this should be ready for review now - I think I've covered all the doc updates I proposed in the PEP (with a few other cleanups along the way), and the last commit will hopefully fix the line ending problem on Windows. |
Sorry, something went wrong.
default::DeprecationWarning:__main__strings in the warning module's internal filter list
(this avoids the need to create a compiled regex object
early on during interpreter startup)
https://bugs.python.org/issue31975