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 — Only support restart command in pdb when it's a command line usage · Issue #123756 · python/cpython

Only support restart command in pdb when it's a command line usage #123756

New issue
Copy link
New issue
Copy link
Closed
Closed
Only support restart command in pdb when it's a command line usage#123756
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

@gaogaotiantian
gaogaotiantian
opened on Sep 6, 2024
Issue body actions

Feature or enhancement

Proposal:

Now when we have a breakpoint() in the source code and enter pdb, we can do restart and raise a Restart exception - which in most cases will just stop the program with an exception. For other rare cases, it might be even worse.

It simply does not make sense to allow a restart command if pdb is not brought up from command line - that exception is only caught in command line usage. So, we should only allow restart in command line usage and do nothing (except for an error) in other cases.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-123756: Only allow restart in command line mode #123757

Activity

  1. gaogaotiantian
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Sep 6, 2024
  2. iritkatriel commented on Sep 6, 2024

    @iritkatriel
    iritkatriel
    on Sep 6, 2024
    Member
    More actions

    Rather than allow_restart, I'd add an enum for the ways that pdb can be invoked. That could be useful for other things.

  3. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Sep 6, 2024
  4. gaogaotiantian commented on Sep 6, 2024

    @gaogaotiantian
    gaogaotiantian
    on Sep 6, 2024
    MemberAuthor
    More actions

    Do you mean an indicator for whether pdb is invoked through a inline breakpoint or command line?

  5. iritkatriel commented on Sep 6, 2024

    @iritkatriel
    iritkatriel
    on Sep 6, 2024
    Member
    More actions

    Do you mean an indicator for whether pdb is invoked through a inline breakpoint or command line?

    Yes

  6. gaogaotiantian commented on Sep 6, 2024

    @gaogaotiantian
    gaogaotiantian
    on Sep 6, 2024
    MemberAuthor
    More actions

    In that case, do you think we should have an unknown option as the default - just to keep all the old behavior? Or we should be a bit more aggressive, and use inline(or some other word) as default, to keep the default behavior safer for users? In another word, only allow commands like restart when the pdb is invoked with an explicit option.

    Besides restart, I'll also work on exit later. Currently when the user exits pdb invoked by an inline breakpoint an error will be raised and it's just weird to show a trackback of an exception when I exit the debugger. I'll make the behavior similar to other debuggers - ask the user whether they want to exit the process, and do a os._exit() to kill everything quietly.

  7. iritkatriel commented on Sep 6, 2024

    @iritkatriel
    iritkatriel
    on Sep 6, 2024
    Member
    More actions

    It can be None by default, and for each situation make None behave like it used to.

  8. gaogaotiantian
    added a commit that references this issue on Sep 25, 2024

    gh-123756: Disable restart command if pdb is in inline mode (#123757)

    28efeef
  9. gaogaotiantian
    closed this as completedon Sep 25, 2024
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.