mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
bpo-15999: Clean up of handling boolean arguments. (GH-15610)
* Use the 'p' format unit instead of manually called PyObject_IsTrue(). * Pass boolean value instead 0/1 integers to functions that needs boolean. * Convert some arguments to boolean only once.
This commit is contained in:
parent
5eca7f3f38
commit
1f21eaa15e
21 changed files with 69 additions and 78 deletions
|
@ -204,11 +204,11 @@ def main():
|
|||
print("-t: quote tabs")
|
||||
print("-d: decode; default encode")
|
||||
sys.exit(2)
|
||||
deco = 0
|
||||
tabs = 0
|
||||
deco = False
|
||||
tabs = False
|
||||
for o, a in opts:
|
||||
if o == '-t': tabs = 1
|
||||
if o == '-d': deco = 1
|
||||
if o == '-t': tabs = True
|
||||
if o == '-d': deco = True
|
||||
if tabs and deco:
|
||||
sys.stdout = sys.stderr
|
||||
print("-t and -d are mutually exclusive")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue