Skip to content

Commit fea6a94

Browse files
committed
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 ........
1 parent 464109a commit fea6a94

File tree

7 files changed

+30
-14
lines changed

7 files changed

+30
-14
lines changed

Doc/library/math.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Number-theoretic and representation functions:
4343

4444
.. function:: factorial(x)
4545

46-
Return *x* factorial. Raises :exc:`ValueError` if *x* is not intergral or
46+
Return *x* factorial. Raises :exc:`ValueError` if *x* is not integral or
4747
is negative.
4848

4949
.. function:: floor(x)

Lib/logging/config.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# _listener holds the server object doing the listening
5050
_listener = None
5151

52-
def fileConfig(fname, defaults=None):
52+
def fileConfig(fname, defaults=None, disable_existing_loggers=1):
5353
"""
5454
Read the logging configuration from a ConfigParser-format file.
5555
@@ -79,7 +79,7 @@ def fileConfig(fname, defaults=None):
7979
del logging._handlerList[:]
8080
# Handlers add themselves to logging._handlers
8181
handlers = _install_handlers(cp, formatters)
82-
_install_loggers(cp, handlers)
82+
_install_loggers(cp, handlers, disable_existing_loggers)
8383
finally:
8484
logging._releaseLock()
8585

@@ -167,7 +167,7 @@ def _install_handlers(cp, formatters):
167167
return handlers
168168

169169

170-
def _install_loggers(cp, handlers):
170+
def _install_loggers(cp, handlers, disable_existing_loggers):
171171
"""Create and install loggers"""
172172

173173
# configure the root first
@@ -252,7 +252,7 @@ def _install_loggers(cp, handlers):
252252
logger.level = logging.NOTSET
253253
logger.handlers = []
254254
logger.propagate = 1
255-
else:
255+
elif disable_existing_loggers:
256256
logger.disabled = 1
257257

258258

Lib/test/test_site.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ def test_s_option(self):
101101
self.assert_(usersite in sys.path)
102102

103103
rc = subprocess.call([sys.executable, '-c',
104-
'import sys; sys.exit("%s" in sys.path)' % usersite])
104+
'import sys; sys.exit(%r in sys.path)' % usersite])
105105
self.assertEqual(rc, 1)
106106

107107
rc = subprocess.call([sys.executable, '-s', '-c',
108-
'import sys; sys.exit("%s" in sys.path)' % usersite])
108+
'import sys; sys.exit(%r in sys.path)' % usersite])
109109
self.assertEqual(rc, 0)
110110

111111
env = os.environ.copy()
112112
env["PYTHONNOUSERSITE"] = "1"
113113
rc = subprocess.call([sys.executable, '-c',
114-
'import sys; sys.exit("%s" in sys.path)' % usersite],
114+
'import sys; sys.exit(%r in sys.path)' % usersite],
115115
env=env)
116116
self.assertEqual(rc, 0)
117117

Lib/test/test_slice.py

+14
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ def test_indices(self):
8282
self.assertEqual(slice(None, None, -1).indices(10), (9, -1, -1))
8383
self.assertEqual(slice(None, None, -2).indices(10), (9, -1, -2))
8484
self.assertEqual(slice(3, None, -2).indices(10), (3, -1, -2))
85+
# issue 3004 tests
86+
self.assertEqual(slice(None, -9).indices(10), (0, 1, 1))
87+
self.assertEqual(slice(None, -10).indices(10), (0, 0, 1))
88+
self.assertEqual(slice(None, -11).indices(10), (0, 0, 1))
89+
self.assertEqual(slice(None, -10, -1).indices(10), (9, 0, -1))
90+
self.assertEqual(slice(None, -11, -1).indices(10), (9, -1, -1))
91+
self.assertEqual(slice(None, -12, -1).indices(10), (9, -1, -1))
92+
self.assertEqual(slice(None, 9).indices(10), (0, 9, 1))
93+
self.assertEqual(slice(None, 10).indices(10), (0, 10, 1))
94+
self.assertEqual(slice(None, 11).indices(10), (0, 10, 1))
95+
self.assertEqual(slice(None, 8, -1).indices(10), (9, 8, -1))
96+
self.assertEqual(slice(None, 9, -1).indices(10), (9, 9, -1))
97+
self.assertEqual(slice(None, 10, -1).indices(10), (9, 9, -1))
98+
8599
self.assertEqual(
86100
slice(-100, 100 ).indices(10),
87101
slice(None).indices(10)

Modules/_cursesmodule.c

+2
Original file line numberDiff line numberDiff line change
@@ -2380,6 +2380,7 @@ PyCurses_QiFlush(PyObject *self, PyObject *args)
23802380

23812381
/* Internal helper used for updating curses.LINES, curses.COLS, _curses.LINES
23822382
* and _curses.COLS */
2383+
#if defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)
23832384
static int
23842385
update_lines_cols(void)
23852386
{
@@ -2424,6 +2425,7 @@ update_lines_cols(void)
24242425
Py_DECREF(m);
24252426
return 1;
24262427
}
2428+
#endif
24272429

24282430
#ifdef HAVE_CURSES_RESIZETERM
24292431
static PyObject *

Modules/mathmodule.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,11 @@ FUNC1(tanh, tanh, 0,
382382
sum([1e+308, 1e+308, 1e-308]) raises an OverflowError due to the
383383
overflow of the first partial sum.
384384
385-
Note 3: The itermediate values lo, yr, and hi are declared volatile so
386-
aggressive compilers won't algebraicly reduce lo to always be exactly 0.0.
385+
Note 3: The intermediate values lo, yr, and hi are declared volatile so
386+
aggressive compilers won't algebraically reduce lo to always be exactly 0.0.
387387
Also, the volatile declaration forces the values to be stored in memory as
388388
regular doubles instead of extended long precision (80-bit) values. This
389-
prevents double rounding because any addition or substraction of two doubles
389+
prevents double rounding because any addition or subtraction of two doubles
390390
can be resolved exactly into double-sized hi and lo values. As long as the
391391
hi value gets forced into a double before yr and lo are computed, the extra
392392
bits in downstream extended precision operations (x87 for example) will be
@@ -614,7 +614,6 @@ math_factorial(PyObject *self, PyObject *arg)
614614

615615
error:
616616
Py_DECREF(result);
617-
Py_XDECREF(iobj);
618617
return NULL;
619618
}
620619

Objects/sliceobject.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
169169
else {
170170
if (!_PyEval_SliceIndex(r->stop, stop)) return -1;
171171
if (*stop < 0) *stop += length;
172-
if (*stop < 0) *stop = -1;
173-
if (*stop > length) *stop = length;
172+
if (*stop < 0) *stop = (*step < 0) ? -1 : 0;
173+
if (*stop >= length)
174+
*stop = (*step < 0) ? length - 1 : length;
174175
}
175176

176177
if ((*step < 0 && *stop >= *start)

0 commit comments

Comments
 (0)