Skip to content

pdb.line_prefix assignment ignored due to early binding #141781

@pareshjoshij

Description

@pareshjoshij

Bug Description

, in pdb.print_stack_entry, line_prefix is used as a default argument:
def print_stack_entry(self, frame_lineno, prompt_prefix=line_prefix):

This causes the value to be bound at definition time (when the module is imported). Any subsequent assignment to pdb.line_prefix by the user is ignored by this function.

Fix

Change the default argument to None and assign it inside the function body.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions