Skip to content

[3.8] bpo-42644: Validate values in logging.disable() (GH-23786)#23797

Merged
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-b32d8b4-3.8
Dec 16, 2020
Merged

[3.8] bpo-42644: Validate values in logging.disable() (GH-23786)#23797
miss-islington merged 1 commit into
python:3.8from
miss-islington:backport-b32d8b4-3.8

Conversation

@miss-islington

@miss-islington miss-islington commented Dec 16, 2020

Copy link
Copy Markdown
Contributor
  • 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
(cherry picked from commit b32d8b4)

Co-authored-by: Matthias Bussonnier bussonniermatthias@gmail.com

https://bugs.python.org/issue42644

* 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>
(cherry picked from commit b32d8b4)

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
@miss-islington

Copy link
Copy Markdown
Contributor Author

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

@miss-islington

Copy link
Copy Markdown
Contributor Author

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

@miss-islington miss-islington merged commit 0a24a57 into python:3.8 Dec 16, 2020
@miss-islington miss-islington deleted the backport-b32d8b4-3.8 branch December 16, 2020 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants