Skip to content

Commit

Permalink
Merged revisions 62021,62029,62035-62038,62043-62044,62052-62053 via …
Browse files Browse the repository at this point in the history
…svnmerge from

svn+ssh://[email protected]/python/trunk

........
  r62021 | benjamin.peterson | 2008-03-28 18:11:01 -0500 (Fri, 28 Mar 2008) | 2 lines

  NIL => NULL
........
  r62029 | amaury.forgeotdarc | 2008-03-28 20:42:31 -0500 (Fri, 28 Mar 2008) | 3 lines

  Correctly call the base class tearDown();
  otherwise running test_logging twice produce the errors we see on all buildbots
........
  r62035 | raymond.hettinger | 2008-03-29 05:42:07 -0500 (Sat, 29 Mar 2008) | 1 line

  Be explicit about what efficient means.
........
  r62036 | georg.brandl | 2008-03-29 06:46:18 -0500 (Sat, 29 Mar 2008) | 2 lines

  Fix capitalization.
........
  r62037 | amaury.forgeotdarc | 2008-03-29 07:42:54 -0500 (Sat, 29 Mar 2008) | 5 lines

  lib2to3 should install a logging handler only when run as a main program,
  not when used as a library.

  This may please the buildbots, which fail when test_lib2to3 is run before test_logging.
........
  r62043 | benjamin.peterson | 2008-03-29 10:24:25 -0500 (Sat, 29 Mar 2008) | 3 lines

  python#2503 make singletons compared with "is" not == or !=
  Thanks to Wummel for the patch
........
  r62044 | gerhard.haering | 2008-03-29 14:11:52 -0500 (Sat, 29 Mar 2008) | 2 lines

  Documented the lastrowid attribute.
........
  r62052 | benjamin.peterson | 2008-03-30 14:35:10 -0500 (Sun, 30 Mar 2008) | 2 lines

  Updated README regarding doc formats
........
  r62053 | georg.brandl | 2008-03-30 14:41:39 -0500 (Sun, 30 Mar 2008) | 2 lines

  The other download formats will be available for 2.6 too.
........
  • Loading branch information
benjaminp committed Mar 31, 2008
1 parent 7315bad commit 2a691a8
Show file tree
Hide file tree
Showing 59 changed files with 175 additions and 155 deletions.
2 changes: 1 addition & 1 deletion Demo/classes/Dbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test():
value = d[key]
print('currently:', value)
value = eval(input('value: '))
if value == None:
if value is None:
del d[key]
else:
d[key] = value
Expand Down
2 changes: 1 addition & 1 deletion Demo/curses/ncurses.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from curses import panel

def wGetchar(win = None):
if win == None: win = stdscr
if win is None: win = stdscr
return win.getch()

def Getchar():
Expand Down
2 changes: 1 addition & 1 deletion Demo/rpc/mountclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def bindsocket(self):
# This function is called to cough up a suitable
# authentication object for a call to procedure 'proc'.
def mkcred(self):
if self.cred == None:
if self.cred is None:
self.cred = rpc.AUTH_UNIX, rpc.make_auth_unix_default()
return self.cred

Expand Down
6 changes: 3 additions & 3 deletions Demo/rpc/nfsclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def addpackers(self):
self.unpacker = NFSUnpacker('')

def mkcred(self):
if self.cred == None:
if self.cred is None:
self.cred = rpc.AUTH_UNIX, rpc.make_auth_unix_default()
return self.cred

Expand Down Expand Up @@ -170,7 +170,7 @@ def Listdir(self, dir):
for fileid, name, cookie in entries:
list.append((fileid, name))
last_cookie = cookie
if eof or last_cookie == None:
if eof or last_cookie is None:
break
ra = (ra[0], last_cookie, ra[2])
return list
Expand All @@ -184,7 +184,7 @@ def test():
else: filesys = None
from mountclient import UDPMountClient, TCPMountClient
mcl = TCPMountClient(host)
if filesys == None:
if filesys is None:
list = mcl.Export()
for item in list:
print(item)
Expand Down
8 changes: 4 additions & 4 deletions Demo/rpc/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ def do_call(self):

def mkcred(self):
# Override this to use more powerful credentials
if self.cred == None:
if self.cred is None:
self.cred = (AUTH_NULL, make_auth_null())
return self.cred

def mkverf(self):
# Override this to use a more powerful verifier
if self.verf == None:
if self.verf is None:
self.verf = (AUTH_NULL, make_auth_null())
return self.verf

Expand Down Expand Up @@ -317,7 +317,7 @@ def recvrecord(sock):
def bindresvport(sock, host):
global last_resv_port_tried
FIRST, LAST = 600, 1024 # Range of ports to try
if last_resv_port_tried == None:
if last_resv_port_tried is None:
import os
last_resv_port_tried = FIRST + os.getpid() % (LAST-FIRST)
for i in range(last_resv_port_tried, LAST) + \
Expand Down Expand Up @@ -811,7 +811,7 @@ def loop(self):
def session(self):
call, host_port = self.sock.recvfrom(8192)
reply = self.handle(call)
if reply != None:
if reply is not None:
self.sock.sendto(reply, host_port)


Expand Down
2 changes: 1 addition & 1 deletion Demo/tkinter/guido/paint.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def b1up(event):
def motion(event):
if b1 == "down":
global xold, yold
if xold != None and yold != None:
if xold is not None and yold is not None:
event.widget.create_line(xold,yold,event.x,event.y,smooth=TRUE)
# here's where you draw it. smooth. neat.
xold = event.x
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
===================================================

.. module:: array
:synopsis: Efficient arrays of uniformly typed numeric values.
:synopsis: Space efficient arrays of uniformly typed numeric values.


.. index:: single: arrays

This module defines an object type which can efficiently represent an array of
This module defines an object type which can compactly represent an array of
basic values: characters, integers, floating point numbers. Arrays are sequence
types and behave very much like lists, except that the type of objects stored in
them is constrained. The type is specified at object creation time by using a
Expand Down
2 changes: 1 addition & 1 deletion Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ the refcount falls to 0; for
objects that don't contain references to other objects or heap memory
this can be the standard function free(). Both macros can be used
wherever a void expression is allowed. The argument must not be a
NIL pointer. If it may be NIL, use Py_XINCREF/Py_XDECREF instead.
NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead.
The macro _Py_NewReference(op) initialize reference counts to 1, and
in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional
bookkeeping appropriate to the special build.
Expand Down
6 changes: 3 additions & 3 deletions Lib/bsddb/dbshelve.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __delitem__(self, key):


def keys(self, txn=None):
if txn != None:
if txn is not None:
return self.db.keys(txn)
else:
return self.db.keys()
Expand All @@ -161,7 +161,7 @@ def __repr__(self):


def items(self, txn=None):
if txn != None:
if txn is not None:
items = self.db.items(txn)
else:
items = self.db.items()
Expand All @@ -172,7 +172,7 @@ def items(self, txn=None):
return newitems

def values(self, txn=None):
if txn != None:
if txn is not None:
values = self.db.values(txn)
else:
values = self.db.values()
Expand Down
4 changes: 2 additions & 2 deletions Lib/bsddb/test/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def test03_SimpleCursorStuff(self, get_raises_error=0, set_raises_error=0):
else:
if set_raises_error:
self.fail("expected exception")
if n != None:
if n is not None:
self.fail("expected None: %r" % (n,))

rec = c.get_both(b'0404', self.makeData(b'0404'))
Expand All @@ -380,7 +380,7 @@ def test03_SimpleCursorStuff(self, get_raises_error=0, set_raises_error=0):
else:
if get_raises_error:
self.fail("expected exception")
if n != None:
if n is not None:
self.fail("expected None: %r" % (n,))

if self.d.get_type() == db.DB_BTREE:
Expand Down
2 changes: 1 addition & 1 deletion Lib/bsddb/test/test_dbtables.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def test_Modify(self):
self.tdb.Insert(tabname, {'Type': b'Unknown', 'Access': b'0'})

def set_type(type):
if type == None:
if type is None:
return b'MP3'
return type

Expand Down
5 changes: 2 additions & 3 deletions Lib/idlelib/AutoComplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class AutoComplete:
"popupwait", type="int", default=0)

def __init__(self, editwin=None):
if editwin == None: # subprocess and test
self.editwin = None
return
self.editwin = editwin
if editwin is None: # subprocess and test
return
self.text = editwin.text
self.autocompletewindow = None

Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/PyShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ def close(self):
"The program is still running!\n Do you want to kill it?",
default="ok",
parent=self.text)
if response == False:
if response is False:
return "cancel"
if self.reading:
self.top.quit()
Expand Down
2 changes: 1 addition & 1 deletion Lib/lib-tk/Tkinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __init__(self, master=None, value=None, name=None):
else:
self._name = 'PY_VAR' + repr(_varnum)
_varnum += 1
if value != None:
if value is not None:
self.set(value)
elif not self._tk.call("info", "exists", self._name):
self.set(self._default)
Expand Down
8 changes: 4 additions & 4 deletions Lib/lib-tk/turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,25 +749,25 @@ def setup(**geometry):
global _width, _height, _startx, _starty

width = geometry.get('width',_width)
if width is None or width >= 0:
if width >= 0 or width is None:
_width = width
else:
raise ValueError("width can not be less than 0")

height = geometry.get('height',_height)
if height is None or height >= 0:
if height >= 0 or height is None:
_height = height
else:
raise ValueError("height can not be less than 0")

startx = geometry.get('startx', _startx)
if startx is None or startx >= 0:
if startx >= 0 or startx is None:
_startx = _startx
else:
raise ValueError("startx can not be less than 0")

starty = geometry.get('starty', _starty)
if starty is None or starty >= 0:
if starty >= 0 or starty is None:
_starty = starty
else:
raise ValueError("startx can not be less than 0")
Expand Down
18 changes: 9 additions & 9 deletions Lib/lib2to3/refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@
from . import fixes
from . import pygram

if sys.version_info < (2, 4):
hdlr = logging.StreamHandler()
fmt = logging.Formatter('%(name)s: %(message)s')
hdlr.setFormatter(fmt)
logging.root.addHandler(hdlr)
else:
logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO)


def main(args=None):
"""Main program.
Expand Down Expand Up @@ -73,6 +64,15 @@ def main(args=None):
print("Use --help to show usage.", file=sys.stderr)
return 2

# Set up logging handler
if sys.version_info < (2, 4):
hdlr = logging.StreamHandler()
fmt = logging.Formatter('%(name)s: %(message)s')
hdlr.setFormatter(fmt)
logging.root.addHandler(hdlr)
else:
logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO)

# Initialize the refactoring tool
rt = RefactoringTool(options)

Expand Down
18 changes: 9 additions & 9 deletions Lib/plat-mac/EasyDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def Message(msg, id=260, ok=None):
return
h = d.GetDialogItemAsControl(2)
SetDialogItemText(h, lf2cr(msg))
if ok != None:
if ok is not None:
h = d.GetDialogItemAsControl(1)
h.SetControlTitle(ok)
d.SetDialogDefaultItem(1)
Expand Down Expand Up @@ -115,10 +115,10 @@ def AskString(prompt, default = "", id=261, ok=None, cancel=None):
SetDialogItemText(h, lf2cr(default))
d.SelectDialogItemText(4, 0, 999)
# d.SetDialogItem(4, 0, 255)
if ok != None:
if ok is not None:
h = d.GetDialogItemAsControl(1)
h.SetControlTitle(ok)
if cancel != None:
if cancel is not None:
h = d.GetDialogItemAsControl(2)
h.SetControlTitle(cancel)
d.SetDialogDefaultItem(1)
Expand Down Expand Up @@ -159,10 +159,10 @@ def AskPassword(prompt, default='', id=264, ok=None, cancel=None):
SetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag, default)
d.SelectDialogItemText(4, 0, 999)
Ctl.SetKeyboardFocus(d.GetDialogWindow(), pwd, kControlEditTextPart)
if ok != None:
if ok is not None:
h = d.GetDialogItemAsControl(1)
h.SetControlTitle(ok)
if cancel != None:
if cancel is not None:
h = d.GetDialogItemAsControl(2)
h.SetControlTitle(cancel)
d.SetDialogDefaultItem(Dialogs.ok)
Expand Down Expand Up @@ -203,19 +203,19 @@ def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=262
# The question string is item 5
h = d.GetDialogItemAsControl(5)
SetDialogItemText(h, lf2cr(question))
if yes != None:
if yes is not None:
if yes == '':
d.HideDialogItem(2)
else:
h = d.GetDialogItemAsControl(2)
h.SetControlTitle(yes)
if no != None:
if no is not None:
if no == '':
d.HideDialogItem(3)
else:
h = d.GetDialogItemAsControl(3)
h.SetControlTitle(no)
if cancel != None:
if cancel is not None:
if cancel == '':
d.HideDialogItem(4)
else:
Expand Down Expand Up @@ -316,7 +316,7 @@ def _update(self, value):

def set(self, value, max=None):
"""set(value) - Set progress bar position"""
if max != None:
if max is not None:
self.maxval = max
bar = self.d.GetDialogItemAsControl(3)
if max <= 0: # indeterminate bar
Expand Down
16 changes: 8 additions & 8 deletions Lib/plat-mac/FrameWork.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def windowbounds(width, height):
def setwatchcursor():
global _watch

if _watch == None:
if _watch is None:
_watch = GetCursor(4).data
SetCursor(_watch)

Expand Down Expand Up @@ -129,7 +129,7 @@ def makeusermenus(self):
self._quititem = MenuItem(m, "Quit", "Q", self._quit)

def gethelpmenu(self):
if self._helpmenu == None:
if self._helpmenu is None:
self._helpmenu = HelpMenu(self.menubar)
return self._helpmenu

Expand Down Expand Up @@ -266,7 +266,7 @@ def do_mouseDown(self, event):
else:
name = "do_%d" % partcode

if wid == None:
if wid is None:
# No window, or a non-python window
try:
handler = getattr(self, name)
Expand Down Expand Up @@ -475,7 +475,7 @@ def close(self):
self.menus = None

def addmenu(self, title, after = 0, id=None):
if id == None:
if id is None:
id = self.getnextid()
if DEBUG: print('Newmenu', title, id) # XXXX
m = NewMenu(id, title)
Expand Down Expand Up @@ -907,8 +907,8 @@ def scrollbars(self, wantx=1, wanty=1):
self.barx_enabled = self.bary_enabled = 1
x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds()
vx, vy = self.getscrollbarvalues()
if vx == None: self.barx_enabled, vx = 0, 0
if vy == None: self.bary_enabled, vy = 0, 0
if vx is None: self.barx_enabled, vx = 0, 0
if vy is None: self.bary_enabled, vy = 0, 0
if wantx:
rect = x0-1, y1-(SCROLLBARWIDTH-1), x1-(SCROLLBARWIDTH-2), y1+1
self.barx = NewControl(self.wid, rect, "", 1, vx, 0, 32767, 16, 0)
Expand Down Expand Up @@ -1007,7 +1007,7 @@ def updatescrollbars(self):
SetPort(self.wid)
vx, vy = self.getscrollbarvalues()
if self.barx:
if vx == None:
if vx is None:
self.barx.HiliteControl(255)
self.barx_enabled = 0
else:
Expand All @@ -1017,7 +1017,7 @@ def updatescrollbars(self):
self.barx.HiliteControl(0)
self.barx.SetControlValue(vx)
if self.bary:
if vy == None:
if vy is None:
self.bary.HiliteControl(255)
self.bary_enabled = 0
else:
Expand Down
Loading

0 comments on commit 2a691a8

Please sign in to comment.