Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"python3.13 -m pdb" exits zero on Syntax Error, prints infinite spam nearby #125367

Closed
@pelavarre

Description

@pelavarre

Bug report

Bug description:

The meaning of "python3 -m pdb" is slowly going wild on short input files? Step-by-step evolving now with no tests deployed to limit how wild it goes?

Four Notes here = Two wrongs we can repro simply, and then two bits of more context

1 )

The process exit return code wrongly comes back as zero in reply to Syntax-Error's, not the nonzero that used to screen out Syntax-Error's, when I upgrade to Python 13 from 12

For example, this M Pdb test of a short SyntaxError

echo alef = >p.py
echo |python3.13 -m pdb p.py >/dev/null 2>&1; echo + exit $? ' # in 13'
echo |python3.12 -m pdb p.py >/dev/null 2>&1; echo + exit $? ' # in 12'

produces the conflicting outputs

+ exit 0  # in 13
+ exit 1  # in 12

We like the old result much better, yes?

2 )

M Pdb tests hang in a loop producing infinite output, after the upgrade to Python 13 from 10

For example, this test of an empty Input File ran happy quickly and concisely, back in the days of 2021 Python 10

$ echo |python3.10 -m pdb /dev/null
> /dev/null(1)<module>()
(Pdb) (Pdb) 
$ 

But in Python 3.13, this same empty test now produces infinitely many copies of a log line, and hangs until you press Control + \

$ echo |python3.13 -m pdb /dev/null
The program finished and will be restarted
The program finished and will be restarted
...

The effects of pressing Control + C instead are not simple. In some Python's, you get multiple chances to press Control + C. In others, it works only the first time. Sometimes Control + D will exit the process after a Control + C. Sometimes it won't. Here I'm reporting from my own living human memory, I've not written out a carefully reproducible survey of all that

"We like the old result much better, yes?"

3 )

I saw these bugs first in macOS, where I take the Python binary from Python Org as it comes out monthly

To make this report, I've gone and tested Linux too. For these bugs, I see that a Python Version gone wrong at macOS also goes wrong in the same way in the same Python Version at Linux. That's comforting

More specifically, I do also see these same bugs in the Linux Gcloud Gshell of my Gmail, after I toss in a few more Linux Python's from DeadSnakes for comparison

apt-cache search python3.10
apt-cache search python3.11
apt-cache search python3.13
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y python3.10
sudo apt install -y python3.11
sudo apt install -y python3.13

I haven't tested Python3.10 at macOS myself

4 )

Thank you for believing I could help

Am I helping? Can I help more?

CPython versions tested on:

3.13

Operating systems tested on:

Linux, macOS

Metadata

Metadata

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