GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Warnings stacklevel frames to skip · Issue #69403 · python/cpython

Warnings stacklevel frames to skip #69403

New issue
Copy link
New issue
Copy link
Closed
Closed
Warnings stacklevel frames to skip#69403
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

jimjjewett
mannequin
opened on Sep 22, 2015
Issue body actions
BPO 25216
Nosy @JimJJewett, @jayvdb

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2015-09-22.15:47:00.527>
labels = ['type-feature', 'library']
title = 'Warnings stacklevel frames to skip'
updated_at = <Date 2015-12-10.08:16:01.708>
user = 'https://github.com/JimJJewett'

bugs.python.org fields:

activity = <Date 2015-12-10.08:16:01.708>
actor = 'jayvdb'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2015-09-22.15:47:00.527>
creator = 'Jim.Jewett'
dependencies = []
files = []
hgrepos = []
issue_num = 25216
keywords = []
message_count = 2.0
messages = ['251328', '256169']
nosy_count = 2.0
nosy_names = ['Jim.Jewett', 'jayvdb']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue25216'
versions = ['Python 3.6']

Activity

  1. jimjjewett commented on Sep 22, 2015

    @jimjjewett
    jimjjewettmannequin
    on Sep 22, 2015
    MannequinAuthor
    More actions

    warnings.warn(stacklevel=2) is a longstanding idiom.

    It broke in 3.3 because python itself added some additional infrastructure frames in between; now stacklevel should be 8 or 10 in some releases.

    bpo-24305 adds a workaround for 3.5, to ignore internal frames -- defined as those which contain both 'importlib' and '_bootstrap' in filename.

    I would prefer to see a supported hook, so that either the caller or the program setup could list other modules or packages to ignore when counting frames. That way, I could write

    mycall(otherlib(foo))

    and otherlib could ensure that the warning pointed to mycall, rather than to something internal to otherlib, even if otherlib were refactored to a different stack depth.

    Ignoring just the import machinery would of course be a good default.

  2. jimjjewett
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    type-featureA feature request or enhancementA feature request or enhancement
    on Sep 22, 2015
  3. jayvdb commented on Dec 10, 2015

    @jayvdb
    jayvdbmannequin
    on Dec 10, 2015
    Mannequin
    More actions

    This looks a lot like the patch on http://bugs.python.org/issue850482 aka #39615

  4. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  5. gpshead commented on Jan 1, 2023

    @gpshead
    gpshead
    on Jan 1, 2023
    Member
    More actions

    duplicate of #39615

  6. gpshead
    closed this as completedon Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.