Skip to content

Fix bare except clauses in ptyprocess.py: use except Exception#83

Open
koteshyelamati wants to merge 1 commit into
pexpect:masterfrom
koteshyelamati:master
Open

Fix bare except clauses in ptyprocess.py: use except Exception#83
koteshyelamati wants to merge 1 commit into
pexpect:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Fix 2 bare except: clauses in ptyprocess/ptyprocess.py that catch BaseException, replacing them with except Exception:.

Line 339 (in _make_pty_ioctl / exec error parsing):
except:except Exception: — wraps error data parsing from a subprocess pipe; any parsing failure re-raises a generic Exception, so catching BaseException is unnecessary.

Line 391 (in __init__ / setwinsize cleanup):
except: passexcept Exception: pass — comment already notes uncertainty about which exception to catch; using Exception is the correct conservative fix that still allows KeyboardInterrupt and SystemExit to propagate.

Bare except: clauses are bad practice (PEP 8 / flake8 E722) because they silently swallow KeyboardInterrupt and SystemExit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant