mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
[Patch #1005491 ] use __name__ == '__main__' in scripts
This commit is contained in:
parent
6c542b731c
commit
e236b38731
34 changed files with 257 additions and 200 deletions
|
@ -208,7 +208,8 @@ def main():
|
|||
# Use its return value as exit status.
|
||||
# Catch interrupts to avoid stack trace.
|
||||
#
|
||||
try:
|
||||
sys.exit(main())
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(1)
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
sys.exit(main())
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue