Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging docstrings should use bool instead of int for exc_info #114494

Closed
CharString opened this issue Jan 23, 2024 · 5 comments
Closed

logging docstrings should use bool instead of int for exc_info #114494

CharString opened this issue Jan 23, 2024 · 5 comments
Labels
docs Documentation in the Doc dir easy

Comments

@CharString
Copy link
Contributor

CharString commented Jan 23, 2024

The documentation passes an integer as the exc_info parameter:

logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)

But the annotation doesn't allow that.

https://github.com/python/typeshed/blob/2168ab5ff4e40c37505b3e5048944603b71a857d/stdlib/logging/__init__.pyi#L66-L67

Linked PRs

@srittau
Copy link
Contributor

srittau commented Jan 23, 2024

Thank you for the report. The line in question has last been changed 22 years ago, before the introduction of the bool type. The intent is clearly to pass a boolean value, which we annotate using the bool type in typeshed, even if other "truthy"/"falsy" values are also accepted.

The docstrings should probably be updated, though. Cc @gvanrossum

@CharString
Copy link
Contributor Author

I know. And at first True and False were just names bound to 1 and 0, iirc. :)

@JelleZijlstra
Copy link
Member

I agree this should be fixed in CPython. I'll transfer the issue.

@JelleZijlstra JelleZijlstra transferred this issue from python/typeshed Jan 23, 2024
@JelleZijlstra JelleZijlstra added the docs Documentation in the Doc dir label Jan 23, 2024
@JelleZijlstra JelleZijlstra changed the title Discrepancy between logging. {debug, info, ...} docstring and annotation. logging docstrings should use bool instead of int for exc_info Jan 23, 2024
@soufrabi
Copy link

Assign me

@soufrabi
Copy link

There are 6 lines in the file that needs to be changed. Each for different level of logging.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 26, 2024
…14558)

(cherry picked from commit 07236f5)

Co-authored-by: Tristan Pank <tristanpank@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 26, 2024
…14558)

(cherry picked from commit 07236f5)

Co-authored-by: Tristan Pank <tristanpank@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 26, 2024
…14558)

(cherry picked from commit 07236f5)

Co-authored-by: Tristan Pank <tristanpank@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 27, 2024
…14558)

(cherry picked from commit 07236f5)

Co-authored-by: Tristan Pank <tristanpank@gmail.com>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
serhiy-storchaka pushed a commit that referenced this issue Mar 2, 2024
…114558) (GH-114624)

(cherry picked from commit 07236f5)

Co-authored-by: Tristan Pank <tristanpank@gmail.com>
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this issue Mar 2, 2024
…o (GH=114558)

(cherry picked from commit 07236f5)

Co-authored-by: Tristan Pank <tristanpank@gmail.com>
serhiy-storchaka added a commit that referenced this issue Mar 2, 2024
…114558) (GH-116242)

(cherry picked from commit 07236f5)

Co-authored-by: Tristan Pank <tristanpank@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir easy
Projects
None yet
Development

No branches or pull requests

6 participants