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 — Pdb bug when using names that collide w/ aliases of breakpoints operations · Issue #111352 · python/cpython

Pdb bug when using names that collide w/ aliases of breakpoints operations #111352

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Pdb bug when using names that collide w/ aliases of breakpoints operations#111352
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@JosephSBoyle
JosephSBoyle
opened on Oct 26, 2023
Issue body actions

Bug report

Bug description:

Using specific values as variable names in breakpoints leads to incorrect behaviour.
This seems to be because certain chars are used as aliases in pdb, i.e c is continue, p is print etc.
It is triggered when the following char is non-alpha-numeric, afaict.

MRE:

Python 3.9.5 (default, Sep 14 2021, 12:04:19) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> breakpoint()
--Return--
> <stdin>(1)<module>()->None
(Pdb) c = None
>>> c
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'c' is not defined
>>> 
# I expect to still be in a breakpoint here, and for `c` to be `None`,  but pdb has 'continued' execution instead.

The same is true for other aliases, like q and p, which raise errors relating to their respective functions. (I have not tried all aliases).

CPython versions tested on:

3.9

Operating systems tested on:

Linux

Activity

  1. JosephSBoyle
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Oct 26, 2023
  2. AlexWaygood commented on Oct 26, 2023

    @AlexWaygood
    AlexWaygood
    on Oct 26, 2023
    Member
    More actions

    I can reproduce your results on Python 3.12, but the output is pretty different on main (likely because of some changes @gaogaotiantian has been making to improve pdb):

    Running Debug|x64 interpreter...
    Python 3.13.0a1+ (heads/main:232465204e, Oct 17 2023, 15:23:17) [MSC v.1932 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> breakpoint()
    --Return--
    > <python-input-0>(1)<module>()->None
    -> breakpoint()
    (Pdb) c = None
    *** Invalid argument: = None
          Usage: c(ont(inue))
    (Pdb)
  3. gaogaotiantian commented on Oct 26, 2023

    @gaogaotiantian
    gaogaotiantian
    on Oct 26, 2023
    Member
    More actions

    Right, the fix just missed 3.12 because core devs were super busy before release :) We did not consider it as a "bug fix" so no backport was done. The PR is #103465.

    The core issue is pdb parses c = None as a c, or continue command + = None args, which is what cmd.Cmd (pdb is a subclass of it) does. In the old pdb, there's no argument checking - extra arguments will just be ignored. So c = None is strictly equivalent to c.

    We can backport the PR if we want, otherwise this should be marked done. We won't fix 3.9 of course, it does not take bug fixes anymore. The best we can do is to backport the fix to 3.11.

    Reacted by JosephSBoyle
  4. AlexWaygood commented on Oct 26, 2023

    @AlexWaygood
    AlexWaygood
    on Oct 26, 2023
    Member
    More actions

    Yeah, I think I agree that this is probably a new feature rather than a bugfix. So... wait for Python 3.13, I guess :)

    Sorry we can't do better than that here @JosephSBoyle!

    Reacted by JosephSBoyle
  5. AlexWaygood
    closed this as not plannedon Oct 26, 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

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    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.