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:
Serhiy Storchaka 2019-09-01 12:16:51 +03:00 committed by GitHub
parent 5eca7f3f38
commit 1f21eaa15e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 69 additions and 78 deletions

View file

@ -2241,7 +2241,7 @@ class Tk(Misc, Wm):
_w = '.'
def __init__(self, screenName=None, baseName=None, className='Tk',
useTk=1, sync=0, use=None):
useTk=True, sync=False, use=None):
"""Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will
be created. BASENAME will be used for the identification of the profile file (see
readprofile).
@ -2259,7 +2259,7 @@ class Tk(Misc, Wm):
baseName, ext = os.path.splitext(baseName)
if ext not in ('.py', '.pyc'):
baseName = baseName + ext
interactive = 0
interactive = False
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
if useTk:
self._loadtk()
@ -2361,7 +2361,7 @@ class Tk(Misc, Wm):
# copied into the Pack, Place or Grid class.
def Tcl(screenName=None, baseName=None, className='Tk', useTk=0):
def Tcl(screenName=None, baseName=None, className='Tk', useTk=False):
return Tk(screenName, baseName, className, useTk)