Python (pdb) 如何使用 .pdbrc 文件中的“commands”命令或 -c 命令

问题描述 投票:0回答:1

我有一个Python文件:

def do_something():
    pass

def main():
    a = 1
    b = 2
    c = a+b
    print(f"c:{c}")
    pass

if __name__ == '__main__':
    main()

我运行这个命令:

python -m pdb -c "b 5" -c "commands 1\ndo_something()\nend" -c "c" main.py

这不起作用。

我有一个 .pdbrc 文件

b 5
commands 1
do_something()
end
c

也不起作用。

我该怎么办?

python command pdb
1个回答
0
投票

这已在 python 3.13 中修复,并且根据此拉取请求的讨论似乎已向后移植到 3.11 和 3.12

https://github.com/python/cpython/issues/90095#issuecomment-1989517207

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.