Merged revisions 64365,64370,64406,64408-64409,64412,64416-64417,64420-64421,64425-64428 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64365 | raymond.hettinger | 2008-06-17 19:56:57 -0500 (Tue, 17 Jun 2008) | 1 line

  Fix double decref.
........
  r64370 | mark.dickinson | 2008-06-18 04:20:17 -0500 (Wed, 18 Jun 2008) | 2 lines

  Typo fix
........
  r64406 | andrew.kuchling | 2008-06-19 09:02:30 -0500 (Thu, 19 Jun 2008) | 1 line

  Only include update_lines_cols() function when it's actually going to be used
........
  r64408 | amaury.forgeotdarc | 2008-06-19 14:57:39 -0500 (Thu, 19 Jun 2008) | 2 lines

  test_macos can be skipped on non-mac platforms.
........
  r64409 | andrew.kuchling | 2008-06-19 15:33:31 -0500 (Thu, 19 Jun 2008) | 1 line

  Put threading in front of thread
........
  r64412 | amaury.forgeotdarc | 2008-06-19 16:17:12 -0500 (Thu, 19 Jun 2008) | 3 lines

  In test_site, correctly escape backslashes in path names.
  This allows the test to pass when the username begins with a lowercase 't'...
........
  r64416 | vinay.sajip | 2008-06-19 17:40:17 -0500 (Thu, 19 Jun 2008) | 2 lines

  Bug #3136: fileConfig()'s disabling of old loggers is now conditional via an optional disable_existing_loggers parameter, but the default value is such that the old behaviour is preserved.
  Thanks to Leandro Lucarella for the patch.
........
  r64417 | vinay.sajip | 2008-06-19 17:41:08 -0500 (Thu, 19 Jun 2008) | 1 line

  Updated with fix for #3136.
........
  r64420 | andrew.kuchling | 2008-06-19 21:05:57 -0500 (Thu, 19 Jun 2008) | 1 line

  Various items
........
  r64421 | andrew.kuchling | 2008-06-19 21:11:42 -0500 (Thu, 19 Jun 2008) | 1 line

  Fix comment typos
........
  r64425 | andrew.kuchling | 2008-06-20 06:39:54 -0500 (Fri, 20 Jun 2008) | 1 line

  Various items
........
  r64426 | mark.dickinson | 2008-06-20 09:53:43 -0500 (Fri, 20 Jun 2008) | 4 lines

  Issue #3004:  Minor fix to slice.indices().  slice(-10).indices(9) now
  returns (0, 0, 1) instead of (0, -1, 1), and slice(None, 10, -1).indices(10)
  returns (9, 9, -1) instead of (9, 10, -1).
........
  r64427 | mark.dickinson | 2008-06-20 10:17:41 -0500 (Fri, 20 Jun 2008) | 2 lines

  Fix outdated count of the number of new math module functions.
........
  r64428 | mark.dickinson | 2008-06-20 10:26:19 -0500 (Fri, 20 Jun 2008) | 2 lines

  Fix another typo in math_sum comment
........
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index aba6b0e..c8090b5 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -43,7 +43,7 @@
 
 .. function:: factorial(x)
 
-   Return *x* factorial.  Raises :exc:`ValueError` if *x* is not intergral or
+   Return *x* factorial.  Raises :exc:`ValueError` if *x* is not integral or
    is negative.
 
 .. function:: floor(x)
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 73f3ecc..645a7ba 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -49,7 +49,7 @@
 #   _listener holds the server object doing the listening
 _listener = None
 
-def fileConfig(fname, defaults=None):
+def fileConfig(fname, defaults=None, disable_existing_loggers=1):
     """
     Read the logging configuration from a ConfigParser-format file.
 
@@ -79,7 +79,7 @@
         del logging._handlerList[:]
         # Handlers add themselves to logging._handlers
         handlers = _install_handlers(cp, formatters)
-        _install_loggers(cp, handlers)
+        _install_loggers(cp, handlers, disable_existing_loggers)
     finally:
         logging._releaseLock()
 
@@ -167,7 +167,7 @@
     return handlers
 
 
-def _install_loggers(cp, handlers):
+def _install_loggers(cp, handlers, disable_existing_loggers):
     """Create and install loggers"""
 
     # configure the root first
@@ -252,7 +252,7 @@
             logger.level = logging.NOTSET
             logger.handlers = []
             logger.propagate = 1
-        else:
+        elif disable_existing_loggers:
             logger.disabled = 1
 
 
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 3f93a38..8a61e21 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -101,17 +101,17 @@
         self.assert_(usersite in sys.path)
 
         rc = subprocess.call([sys.executable, '-c',
-            'import sys; sys.exit("%s" in sys.path)' % usersite])
+            'import sys; sys.exit(%r in sys.path)' % usersite])
         self.assertEqual(rc, 1)
 
         rc = subprocess.call([sys.executable, '-s', '-c',
-            'import sys; sys.exit("%s" in sys.path)' % usersite])
+            'import sys; sys.exit(%r in sys.path)' % usersite])
         self.assertEqual(rc, 0)
 
         env = os.environ.copy()
         env["PYTHONNOUSERSITE"] = "1"
         rc = subprocess.call([sys.executable, '-c',
-            'import sys; sys.exit("%s" in sys.path)' % usersite],
+            'import sys; sys.exit(%r in sys.path)' % usersite],
             env=env)
         self.assertEqual(rc, 0)
 
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index e619746..640c8c0 100644
--- a/Lib/test/test_slice.py
+++ b/Lib/test/test_slice.py
@@ -82,6 +82,20 @@
         self.assertEqual(slice(None,  None, -1).indices(10), (9, -1, -1))
         self.assertEqual(slice(None,  None, -2).indices(10), (9, -1, -2))
         self.assertEqual(slice(3,     None, -2).indices(10), (3, -1, -2))
+        # issue 3004 tests
+        self.assertEqual(slice(None, -9).indices(10), (0, 1, 1))
+        self.assertEqual(slice(None, -10).indices(10), (0, 0, 1))
+        self.assertEqual(slice(None, -11).indices(10), (0, 0, 1))
+        self.assertEqual(slice(None, -10, -1).indices(10), (9, 0, -1))
+        self.assertEqual(slice(None, -11, -1).indices(10), (9, -1, -1))
+        self.assertEqual(slice(None, -12, -1).indices(10), (9, -1, -1))
+        self.assertEqual(slice(None, 9).indices(10), (0, 9, 1))
+        self.assertEqual(slice(None, 10).indices(10), (0, 10, 1))
+        self.assertEqual(slice(None, 11).indices(10), (0, 10, 1))
+        self.assertEqual(slice(None, 8, -1).indices(10), (9, 8, -1))
+        self.assertEqual(slice(None, 9, -1).indices(10), (9, 9, -1))
+        self.assertEqual(slice(None, 10, -1).indices(10), (9, 9, -1))
+
         self.assertEqual(
             slice(-100,  100     ).indices(10),
             slice(None).indices(10)
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 45a0821..210cb42 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2380,6 +2380,7 @@
 
 /* Internal helper used for updating curses.LINES, curses.COLS, _curses.LINES
  * and _curses.COLS */
+#if defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)
 static int
 update_lines_cols(void)
 {
@@ -2424,6 +2425,7 @@
   Py_DECREF(m);
   return 1;
 }
+#endif
 
 #ifdef HAVE_CURSES_RESIZETERM
 static PyObject *
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index c57b77a..a196834 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -382,11 +382,11 @@
    sum([1e+308, 1e+308, 1e-308]) raises an OverflowError due to the
    overflow of the first partial sum.
 
-   Note 3: The itermediate values lo, yr, and hi are declared volatile so
-   aggressive compilers won't algebraicly reduce lo to always be exactly 0.0.
+   Note 3: The intermediate values lo, yr, and hi are declared volatile so
+   aggressive compilers won't algebraically reduce lo to always be exactly 0.0.
    Also, the volatile declaration forces the values to be stored in memory as
    regular doubles instead of extended long precision (80-bit) values.  This
-   prevents double rounding because any addition or substraction of two doubles
+   prevents double rounding because any addition or subtraction of two doubles
    can be resolved exactly into double-sized hi and lo values.  As long as the 
    hi value gets forced into a double before yr and lo are computed, the extra
    bits in downstream extended precision operations (x87 for example) will be
@@ -614,7 +614,6 @@
 
 error:
 	Py_DECREF(result);
-	Py_XDECREF(iobj);
 	return NULL;
 }
 
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 69a035d..fbf0955 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -169,8 +169,9 @@
 	else {
 		if (!_PyEval_SliceIndex(r->stop, stop)) return -1;
 		if (*stop < 0) *stop += length;
-		if (*stop < 0) *stop = -1;
-		if (*stop > length) *stop = length;
+		if (*stop < 0) *stop = (*step < 0) ? -1 : 0;
+		if (*stop >= length)
+			*stop = (*step < 0) ? length - 1 : length;
 	}
 
 	if ((*step < 0 && *stop >= *start)