HarshCasper / Rotten-Scripts

Scripts that will make you go WOW!
MIT License
1.47k stars 491 forks source link

Bug risk : Use sys.exit() instead of exit() to avoid error #1253

Closed aayu-s closed 2 years ago

aayu-s commented 2 years ago

Is there an existing issue for this?

Current Behavior

The exit or quit functions don't exist at the top-level if python is started with the -S flag, and will raise an error. Use sys.exit() instead. The exit and quit functions actually site.Quitter objects and are loaded, at interpreter start up, from site.py. However, if the interpreter is started with the -S flag, or a custom site.py is used then exit and quit may not be present. It is recommended to use sys.exit() which is built into the interpreter and is guaranteed to be present.

Expected Behavior

sys.exit() is guaranteed to work, regardless of the interpreter options.

To Reproduce

try: patch_diffs() except Exception as exc: print(exc) exit(1) Here, exit() is used and will fail if the python is run with the -S option.

Anything else?

No response

Code of Conduct

github-actions[bot] commented 2 years ago

@aayu-s Welcome to Rotten-Scripts🥳 Thanks for opening this Issue 🙌, This Will definitely Improve our Project💖.While we are having a look at this. If you want to work on this then,feel free to self-assign and start working on it.📄 Use /assign to self-assign this issue.

github-actions[bot] commented 2 years ago

This issue has been assigned to @aayu-s! It will become unassigned if it isn't closed within 21 days. A maintainer can also add the pinned label to prevent it from being unassigned.

github-actions[bot] commented 2 years ago

@aayu-s, this issue hasn't had any activity in 7 days. It will become unassigned in 14 days to make room for someone else to contribute.