diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/conversion.rst | 8 | ||||
-rw-r--r-- | Doc/c-api/float.rst | 7 | ||||
-rw-r--r-- | Doc/c-api/sequence.rst | 4 | ||||
-rw-r--r-- | Doc/extending/windows.rst | 2 | ||||
-rw-r--r-- | Doc/library/__future__.rst | 2 | ||||
-rw-r--r-- | Doc/library/ctypes.rst | 4 | ||||
-rw-r--r-- | Doc/library/ftplib.rst | 2 | ||||
-rw-r--r-- | Doc/library/functions.rst | 1 | ||||
-rw-r--r-- | Doc/library/gc.rst | 5 | ||||
-rw-r--r-- | Doc/library/multiprocessing.rst | 21 | ||||
-rw-r--r-- | Doc/library/operator.rst | 2 | ||||
-rw-r--r-- | Doc/library/select.rst | 4 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 2 | ||||
-rw-r--r-- | Doc/library/string.rst | 2 | ||||
-rw-r--r-- | Doc/library/sys.rst | 13 | ||||
-rw-r--r-- | Doc/library/tkinter.tix.rst | 4 | ||||
-rw-r--r-- | Doc/library/tkinter.turtle.rst | 8 | ||||
-rw-r--r-- | Doc/library/urllib.request.rst | 2 | ||||
-rw-r--r-- | Doc/library/wsgiref.rst | 2 | ||||
-rw-r--r-- | Doc/library/xmlrpc.client.rst | 4 | ||||
-rw-r--r-- | Doc/tutorial/stdlib2.rst | 2 | ||||
-rw-r--r-- | Doc/using/windows.rst | 4 | ||||
-rw-r--r-- | Doc/whatsnew/2.6.rst | 200 |
23 files changed, 227 insertions, 78 deletions
diff --git a/Doc/c-api/conversion.rst b/Doc/c-api/conversion.rst index f926094..b71283b 100644 --- a/Doc/c-api/conversion.rst +++ b/Doc/c-api/conversion.rst @@ -83,11 +83,11 @@ The following functions provide locale-independent string to number conversions. .. cfunction:: char * PyOS_stricmp(char *s1, char *s2) - Case insensitive comparison of strings. The functions works almost - identical to :cfunc:`strcmp` except that it ignores the case. + Case insensitive comparison of strings. The function works almost + identically to :cfunc:`strcmp` except that it ignores the case. .. cfunction:: char * PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size) - Case insensitive comparison of strings. The functions works almost - identical to :cfunc:`strncmp` except that it ignores the case. + Case insensitive comparison of strings. The function works almost + identically to :cfunc:`strncmp` except that it ignores the case. diff --git a/Doc/c-api/float.rst b/Doc/c-api/float.rst index 8fff0d0..77a8b83 100644 --- a/Doc/c-api/float.rst +++ b/Doc/c-api/float.rst @@ -73,8 +73,7 @@ Floating Point Objects Return the minimum normalized positive float *DBL_MIN* as C :ctype:`double`. -.. cfunction:: void PyFloat_CompactFreeList(size_t *bc, size_t *bf, size_t *sum) +.. cfunction:: int PyFloat_ClearFreeList(void) - Compact the float free list. *bc* is the number of allocated blocks before - blocks are freed, *bf* is the number of freed blocks and *sum* is the number - of remaining objects in the blocks. + Clear the float free list. Return the number of items that could not + be freed. diff --git a/Doc/c-api/sequence.rst b/Doc/c-api/sequence.rst index 6d3ef71..0ebc0f3 100644 --- a/Doc/c-api/sequence.rst +++ b/Doc/c-api/sequence.rst @@ -143,6 +143,10 @@ Sequence Protocol Return the underlying array of PyObject pointers. Assumes that *o* was returned by :cfunc:`PySequence_Fast` and *o* is not *NULL*. + + Note, if a list gets resized, the reallocation may relocate the items array. + So, only use the underlying array pointer in contexts where the sequence + cannot change. .. cfunction:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) diff --git a/Doc/extending/windows.rst b/Doc/extending/windows.rst index a0782a7..1811277 100644 --- a/Doc/extending/windows.rst +++ b/Doc/extending/windows.rst @@ -23,7 +23,7 @@ C++. This chapter mentions a number of filenames that include an encoded Python version number. These filenames are represented with the version number shown - as ``XY``; in practive, ``'X'`` will be the major version number and ``'Y'`` + as ``XY``; in practice, ``'X'`` will be the major version number and ``'Y'`` will be the minor version number of the Python release you're working with. For example, if you are using Python 2.2.1, ``XY`` will actually be ``22``. diff --git a/Doc/library/__future__.rst b/Doc/library/__future__.rst index e2349cc..d6f82a3 100644 --- a/Doc/library/__future__.rst +++ b/Doc/library/__future__.rst @@ -16,7 +16,7 @@ * To document when incompatible changes were introduced, and when they will be --- or were --- made mandatory. This is a form of executable documentation, and - can be inspected programatically via importing :mod:`__future__` and examining + can be inspected programmatically via importing :mod:`__future__` and examining its contents. Each statement in :file:`__future__.py` is of the form:: diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 939bf8f..f422bf3 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1781,8 +1781,8 @@ Utility functions .. function:: byref(obj[, offset]) Returns a light-weight pointer to ``obj``, which must be an - instance of a ctypes type. ``offset`` defaults to zero, it must be - an integer which is added to the internal pointer value. + instance of a ctypes type. ``offset`` defaults to zero, and must be + an integer that will be added to the internal pointer value. ``byref(obj, offset)`` corresponds to this C code:: diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst index f360c60..d4f8888 100644 --- a/Doc/library/ftplib.rst +++ b/Doc/library/ftplib.rst @@ -300,7 +300,7 @@ followed by ``lines`` for the text version or ``binary`` for the binary version. Send a ``QUIT`` command to the server and close the connection. This is the "polite" way to close a connection, but it may raise an exception of the server - reponds with an error to the ``QUIT`` command. This implies a call to the + responds with an error to the ``QUIT`` command. This implies a call to the :meth:`close` method which renders the :class:`FTP` instance useless for subsequent calls (see below). diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 4b1cbc6..ac40ce7 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1186,6 +1186,7 @@ are always available. They are listed here in alphabetical order. care about trailing, unmatched values from the longer iterables. If those values are important, use :func:`itertools.zip_longest` instead. + .. rubric:: Footnotes .. [#] Specifying a buffer size currently has no effect on systems that don't have diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst index 99504c6..7c425e3 100644 --- a/Doc/library/gc.rst +++ b/Doc/library/gc.rst @@ -44,6 +44,11 @@ The :mod:`gc` module provides the following functions: :exc:`ValueError` is raised if the generation number is invalid. The number of unreachable objects found is returned. + The free lists maintained for a number of builtin types are cleared + whenever a full collection or collection of the highest generation (2) + is run. Not all items in some free lists may be freed due to the + particular implementation, in particular :class:`float`. + .. function:: set_debug(flags) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index be87775..10ccb17 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -158,7 +158,7 @@ However, if you really do need to use some shared data then The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a - double precision float and ``'i'`` inidicates a signed integer. These shared + double precision float and ``'i'`` indicates a signed integer. These shared objects will be process and thread safe. For more flexibility in using shared memory one can use the @@ -168,7 +168,7 @@ However, if you really do need to use some shared data then **Server process** A manager object returned by :func:`Manager` controls a server process which - holds python objects and allows other processes to manipulate them using + holds Python objects and allows other processes to manipulate them using proxies. A manager returned by :func:`Manager` will support types :class:`list`, @@ -451,7 +451,7 @@ Note that one can also create a shared queue by using a manager object -- see This means that if you try joining that process you may get a deadlock unless you are sure that all items which have been put on the queue have been consumed. Similarly, if the child process is non-daemonic then the parent - process may hang on exit when it tries to join all it non-daemonic children. + process may hang on exit when it tries to join all its non-daemonic children. Note that a queue created using a manager does not have this issue. See :ref:`multiprocessing-programming`. @@ -532,7 +532,8 @@ For an example of the usage of queues for interprocess communication see Equivalent to ``get(False)``. :class:`multiprocessing.Queue` has a few additional methods not found in - :class:`queue.Queue` which are usually unnecessary: + :class:`queue.Queue`. These methods are usually unnecessary for most + code: .. method:: close() @@ -772,7 +773,7 @@ Synchronization primitives ~~~~~~~~~~~~~~~~~~~~~~~~~~ Generally synchronization primitives are not as necessary in a multiprocess -program as they are in a mulithreaded program. See the documentation for +program as they are in a multithreaded program. See the documentation for :mod:`threading` module. Note that one can also create synchronization primitives by using a manager @@ -782,7 +783,7 @@ object -- see :ref:`multiprocessing-managers`. A bounded semaphore object: a clone of :class:`threading.BoundedSemaphore`. - (On Mac OSX this is indistiguishable from :class:`Semaphore` because + (On Mac OSX this is indistinguishable from :class:`Semaphore` because ``sem_getvalue()`` is not implemented on that platform). .. class:: Condition([lock]) @@ -891,8 +892,8 @@ processes. .. note:: - Although it is posible to store a pointer in shared memory remember that this - will refer to a location in the address space of a specific process. + Although it is possible to store a pointer in shared memory remember that + this will refer to a location in the address space of a specific process. However, the pointer is quite likely to be invalid in the context of a second process and trying to dereference the pointer from the second process may cause a crash. @@ -1081,7 +1082,7 @@ their parent process exits. The manager classes are defined in the Start a subprocess to start the manager. - .. method:: server_forever() + .. method:: serve_forever() Run the server in the current process. @@ -1774,7 +1775,7 @@ handler type) for messages from different processes to get mixed up. handler which sends output to :data:`sys.stderr` using format ``'[%(levelname)s/%(processName)s] %(message)s'``. (The logger allows use of the non-standard ``'%(processName)s'`` format.) Message sent to this logger - will not by default propogate to the root logger. + will not by default propagate to the root logger. Note that on Windows child processes will only inherit the level of the parent process's logger -- any other customization of the logger will not be diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 37996e0..a67c6d8 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -513,7 +513,7 @@ Python syntax and the functions in the :mod:`operator` module. +-----------------------+-------------------------+---------------------------------+ | Right Shift | ``a >> b`` | ``rshift(a, b)`` | +-----------------------+-------------------------+---------------------------------+ -| Sequence Repitition | ``seq * i`` | ``repeat(seq, i)`` | +| Sequence Repetition | ``seq * i`` | ``repeat(seq, i)`` | +-----------------------+-------------------------+---------------------------------+ | String Formatting | ``s % obj`` | ``mod(s, obj)`` | +-----------------------+-------------------------+---------------------------------+ diff --git a/Doc/library/select.rst b/Doc/library/select.rst index 102d3ea..f64d6dd 100644 --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -330,7 +330,7 @@ http://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2 +---------------------------+---------------------------------------------+ | :const:`KQ_EV_DISABLE` | Disablesevent | +---------------------------+---------------------------------------------+ - | :const:`KQ_EV_ONESHOT` | Removes event after first occurence | + | :const:`KQ_EV_ONESHOT` | Removes event after first occurrence | +---------------------------+---------------------------------------------+ | :const:`KQ_EV_CLEAR` | Reset the state after an event is retrieved | +---------------------------+---------------------------------------------+ @@ -365,7 +365,7 @@ http://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2 +============================+============================================+ | :const:`KQ_NOTE_DELETE` | *unlink()* was called | +----------------------------+--------------------------------------------+ - | :const:`KQ_NOTE_WRITE` | a write occured | + | :const:`KQ_NOTE_WRITE` | a write occurred | +----------------------------+--------------------------------------------+ | :const:`KQ_NOTE_EXTEND` | the file was extended | +----------------------------+--------------------------------------------+ diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 586770a..40417d8 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1565,7 +1565,7 @@ The constructors for both classes work the same: .. method:: isdisjoint(other) Return True if the set has no elements in common with *other*. Sets are - disjoint if and only if their interesection is the empty set. + disjoint if and only if their intersection is the empty set. .. method:: issubset(other) set <= other diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 662541e..07a2c4b 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -266,7 +266,7 @@ Then the outer replacement field would be evaluated, producing:: "noses " -Which is subsitituted into the string, yielding:: +Which is substituted into the string, yielding:: "A man with two noses " diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index f92b1e4..3f73ec2 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -54,19 +54,6 @@ always available. A string containing the copyright pertaining to the Python interpreter. -.. function:: _compact_freelists() - - Compact the free list of floats by deallocating unused blocks. - It can reduce the memory usage of the Python process several tenth of - thousands of integers or floats have been allocated at once. - - The return value is a tuple of tuples each containing three elements, - amount of used objects, total block count before the blocks are deallocated - and amount of freed blocks. - - This function should be used for specialized purposes only. - - .. function:: _clear_type_cache() Clear the internal type cache. The type cache is used to speed up attribute diff --git a/Doc/library/tkinter.tix.rst b/Doc/library/tkinter.tix.rst index a85aeb1..b555376 100644 --- a/Doc/library/tkinter.tix.rst +++ b/Doc/library/tkinter.tix.rst @@ -305,8 +305,8 @@ File Selectors .. \ulink{FileEntry}{http://tix.sourceforge.net/dist/current/demos/samples/FileEnt.tcl} -Hierachical ListBox -^^^^^^^^^^^^^^^^^^^ +Hierarchical ListBox +^^^^^^^^^^^^^^^^^^^^ .. class:: HList() diff --git a/Doc/library/tkinter.turtle.rst b/Doc/library/tkinter.turtle.rst index 575c2fc..6bf9c10 100644 --- a/Doc/library/tkinter.turtle.rst +++ b/Doc/library/tkinter.turtle.rst @@ -2,6 +2,10 @@ :mod:`turtle` --- Turtle graphics for Tk ======================================== +.. module:: tkinter.turtle + :synopsis: Turtle graphics for Tk +.. sectionauthor:: Gregor Lingl <gregor.lingl@aon.at> + Introduction ============ @@ -1251,7 +1255,7 @@ Window control ... left(10) ... >>> for _ in range(8): - ... left(45); fd(2) # a regular octogon + ... left(45); fd(2) # a regular octagon Animation control @@ -1262,7 +1266,7 @@ Animation control :param delay: positive integer Set or return the drawing *delay* in milliseconds. (This is approximately - the time interval between two consecutived canvas updates.) The longer the + the time interval between two consecutive canvas updates.) The longer the drawing delay, the slower the animation. Optional argument: diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index c506829..3038588 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1062,7 +1062,7 @@ involved. For example, the :envvar:`http_proxy` environment variable is read to obtain the HTTP proxy's URL. This example replaces the default :class:`ProxyHandler` with one that uses -programatically-supplied proxy URLs, and adds proxy authorization support with +programmatically-supplied proxy URLs, and adds proxy authorization support with :class:`ProxyBasicAuthHandler`. :: proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example.com:3128/'}) diff --git a/Doc/library/wsgiref.rst b/Doc/library/wsgiref.rst index 70064fc..fcfe769 100644 --- a/Doc/library/wsgiref.rst +++ b/Doc/library/wsgiref.rst @@ -413,7 +413,7 @@ Paste" library. from wsgiref.validate import validator from wsgiref.simple_server import make_server - # Our callable object which is intentionally not compilant to the + # Our callable object which is intentionally not compliant to the # standard, so the validator is going to break def simple_app(environ, start_response): status = '200 OK' # HTTP Status diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst index e249b12..1f18810 100644 --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -344,7 +344,7 @@ The client code for the preceding server:: try: proxy.add(2, 5) except xmlrpc.client.Fault, err: - print("A fault occured") + print("A fault occurred") print("Fault code: %d" % err.faultCode) print("Fault string: %s" % err.faultString) @@ -391,7 +391,7 @@ by providing an invalid URI:: try: proxy.some_method() except xmlrpc.client.ProtocolError, err: - print("A protocol error occured") + print("A protocol error occurred") print("URL: %s" % err.url) print("HTTP/HTTPS headers: %s" % err.headers) print("Error code: %d" % err.errcode) diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst index 7d76363..84dfb61 100644 --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -286,7 +286,7 @@ sometimes there is a need for alternative implementations with different performance trade-offs. The :mod:`array` module provides an :class:`array()` object that is like a list -that stores only homogenous data and stores it more compactly. The following +that stores only homogeneous data and stores it more compactly. The following example shows an array of numbers stored as two byte unsigned binary numbers (typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of python int objects:: diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 4064fa1..2dd236f 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -186,7 +186,7 @@ of your Python installation directory). This suppresses the terminal window on startup. You can also make all ``.py`` scripts execute with :program:`pythonw.exe`, -setting this through the usual facilites, for example (might require +setting this through the usual facilities, for example (might require administrative rights): #. Launch a command prompt. @@ -215,7 +215,7 @@ PyWin32 The `PyWin32 <http://python.net/crew/mhammond/win32/>`_ module by Mark Hammond is a collection of modules for advanced Windows-specific support. This includes -utilites for: +utilities for: * `Component Object Model <http://www.microsoft.com/com/>`_ (COM) * Win32 API calls diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 264ec2e..5cf29cb 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -51,7 +51,7 @@ This article explains the new features in Python 2.6. The release schedule is described in :pep:`361`; currently the final release is -scheduled for September 3 2008. +scheduled for October 1 2008. This article doesn't attempt to provide a complete specification of the new features, but instead provides a convenient overview. For @@ -526,28 +526,152 @@ environment variable. PEP 371: The ``multiprocessing`` Package ===================================================== -.. XXX I think this still needs help +The new :mod:`multiprocessing` package lets Python programs create new +processes that will perform a computation and return a result to the +parent. The parent and child processes can communicate using queues +and pipes, synchronize their operations using locks and semaphores, +and can share simple arrays of data. + +The :mod:`multiprocessing` module started out as an exact emulation of +the :mod:`threading` module using processes instead of threads. That +goal was discarded along the path to Python 2.6, but the general +approach of the module is still similar. The fundamental class +is the :class:`Process`, which is passed a callable object and +a collection of arguments. The :meth:`start` method +sets the callable running in a subprocess, after which you can call +the :meth:`is_alive` method to check whether the subprocess is still running +and the :meth:`join` method to wait for the process to exit. + +Here's a simple example where the subprocess will calculate a +factorial. The function doing the calculation is a bit strange; it's +written to take significantly longer when the input argument is a +multiple of 4. + +:: + + import time + from multiprocessing import Process, Queue + + + def factorial(queue, N): + "Compute a factorial." + # If N is a multiple of 4, this function will take much longer. + if (N % 4) == 0: + time.sleep(.05 * N/4) + + # Calculate the result + fact = 1L + for i in range(1, N+1): + fact = fact * i + + # Put the result on the queue + queue.put(fact) + + if __name__ == '__main__': + queue = Queue() + + N = 5 + + p = Process(target=factorial, args=(queue, N)) + p.start() + p.join() + + result = queue.get() + print 'Factorial', N, '=', result + +A :class:`Queue` object is created and stored as a global. The child +process will use the value of the variable when the child was created; +because it's a :class:`Queue`, parent and child can use the object to +communicate. (If the parent were to change the value of the global +variable, the child's value would be unaffected, and vice versa.) + +Two other classes, :class:`Pool` and :class:`Manager`, provide +higher-level interfaces. :class:`Pool` will create a fixed number of +worker processes, and requests can then be distributed to the workers +by calling :meth:`apply` or `apply_async`, adding a single request, +and :meth:`map` or :meth:`map_async` to distribute a number of +requests. The following code uses a :class:`Pool` to spread requests +across 5 worker processes, receiving a list of results back. + +:: + + from multiprocessing import Pool + + p = Pool(5) + result = p.map(factorial, range(1, 1000, 10)) + for v in result: + print v + +This produces the following output:: + + 1 + 39916800 + 51090942171709440000 + 8222838654177922817725562880000000 + 33452526613163807108170062053440751665152000000000 + ... + +The :class:`Manager` class creates a separate server process that can +hold master copies of Python data structures. Other processes can +then access and modify these data structures by using proxy objects. +The following example creates a shared dictionary by calling the +:meth:`dict` method; the worker processes then insert values into the +dictionary. (No locking is done automatically, which doesn't matter +in this example. :class:`Manager`'s methods also include +:meth:`Lock`, :meth:`RLock`, and :meth:`Semaphore` to create shared locks. + +:: + + import time + from multiprocessing import Pool, Manager + + def factorial(N, dictionary): + "Compute a factorial." + # Calculate the result + fact = 1L + for i in range(1, N+1): + fact = fact * i + + # Store result in dictionary + dictionary[N] = fact + + if __name__ == '__main__': + p = Pool(5) + mgr = Manager() + d = mgr.dict() # Create shared dictionary -:mod:`multiprocessing` makes it easy to distribute work over multiple processes. -Its API is similiar to that of :mod:`threading`. For example:: + # Run tasks using the pool + for N in range(1, 1000, 10): + p.apply_async(factorial, (N, d)) - from multiprocessing import Process + # Mark pool as closed -- no more tasks can be added. + p.close() - def long_hard_task(n): - print n * 43 + # Wait for tasks to exit + p.join() - for i in range(10): - Process(target=long_hard_task, args=(i)).start() + # Output results + for k, v in sorted(d.items()): + print k, v -will multiply the numbers between 0 and 10 times 43 and print out the result -concurrently. +This will produce the output:: + + 1 1 + 11 39916800 + 21 51090942171709440000 + 31 8222838654177922817725562880000000 + 41 33452526613163807108170062053440751665152000000000 + 51 1551118753287382280224243016469303211063259720016986112000000000000 .. seealso:: + The documentation for the :mod:`multiprocessing` module. + :pep:`371` - Addition of the multiprocessing package PEP written by Jesse Noller and Richard Oudkerk; implemented by Richard Oudkerk and Jesse Noller. + .. ====================================================================== .. _pep-3101: @@ -1775,21 +1899,6 @@ details. (Contributed by Raymond Hettinger.) -* XXX Describe the new ctypes calling convention that allows safe - access to errno. - (Implemented by Thomas Heller; :issue:`1798`.) - -* The :mod:`ctypes` module now supports a :class:`c_bool` datatype - that represents the C99 ``bool`` type. (Contributed by David Remahl; - :issue:`1649190`.) - - The :mod:`ctypes` string, buffer and array types also have improved - support for extended slicing syntax, - where various combinations of ``(start, stop, step)`` are supplied. - (Implemented by Thomas Wouters.) - - .. Revision 57769 - * A new method in the :mod:`curses` module: for a window, :meth:`chgat` changes the display characters for a certain number of characters on a single line. (Contributed by Fabian Kreutz.) @@ -2628,6 +2737,45 @@ Using the module is simple:: .. ====================================================================== +ctypes Enhancements +-------------------------------------------------- + +Thomas Heller continued to maintain and enhance the +:mod:`ctypes` module. + +:mod:`ctypes` now supports a :class:`c_bool` datatype +that represents the C99 ``bool`` type. (Contributed by David Remahl; +:issue:`1649190`.) + +The :mod:`ctypes` string, buffer and array types have improved +support for extended slicing syntax, +where various combinations of ``(start, stop, step)`` are supplied. +(Implemented by Thomas Wouters.) + +.. Revision 57769 + +A new calling convention tells :mod:`ctypes` to clear the ``errno`` or +Win32 LastError variables at the outset of each wrapped call. +(Implemented by Thomas Heller; :issue:`1798`.) + +For the Unix ``errno`` variable: when creating a wrapped function, +you can supply ``use_errno=True`` as a keyword parameter +to the :func:`DLL` function +and then call the module-level methods :meth:`set_errno` +and :meth:`get_errno` to set and retrieve the error value. + +The Win32 LastError variable is supported similarly by +the :func:`DLL`, :func:`OleDLL`, and :func:`WinDLL` functions. +You supply ``use_last_error=True`` as a keyword parameter +and then call the module-level methods :meth:`set_last_error` +and :meth:`get_last_error`. + +The :func:`byref` function, used to retrieve a pointer to a ctypes +instance, now has an optional **offset** parameter that is a byte +count that will be added to the returned pointer. + +.. ====================================================================== + Improved SSL Support -------------------------------------------------- |