FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Statements/UseOfExit.qhelp at codeql-cli/v2.16.0 · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
997
Pull requests
463
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Statements
/
UseOfExit.qhelp
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (26 loc) · 1.26 KB
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Statements
/
UseOfExit.qhelp
Copy path
File metadata and controls
35 lines (26 loc) · 1.26 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!
DOCTYPE
qhelp
PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<
qhelp
>
<
overview
>
<
p
> The <
code
>exit</
code
> and <
code
>quit</
code
> "functions" are actually <
code
>site.Quitter</
code
> objects and
are loaded, at interpreter start up, from <
code
>site.py</
code
>.
However, if the interpreter is started with the <
code
>-S</
code
> flag, or a custom <
code
>site.py</
code
>
is used then <
code
>exit</
code
> and <
code
>quit</
code
> may not be present.
</
p
>
</
overview
>
<
recommendation
>
<
p
> Replace uses of <
code
>exit()</
code
> and <
code
>quit()</
code
> with <
code
>sys.exit()</
code
> which is
built into the interpreter and is guaranteed to be present.</
p
>
</
recommendation
>
<
example
>
<
p
>In this example, <
code
>exit()</
code
> is used and will fail if the interpreter is passed the <
code
>-S</
code
> option.</
p
>
<
sample
src
=
"
ExitUsed.py
"
/>
<
p
>In this example, <
code
>sys.exit()</
code
> is used and will behave the same regardless of the interpreter options.</
p
>
<
sample
src
=
"
SysExitUsed.py
"
/>
</
example
>
<
references
>
<
li
>Python Documentation: <
a
href
=
"
https://docs.python.org/using/cmdline.html#cmdoption-S
"
>Command line and environment</
a
>.</
li
>
<
li
>Python Documentation: <
a
href
=
"
https://docs.python.org/library/site.html#module-site
"
>Site-specific configuration hook</
a
>.</
li
>
</
references
>
</
qhelp
>
Back
|
FazBrowse Home
|
New Git URL