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 — Support Passing a Proxy object to traceback.TracebackExcetion() for "exc_type" · Issue #111922 · python/cpython

Support Passing a Proxy object to traceback.TracebackExcetion() for "exc_type" #111922

New issue
Copy link
New issue
Copy link
Closed
Closed
Support Passing a Proxy object to traceback.TracebackExcetion() for "exc_type"#111922
Copy link
Labels
3.13only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@ericsnowcurrently
ericsnowcurrently
opened on Nov 9, 2023
Issue body actions

Feature or enhancement

Currently traceback.TracebackException appears to expect the "exc_type" argument to be None or an exception type object. 12

In addition to exception types, I'd like to be able to pass in either a str (the type's __qualname__) or an object that has the attributes that TracebackException need in order to do its job.

For exception types the following attributes are especially important for _PyErr_Display():

  • __name__
  • __qualname__
  • __module__

So we would need those. If non-str were passed in then it would need to have those attrs set properly. If a str were passed in then we'd parse out the info and create a types.SimpleNamespace with that info to use instead.

My motivation is propagating exceptions between interpreters. I want to use TracebackException but have it be strictly a snapshot of an exception, whereas right now it actually still holds a reference to exc_type. It also matters when pickling, where you may not want to pickle a user-defined exception type.

Linked PRs

  • gh-111922: Allow Using a Minimal Proxy for TracebackException.exc_type #112324

Footnotes

  1. https://github.com/python/cpython/blob/6f09f69b7f85962f66d10637c3325bbb2b2d9853/Lib/traceback.py#L722 ↩

  2. https://github.com/python/cpython/blob/6f09f69b7f85962f66d10637c3325bbb2b2d9853/Lib/traceback.py#L763 ↩

Activity

  1. ericsnowcurrently
    added
    type-featureA feature request or enhancementA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    3.13only security fixesonly security fixes
    on Nov 9, 2023
  2. iritkatriel commented on Nov 23, 2023

    @iritkatriel
    iritkatriel
    on Nov 23, 2023
    Member
    More actions

    I want to suggest an alternative which I think is more in the spirit of what TracebackException is supposed to be (a lightweight snapshot): #112333

  3. ericsnowcurrently commented on Nov 28, 2023

    @ericsnowcurrently
    ericsnowcurrently
    on Nov 28, 2023
    MemberAuthor
    More actions

    I'm closing this in favor of gh-112332 (and gh-112333).

  4. ericsnowcurrently
    closed this as completedon Nov 28, 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

    3.13only security fixesonly security fixesstdlibStandard 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.