10000 `tarfile` deprecation warning for PEP-706 should set a stacklevel · Issue #117691 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

tarfile deprecation warning for PEP-706 should set a stacklevel #117691

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

Closed
AlexWaygood opened this issue Apr 9, 2024 · 0 comments
Closed

tarfile deprecation warning for PEP-706 should set a stacklevel #117691

AlexWaygood opened this issue Apr 9, 2024 · 0 comments
Labels
3.12 only security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@AlexWaygood
Copy link
Member
AlexWaygood commented Apr 9, 2024

Bug report

Bug description:

I just saw the following deprecation warning in the GitHub Actions log for a project I contribute to:

/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/tarfile.py:2221: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
    warnings.warn(

Unfortunately, the warning doesn't tell me anything about which line in the project is triggering the warning. The warning points to the line in tarfile.py inside the function that has the deprecation warning, rather than the line in my project that's calling the tarfile function in the depreacted way. We should set a stacklevel here to rectify this (I think stacklevel should be set to 3?):

cpython/Lib/tarfile.py

Lines 2245 to 2250 in d5f1139

import warnings
warnings.warn(
'Python 3.14 will, by default, filter extracted tar '
+ 'archives and reject files or modify their metadata. '
+ 'Use the filter argument to control this behavior.',
DeprecationWarning)

Cc. @encukou as the author and implementer of PEP-706

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

@AlexWaygood AlexWaygood added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir 3.12 only security fixes 3.13 bugs and security fixes labels Apr 9, 2024
AlexWaygood added a commit to AlexWaygood/cpython that referenced this issue Apr 14, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 16, 2024
…precation warnings (pythonGH-117872)

(cherry picked from commit cff0a2d)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
encukou pushed a commit that referenced this issue Apr 16, 2024
…eprecation warnings (GH-117872) (GH-117930)

gh-117691: Add an appropriate stacklevel for PEP-706 tarfile deprecation warnings (GH-117872)
(cherry picked from commit cff0a2d)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes 3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant
0