Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0bd4e11

Browse files
committed
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60735-60751 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r60735 | raymond.hettinger | 2008-02-11 23:53:01 +0100 (Mon, 11 Feb 2008) | 1 line Add notes on how decimal fits into the model. ........ r60737 | raymond.hettinger | 2008-02-12 00:34:56 +0100 (Tue, 12 Feb 2008) | 1 line Fix markup ........ r60738 | raymond.hettinger | 2008-02-12 00:38:00 +0100 (Tue, 12 Feb 2008) | 1 line Backport ABC docs ........ r60739 | raymond.hettinger | 2008-02-12 01:15:32 +0100 (Tue, 12 Feb 2008) | 1 line Restore fractions.rst to the document tree. ........ r60740 | raymond.hettinger | 2008-02-12 01:48:20 +0100 (Tue, 12 Feb 2008) | 1 line Fix typo in comments ........ r60741 | raymond.hettinger | 2008-02-12 02:18:03 +0100 (Tue, 12 Feb 2008) | 1 line Bring decimal a bit closer to the spec for Reals. ........ r60743 | martin.v.loewis | 2008-02-12 14:47:26 +0100 (Tue, 12 Feb 2008) | 2 lines Patch #1736: Fix file name handling of _msi.FCICreate. ........ r60745 | kurt.kaiser | 2008-02-12 16:45:50 +0100 (Tue, 12 Feb 2008) | 2 lines what??! Correct r60225. ........ r60747 | martin.v.loewis | 2008-02-12 19:47:34 +0100 (Tue, 12 Feb 2008) | 4 lines Patch #1966: Break infinite loop in httplib when the servers implements the chunked encoding incorrectly. Will backport to 2.5. ........ r60749 | raymond.hettinger | 2008-02-12 20:05:36 +0100 (Tue, 12 Feb 2008) | 1 line dict.copy() rises from the ashes. Revert r60687. ........
1 parent 4718bf8 commit 0bd4e11

8 files changed

Lines changed: 65 additions & 14 deletions

File tree

Doc/library/collections.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ This module implements high-performance container datatypes. Currently,
1212
there are two datatypes, :class:`deque` and :class:`defaultdict`, and
1313
one datatype factory function, :func:`namedtuple`.
1414

15+
Besides the containers provided here, the optional :mod:`bsddb`
16+
module offers the ability to create in-memory or file based ordered
17+
dictionaries with string keys using the :meth:`bsddb.btopen` method.
18+
19+
In addition to containers, the collections module provides some ABCs
20+
(abstract base classes) that can be used to test whether a class
21+
provides a particular interface, for example, is it hashable or
22+
a mapping.
23+
1524
The specialized containers provided in this module provide alternatives
1625
to Python's general purpose built-in containers, :class:`dict`,
1726
:class:`list`, :class:`set`, and :class:`tuple`.
18-
1927
Besides the containers provided here, the optional :mod:`bsddb`
2028
module offers the ability to create in-memory or file based ordered
2129
dictionaries with string keys using the :meth:`bsddb.btopen` method.
@@ -128,7 +136,6 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin:
128136
(For more about ABCs, see the :mod:`abc` module and :pep:`3119`.)
129137

130138

131-
132139
.. _deque-objects:
133140

134141
:class:`deque` objects

Doc/library/fractions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
:mod:`fractions` --- Rational numbers
3-
====================================
3+
=====================================
44

55
.. module:: fractions
66
:synopsis: Rational numbers.

Lib/decimal.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,20 @@ def __int__(self):
15181518

15191519
__trunc__ = __int__
15201520

1521+
@property
1522+
def real(self):
1523+
return self
1524+
1525+
@property
1526+
def imag(self):
1527+
return Decimal(0)
1528+
1529+
def conjugate(self):
1530+
return self
1531+
1532+
def __complex__(self):
1533+
return complex(float(self))
1534+
15211535
def _fix_nan(self, context):
15221536
"""Decapitate the payload of a NaN to fit the context"""
15231537
payload = self._int

Lib/httplib.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ def _read_chunked(self, amt):
596596
### note: we shouldn't have any trailers!
597597
while True:
598598
line = self.fp.readline()
599+
if not line:
600+
# a vanishingly small number of sites EOF without
601+
# sending the trailer
602+
break
599603
if line == b"\r\n":
600604
break
601605

Lib/idlelib/configHandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def Save(self):
143143
try:
144144
cfgFile = open(fname, 'w')
145145
except IOError:
146-
fname.unlink()
146+
os.unlink(fname)
147147
cfgFile = open(fname, 'w')
148148
self.write(cfgFile)
149149
else:

Lib/numbers.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,32 @@ class Inexact(Number):
4646
# Inexact.register(decimal.Decimal)
4747

4848

49+
## Notes on Decimal and it how relates to the numeric tower
50+
## --------------------------------------------------------
51+
## Decimal is Real except that it does not support rich comparisons.
52+
##
53+
## Decimal has some of the characteristics of Integrals. It provides
54+
## logical operations but not as operators. The logical operations only apply
55+
## to a subset of decimals (those that are non-negative, have a zero exponent,
56+
## and have digits that are only 0 or 1). It does provide __long__() and
57+
## a three argument form of __pow__ that includes exactness guarantees.
58+
## It does not provide an __index__() method.
59+
##
60+
## Depending on context, decimal operations may be exact or inexact.
61+
##
62+
## When decimal is run in a context with small precision and automatic rounding,
63+
## it is Inexact. See the "Floating point notes" section of the decimal docs
64+
## for an example of losing the associative and distributive properties of
65+
## addition.
66+
##
67+
## When decimal is used for high precision integer arithmetic, it is Exact.
68+
## When the decimal used as fixed-point, it is Exact.
69+
## When it is run with sufficient precision, it is Exact.
70+
## When the decimal.Inexact trap is set, decimal operations are Exact.
71+
## For an example, see the float_to_decimal() recipe in the "Decimal FAQ"
72+
## section of the docs -- it shows an how traps are used in conjunction
73+
## with variable precision to reliably achieve exact results.
74+
4975
class Complex(Number):
5076
"""Complex defines the operations that work on the builtin complex type.
5177

Modules/_collectionsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ defdict_copy(defdictobject *dd)
11271127
{
11281128
/* This calls the object's class. That only works for subclasses
11291129
whose class constructor has the same signature. Subclasses that
1130-
define a different constructor signature must override __copy__().
1130+
define a different constructor signature must override copy().
11311131
*/
11321132
return PyObject_CallFunctionObjArgs((PyObject*)Py_TYPE(dd),
11331133
dd->default_factory, dd, NULL);

PC/_msi.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ static FNFCIGETOPENINFO(cb_getopeninfo)
180180

181181
static PyObject* fcicreate(PyObject* obj, PyObject* args)
182182
{
183-
char *cabname;
183+
char *cabname, *p;
184184
PyObject *files;
185185
CCAB ccab;
186186
HFCI hfci;
187187
ERF erf;
188-
int i;
188+
Py_ssize_t i;
189189

190190

191191
if (!PyArg_ParseTuple(args, "sO:FCICreate", &cabname, &files))
@@ -208,22 +208,22 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args)
208208
ccab.setID = 0;
209209
ccab.szDisk[0] = '\0';
210210

211-
for (i=0; cabname[i]; i++)
212-
if (cabname[i] == '\\' || cabname[i] == '/')
213-
break;
211+
for (i = 0, p = cabname; *p; p = CharNext(p))
212+
if (*p == '\\' || *p == '/')
213+
i = p - cabname + 1;
214214

215-
if (i > sizeof(ccab.szCabPath) ||
216-
strlen(cabname+i) > sizeof(ccab.szCab)) {
215+
if (i >= sizeof(ccab.szCabPath) ||
216+
strlen(cabname+i) >= sizeof(ccab.szCab)) {
217217
PyErr_SetString(PyExc_ValueError, "path name too long");
218218
return 0;
219219
}
220220

221-
if (cabname[i]) {
221+
if (i > 0) {
222222
memcpy(ccab.szCabPath, cabname, i);
223223
ccab.szCabPath[i] = '\0';
224224
strcpy(ccab.szCab, cabname+i);
225225
} else {
226-
strcpy(ccab.szCabPath, ".");
226+
strcpy(ccab.szCabPath, ".\\");
227227
strcpy(ccab.szCab, cabname);
228228
}
229229

0 commit comments

Comments
 (0)