summaryrefslogtreecommitdiffstats
path: root/Include/pymem.h
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2010-03-09 22:31:52 (GMT)
committerBarry Warsaw <barry@python.org>2010-03-09 22:31:52 (GMT)
commitfb0928d1176a1e517cc5e46aeafbf54ff5c2554c (patch)
treee6e2d95489b887b51eb31b7ab42a6fee999a43cd /Include/pymem.h
parent2a5b6225102534736411354a3789ad9b64ccf3b7 (diff)
downloadcpython-2.6.5rc2.zip
cpython-2.6.5rc2.tar.gz
cpython-2.6.5rc2.tar.bz2
Bumping to 2.6.5rc2v2.6.5rc2
Diffstat (limited to 'Include/pymem.h')
0 files changed, 0 insertions, 0 deletions
moment. ........ r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines #1696393: don't check for '.' and '..' in ntpath.walk since they aren't returned from os.listdir anymore. Reported by Michael Haggerty. ........ r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines #1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir. Reported by Jesse Towner. ........ r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines #1591: Clarify docstring of Popen3. ........ r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines #1680: fix context manager example function name. ........ r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines #1755097: document default values for [].sort() and sorted(). ........ --- Doc/ACKS.txt | 1 + Doc/c-api/newtypes.rst | 2 +- Doc/c-api/utilities.rst | 20 ++---- Doc/library/collections.rst | 38 +++++----- Doc/library/contextlib.rst | 2 - Doc/library/decimal.rst | 1 - Doc/library/fcntl.rst | 2 +- Doc/library/functions.rst | 7 +- Doc/library/msilib.rst | 2 +- Doc/library/msvcrt.rst | 2 +- Doc/library/numbers.rst | 2 +- Doc/library/os.rst | 145 +++++++++++++++++++-------------------- Doc/library/socket.rst | 39 +++++++++++ Doc/library/stdtypes.rst | 33 +++++++-- Doc/library/thread.rst | 1 - Doc/library/threading.rst | 1 - Doc/library/winsound.rst | 2 +- Doc/reference/compound_stmts.rst | 45 ++++++++---- Doc/reference/datamodel.rst | 23 +++++-- Doc/reference/expressions.rst | 25 +++---- Doc/reference/simple_stmts.rst | 77 ++++++++++++--------- Doc/whatsnew/2.6.rst | 12 ++-- Lib/collections.py | 18 +++-- Lib/ntpath.py | 10 +-- Lib/posixpath.py | 6 +- Lib/tarfile.py | 8 +-- Lib/test/test_collections.py | 19 ++--- Lib/test/test_doctest.py | 2 +- Lib/test/test_ntpath.py | 1 + Lib/test/test_posixpath.py | 1 + Lib/test/test_socket.py | 11 +++ Lib/test/test_tarfile.py | 17 +++++ Lib/test/test_urlparse.py | 23 +++++++ Lib/urlparse.py | 21 +++--- Misc/ACKS | 1 + Modules/fcntlmodule.c | 2 +- Modules/socketmodule.c | 43 +++++++++++- Modules/socketmodule.h | 1 + PCbuild/build_tkinter.py | 4 +- Python/dynload_win.c | 3 +- Python/pystrtod.c | 74 ++++++++++++++------ Tools/buildbot/buildmsi.bat | 4 +- Tools/msi/msi.py | 22 +++--- 43 files changed, 509 insertions(+), 264 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt index 5f6e12f..32943bd 100644 --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -73,6 +73,7 @@ docs@python.org), and we'll be glad to correct the problem. * Travis B. Hartwell * Tim Hatch * Janko Hauser + * Thomas Heller * Bernhard Herzog * Magnus L. Hetland * Konrad Hinsen diff --git a/Doc/c-api/newtypes.rst b/Doc/c-api/newtypes.rst index 88a4f2f..8c72ef1 100644 --- a/Doc/c-api/newtypes.rst +++ b/Doc/c-api/newtypes.rst @@ -729,7 +729,7 @@ type objects) *must* have the :attr:`ob_size` field. indicated by the :const:`Py_TPFLAGS_HAVE_RICHCOMPARE` flag bit) and have *NULL* values. - The following bit masks are currently defined; these can be or-ed together using + The following bit masks are currently defined; these can be ORed together using the ``|`` operator to form the value of the :attr:`tp_flags` field. The macro :cfunc:`PyType_HasFeature` takes a type and a flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-zero. diff --git a/Doc/c-api/utilities.rst b/Doc/c-api/utilities.rst index c4c4b7e..c30a62a 100644 --- a/Doc/c-api/utilities.rst +++ b/Doc/c-api/utilities.rst @@ -197,19 +197,14 @@ Importing Modules to find out. Starting with Python 2.4, a failing import of a module no longer leaves the module in ``sys.modules``. - .. index:: single: modules (in module sys) - .. cfunction:: PyObject* PyImport_ImportModuleNoBlock(const char *name) - .. index:: - single: `cfunc:PyImport_ImportModule` - - This version of `cfunc:PyImport_ImportModule` does not block. It's intended + This version of :cfunc:`PyImport_ImportModule` does not block. It's intended to be used in C function which import other modules to execute a function. The import may block if another thread holds the import lock. The function - `cfunc:PyImport_ImportModuleNoBlock` doesn't block. It first tries to fetch - the module from sys.modules and falls back to `cfunc:PyImport_ImportModule` + :cfunc:`PyImport_ImportModuleNoBlock` doesn't block. It first tries to fetch + the module from sys.modules and falls back to :cfunc:`PyImport_ImportModule` unless the the lock is hold. In the latter case the function raises an ImportError. @@ -231,9 +226,6 @@ Importing Modules Failing imports remove incomplete module objects, like with :cfunc:`PyImport_ImportModule`. - The function is an alias for `cfunc:PyImport_ImportModuleLevel` with -1 as - *level*, meaning relative import. - .. cfunction:: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) @@ -286,9 +278,9 @@ Importing Modules :func:`compile`, load the module. Return a new reference to the module object, or *NULL* with an exception set if an error occurred. Before Python 2.4, the module could still be created in error cases. Starting with Python 2.4, *name* - is removed from ``sys.modules`` in error cases, and even if *name* was already - in ``sys.modules`` on entry to :cfunc:`PyImport_ExecCodeModule`. Leaving - incompletely initialized modules in ``sys.modules`` is dangerous, as imports of + is removed from :attr:`sys.modules` in error cases, and even if *name* was already + in :attr:`sys.modules` on entry to :cfunc:`PyImport_ExecCodeModule`. Leaving + incompletely initialized modules in :attr:`sys.modules` is dangerous, as imports of such modules have no way to know that the module object is an unknown (and probably damaged with respect to the module author's intents) state. diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index b650462..5b625ee 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -419,10 +419,18 @@ Example:: __slots__ = () + _fields = ('x', 'y') + def __new__(cls, x, y): return tuple.__new__(cls, (x, y)) - _cast = classmethod(tuple.__new__) + @classmethod + def _make(cls, iterable): + 'Make a new Point object from a sequence or iterable' + result = tuple.__new__(cls, iterable) + if len(result) != 2: + raise TypeError('Expected 2 arguments, got %d' % len(result)) + return result def __repr__(self): return 'Point(x=%r, y=%r)' % self @@ -433,11 +441,10 @@ Example:: def _replace(self, **kwds): 'Return a new Point object replacing specified fields with new values' - return Point._cast(map(kwds.get, ('x', 'y'), self)) - - @property - def _fields(self): - return ('x', 'y') + result = self._make(map(kwds.pop, ('x', 'y'), self)) + if kwds: + raise ValueError('Got unexpected field names: %r' % kwds.keys()) + return result x = property(itemgetter(0)) y = property(itemgetter(1)) @@ -459,29 +466,28 @@ by the :mod:`csv` or :mod:`sqlite3` modules:: EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade') import csv - for emp in map(EmployeeRecord._cast, csv.reader(open("employees.csv", "rb"))): + for emp in map(EmployeeRecord._make, csv.reader(open("employees.csv", "rb"))): print(emp.name, emp.title) import sqlite3 conn = sqlite3.connect('/companydata') cursor = conn.cursor() cursor.execute('SELECT name, age, title, department, paygrade FROM employees') - for emp in map(EmployeeRecord._cast, cursor.fetchall()): + for emp in map(EmployeeRecord._make, cursor.fetchall()): print emp.name, emp.title In addition to the methods inherited from tuples, named tuples support -three additonal methods and a read-only attribute. +three additional methods and one attribute. -.. method:: namedtuple._cast(iterable) +.. method:: namedtuple._make(iterable) - Class method returning a new instance taking the positional arguments from the *iterable*. - Useful for casting existing sequences and iterables to named tuples: + Class method that makes a new instance from an existing sequence or iterable. :: - >>> t = [11, 22] - >>> Point._cast(t) - Point(x=11, y=22) + >>> t = [11, 22] + >>> Point._make(t) + Point(x=11, y=22) .. method:: somenamedtuple._asdict() @@ -507,7 +513,7 @@ three additonal methods and a read-only attribute. .. attribute:: somenamedtuple._fields - Return a tuple of strings listing the field names. This is useful for introspection + Tuple of strings listing the field names. This is useful for introspection and for creating new named tuple types from existing named tuples. :: diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst index cab2e8c..54d2a19 100644 --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -21,7 +21,6 @@ Functions provided: A simple example (this is not recommended as a real way of generating HTML!):: - from __future__ import with_statement from contextlib import contextmanage