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 multi-line statements in pdb · Issue #103124 · python/cpython

Support multi-line statements in pdb #103124

New issue
Copy link
New issue
Copy link
Closed
Closed
Support multi-line statements in pdb#103124
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 Mar 30, 2023
Issue body actions

Feature or enhancement

Support multi-line statements in pdb just like in normal Python interactive shells

Pitch

Currently, we have this:

(Pdb) def f():
*** IndentationError: expected an indented block after function definition on line 1
(Pdb) 

We can have this:

(Pdb) def f():
...     pass
...   
(Pdb) 

The fundamental logic is handled by codeop.compile_command, we just need to port it in.

It's kind of a breaking change, as the behavior for the once failed single-line check only code could potentially work. For example, we have this in the error case check:

(Pdb) print(
*** SyntaxError: '(' was never closed"

And it won't be failing anymore as we can close it in the next line. But in general, I believe this feature has more benifits than problems.

I'll make the PR draft for now and wait for some more discussion on the matter.

Linked PRs

  • gh-103124: Multiline statement support for pdb #103125
Reacted by Ashley Connor
Reacted by Alexander Kwako, Abu Adan, Ashley Connor and Vincent Perrollaz
Reacted by Ashley Connor

Activity

  1. gaogaotiantian
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Mar 30, 2023
  2. arhadthedev
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Mar 30, 2023
  3. gaogaotiantian commented on Apr 9, 2023

    @gaogaotiantian
    gaogaotiantian
    on Apr 9, 2023
    MemberAuthor
    More actions

    Modified the failing test because print( is a valid command now(it will wait for the closing parenthesis). Added multiline statement tests. This is an intuitive feature so no new documentation is required.

  4. gaogaotiantian commented on May 7, 2023

    @gaogaotiantian
    gaogaotiantian
    on May 7, 2023
    MemberAuthor
    More actions

    @iritkatriel and @brandtbucher , do you think we still have a chance to merge this in for 3.12? I do think this is a significant improvement for pdb.

  5. brandtbucher commented on May 10, 2023

    @brandtbucher
    brandtbucher
    on May 10, 2023
    Member
    More actions

    I agree, and I'm sorry we didn't have the time to review this for 3.12. I'm looking forward to reviewing this improvement for 3.13, though!

  6. brandtbucher
    added a commit that references this issue on Jun 15, 2023

    GH-103124: Multiline statement support for pdb (GH-103125)

    25a64fd
  7. brandtbucher
    closed this as completedon Jun 15, 2023
  8. carljm
    added a commit that references this issue on Jun 16, 2023

    Merge branch 'main' into modulelocals

    b096651
  9. gvanrossum
    added a commit that references this issue on Jun 18, 2023

    pythonGH-103124: Multiline statement support for pdb (pythonGH-103125)

    860c007
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.