diff options
author | Matthias Bussonnier <bussonniermatthias@gmail.com> | 2020-12-16 09:43:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 09:43:39 (GMT) |
commit | b32d8b4f9bcd2e7d11240b6b9de0262cf8f5e09d (patch) | |
tree | 93929faaa993c0a8de14e46bf1991b1e7805c49a /Misc | |
parent | 3f9fe23c05280dc5736c07bb0e968cdaf8c503d0 (diff) | |
download | cpython-b32d8b4f9bcd2e7d11240b6b9de0262cf8f5e09d.zip cpython-b32d8b4f9bcd2e7d11240b6b9de0262cf8f5e09d.tar.gz cpython-b32d8b4f9bcd2e7d11240b6b9de0262cf8f5e09d.tar.bz2 |
bpo-42644: Validate values in logging.disable() (#23786)
* bpo-42644: Validate values in logging.disable()
Technically make the value of manager a property that checks and convert
values assigned to it properly. This has the side effect of making
`logging.disable` also accept strings representing the various level of
warnings.
We want to validate the type of the disable attribute at assignment
time, as it is later compared to other levels when emitting warnings and
would generate a `TypeError: '>=' not supported between ....` in a
different part of the code base, which can make it difficult to track
down.
When assigned an incorrect value; it will raise a TypeError when the
wrong type, or ValueError if an invalid str.
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2020-12-15-10-00-04.bpo-42644.XgLCNx.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2020-12-15-10-00-04.bpo-42644.XgLCNx.rst b/Misc/NEWS.d/next/Library/2020-12-15-10-00-04.bpo-42644.XgLCNx.rst new file mode 100644 index 0000000..f58b58e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-12-15-10-00-04.bpo-42644.XgLCNx.rst @@ -0,0 +1,3 @@ +`logging.disable` will now validate the types and value of its parameter. It +also now accepts strings representing the levels (as does `loging.setLevel`) +instead of only the numerical values. |