Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

breakpoint does not enter pdb until the "next event" happens #111744

Closed
Labels
3.13bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
@gaogaotiantian

Description

@gaogaotiantian

Bug report

Bug description:

Consider the following code:

try:raiseValueError()exceptExceptionasexc:breakpoint()

You can't stop in theexcept block, you'll get:

--Return--> /home/gaogaotiantian/programs/mycpython/example.py(4)<module>()->None-> breakpoint()(Pdb)

which is pretty misleading because you can't access anything in theexcept block:

(Pdb) import sys(Pdb) sys.exc_info()(None, None, None)(Pdb) p exc*** NameError: name 'exc' is not defined(Pdb)

If you put apass in the main function:

try:raiseValueError()exceptExceptionasexc:breakpoint()pass

At least the result is less misleading. Even though it's still not what I want - I want to stop in theexcept block.

> /home/gaogaotiantian/programs/mycpython/example.py(5)<module>()-> pass

The "correct" way to do it is to put another line in the block

try:raiseValueError()exceptExceptionasexc:breakpoint()pass

We can stop at thebreakpoint() actually, but that's a breaking behavior, I don't think we want that. So maybe we should at least document this in pdb so users get less confused?

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp