Merged revisions 73824,78887,78895,78900,79024 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73824 | ezio.melotti | 2009-07-04 04:18:08 +0300 (Sat, 04 Jul 2009) | 1 line

  #6398 typo: versio. -> version.
........
  r78887 | ezio.melotti | 2010-03-13 02:15:36 +0200 (Sat, 13 Mar 2010) | 1 line

  fix broken links
........
  r78895 | ezio.melotti | 2010-03-13 03:21:34 +0200 (Sat, 13 Mar 2010) | 1 line

  #8011: use exc.tb_lineno instead of traceback.tb_lineno() and pep8ify variable names.
........
  r78900 | ezio.melotti | 2010-03-13 06:39:51 +0200 (Sat, 13 Mar 2010) | 1 line

  Silence compiler warnings.
........
  r79024 | ezio.melotti | 2010-03-17 16:22:34 +0200 (Wed, 17 Mar 2010) | 1 line

  Use "x in y" instead of y.find(x) != -1.
........
This commit is contained in:
Ezio Melotti 2010-03-23 13:20:39 +00:00
parent e67bbfb6ef
commit c0fd6ffd4f
7 changed files with 24 additions and 23 deletions

View file

@ -20,9 +20,10 @@ For other archive formats, see the :mod:`gzip`, :mod:`zipfile`, and
Here is a summary of the features offered by the bz2 module: Here is a summary of the features offered by the bz2 module:
* :class:`BZ2File` class implements a complete file interface, including * :class:`BZ2File` class implements a complete file interface, including
:meth:`readline`, :meth:`readlines`, :meth:`writelines`, :meth:`seek`, etc; :meth:`~BZ2File.readline`, :meth:`~BZ2File.readlines`,
:meth:`~BZ2File.writelines`, :meth:`~BZ2File.seek`, etc;
* :class:`BZ2File` class implements emulated :meth:`seek` support; * :class:`BZ2File` class implements emulated :meth:`~BZ2File.seek` support;
* :class:`BZ2File` class implements universal newline support; * :class:`BZ2File` class implements universal newline support;

View file

@ -175,12 +175,12 @@ exception and traceback::
try: try:
lumberjack() lumberjack()
except: except IndexError:
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info() exc_type, exc_value, exc_traceback = sys.exc_info()
print "*** print_tb:" print "*** print_tb:"
traceback.print_tb(exceptionTraceback, limit=1, file=sys.stdout) traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
print "*** print_exception:" print "*** print_exception:"
traceback.print_exception(exceptionType, exceptionValue, exceptionTraceback, traceback.print_exception(exc_type, exc_value, exc_traceback,
limit=2, file=sys.stdout) limit=2, file=sys.stdout)
print "*** print_exc:" print "*** print_exc:"
traceback.print_exc() traceback.print_exc()
@ -189,13 +189,13 @@ exception and traceback::
print formatted_lines[0] print formatted_lines[0]
print formatted_lines[-1] print formatted_lines[-1]
print "*** format_exception:" print "*** format_exception:"
print repr(traceback.format_exception(exceptionType, exceptionValue, print repr(traceback.format_exception(exc_type, exc_value,
exceptionTraceback)) exc_traceback))
print "*** extract_tb:" print "*** extract_tb:"
print repr(traceback.extract_tb(exceptionTraceback)) print repr(traceback.extract_tb(exc_traceback))
print "*** format_tb:" print "*** format_tb:"
print repr(traceback.format_tb(exceptionTraceback)) print repr(traceback.format_tb(exc_traceback))
print "*** tb_lineno:", traceback.tb_lineno(exceptionTraceback) print "*** tb_lineno:", exc_traceback.tb_lineno
The output for the example would look similar to this:: The output for the example would look similar to this::

View file

@ -220,7 +220,7 @@ class OtherFileTests(unittest.TestCase):
except ValueError, msg: except ValueError, msg:
if msg[0] != 0: if msg[0] != 0:
s = str(msg) s = str(msg)
if s.find(TESTFN) != -1 or s.find(bad_mode) == -1: if TESTFN in s or bad_mode not in s:
self.fail("bad error message for invalid mode: %s" % s) self.fail("bad error message for invalid mode: %s" % s)
# if msg[0] == 0, we're probably on Windows where there may be # if msg[0] == 0, we're probably on Windows where there may be
# no obvious way to discover why open() failed. # no obvious way to discover why open() failed.

View file

@ -189,7 +189,7 @@ class OtherFileTests(unittest.TestCase):
except ValueError as msg: except ValueError as msg:
if msg.args[0] != 0: if msg.args[0] != 0:
s = str(msg) s = str(msg)
if s.find(TESTFN) != -1 or s.find(bad_mode) == -1: if TESTFN in s or bad_mode not in s:
self.fail("bad error message for invalid mode: %s" % s) self.fail("bad error message for invalid mode: %s" % s)
# if msg.args[0] == 0, we're probably on Windows where there may be # if msg.args[0] == 0, we're probably on Windows where there may be
# no obvious way to discover why open() failed. # no obvious way to discover why open() failed.

View file

@ -439,7 +439,7 @@ class MinidomTest(unittest.TestCase):
string1 = repr(el) string1 = repr(el)
string2 = str(el) string2 = str(el)
self.confirm(string1 == string2) self.confirm(string1 == string2)
self.confirm(string1.find("slash:abc") != -1) self.confirm("slash:abc" in string1)
dom.unlink() dom.unlink()
def testAttributeRepr(self): def testAttributeRepr(self):

View file

@ -450,14 +450,14 @@ PyCursesWindow_AddStr(PyCursesWindowObject *self, PyObject *args)
if (use_attr == TRUE) { if (use_attr == TRUE) {
attr_old = getattrs(self->win); attr_old = getattrs(self->win);
wattrset(self->win,attr); (void)wattrset(self->win,attr);
} }
if (use_xy == TRUE) if (use_xy == TRUE)
rtn = mvwaddstr(self->win,y,x,str); rtn = mvwaddstr(self->win,y,x,str);
else else
rtn = waddstr(self->win,str); rtn = waddstr(self->win,str);
if (use_attr == TRUE) if (use_attr == TRUE)
wattrset(self->win,attr_old); (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "addstr"); return PyCursesCheckERR(rtn, "addstr");
} }
@ -499,14 +499,14 @@ PyCursesWindow_AddNStr(PyCursesWindowObject *self, PyObject *args)
if (use_attr == TRUE) { if (use_attr == TRUE) {
attr_old = getattrs(self->win); attr_old = getattrs(self->win);
wattrset(self->win,attr); (void)wattrset(self->win,attr);
} }
if (use_xy == TRUE) if (use_xy == TRUE)
rtn = mvwaddnstr(self->win,y,x,str,n); rtn = mvwaddnstr(self->win,y,x,str,n);
else else
rtn = waddnstr(self->win,str,n); rtn = waddnstr(self->win,str,n);
if (use_attr == TRUE) if (use_attr == TRUE)
wattrset(self->win,attr_old); (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "addnstr"); return PyCursesCheckERR(rtn, "addnstr");
} }
@ -1140,14 +1140,14 @@ PyCursesWindow_InsStr(PyCursesWindowObject *self, PyObject *args)
if (use_attr == TRUE) { if (use_attr == TRUE) {
attr_old = getattrs(self->win); attr_old = getattrs(self->win);
wattrset(self->win,attr); (void)wattrset(self->win,attr);
} }
if (use_xy == TRUE) if (use_xy == TRUE)
rtn = mvwinsstr(self->win,y,x,str); rtn = mvwinsstr(self->win,y,x,str);
else else
rtn = winsstr(self->win,str); rtn = winsstr(self->win,str);
if (use_attr == TRUE) if (use_attr == TRUE)
wattrset(self->win,attr_old); (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "insstr"); return PyCursesCheckERR(rtn, "insstr");
} }
@ -1189,14 +1189,14 @@ PyCursesWindow_InsNStr(PyCursesWindowObject *self, PyObject *args)
if (use_attr == TRUE) { if (use_attr == TRUE) {
attr_old = getattrs(self->win); attr_old = getattrs(self->win);
wattrset(self->win,attr); (void)wattrset(self->win,attr);
} }
if (use_xy == TRUE) if (use_xy == TRUE)
rtn = mvwinsnstr(self->win,y,x,str,n); rtn = mvwinsnstr(self->win,y,x,str,n);
else else
rtn = winsnstr(self->win,str,n); rtn = winsnstr(self->win,str,n);
if (use_attr == TRUE) if (use_attr == TRUE)
wattrset(self->win,attr_old); (void)wattrset(self->win,attr_old);
return PyCursesCheckERR(rtn, "insnstr"); return PyCursesCheckERR(rtn, "insnstr");
} }

2
README
View file

@ -939,7 +939,7 @@ Installing multiple versions
On Unix and Mac systems if you intend to install multiple versions of Python On Unix and Mac systems if you intend to install multiple versions of Python
using the same installation prefix (--prefix argument to the configure using the same installation prefix (--prefix argument to the configure
script) you must take care that your primary python executable is not script) you must take care that your primary python executable is not
overwritten by the installation of a different versio. All files and overwritten by the installation of a different version. All files and
directories installed using "make altinstall" contain the major and minor directories installed using "make altinstall" contain the major and minor
version and can thus live side-by-side. "make install" also creates version and can thus live side-by-side. "make install" also creates
${prefix}/bin/python which refers to ${prefix}/bin/pythonX.Y. If you intend ${prefix}/bin/python which refers to ${prefix}/bin/pythonX.Y. If you intend