Skip to content

Fix bare except clauses in shutils.py, __main__.py, and utils.py#95

Open
koteshyelamati wants to merge 3 commits into
uqfoundation:masterfrom
koteshyelamati:master
Open

Fix bare except clauses in shutils.py, __main__.py, and utils.py#95
koteshyelamati wants to merge 3 commits into
uqfoundation:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Fix bare except: clauses that catch BaseException (including SystemExit, KeyboardInterrupt, and GeneratorExit), replacing them with except Exception: or more specific exception types.

Changes:

pox/shutils.py (lines 49, 79, 302):

  • get_home(): except:except Exception:
  • get_username(): except:except Exception:
  • Path traversal loop: except:except Exception:

pox/__main__.py (lines 35, 49, 53):

  • Main try block: except:except Exception:
  • sys.argv access: except:except IndexError: (more specific — only IndexError is possible here)
  • exec() call: except:except Exception:

pox/utils.py (line 168):

  • File conversion: except:except Exception:

Bare except: clauses are considered bad practice (PEP 8 / flake8 E722) because they silently swallow signals like KeyboardInterrupt, making programs impossible to interrupt with Ctrl+C.

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