Commit 321976b6 authored by Georg Brandl's avatar Georg Brandl

Remove versionadded and versionchanged directives, fold information into text where necessary.

parent 2326a79d
...@@ -170,10 +170,6 @@ Object Protocol ...@@ -170,10 +170,6 @@ Object Protocol
of the value of that attribute with *cls* will be used to determine the result of the value of that attribute with *cls* will be used to determine the result
of this function. of this function.
.. versionadded:: 2.1
.. versionchanged:: 2.2
Support for a tuple as the second argument added.
Subclass determination is done in a fairly straightforward way, but includes a Subclass determination is done in a fairly straightforward way, but includes a
wrinkle that implementors of extensions to the class system may want to be aware wrinkle that implementors of extensions to the class system may want to be aware
...@@ -196,11 +192,6 @@ is considered sufficient for this determination. ...@@ -196,11 +192,6 @@ is considered sufficient for this determination.
``0``. If either *derived* or *cls* is not an actual class object (or tuple), ``0``. If either *derived* or *cls* is not an actual class object (or tuple),
this function uses the generic algorithm described above. this function uses the generic algorithm described above.
.. versionadded:: 2.1
.. versionchanged:: 2.3
Older versions of Python did not support a tuple as the second argument.
.. cfunction:: int PyCallable_Check(PyObject *o) .. cfunction:: int PyCallable_Check(PyObject *o)
...@@ -217,8 +208,6 @@ is considered sufficient for this determination. ...@@ -217,8 +208,6 @@ is considered sufficient for this determination.
success, or *NULL* on failure. This is the equivalent of the Python expression success, or *NULL* on failure. This is the equivalent of the Python expression
``callable_object(*args, **kw)``. ``callable_object(*args, **kw)``.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args) .. cfunction:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args)
...@@ -257,8 +246,6 @@ is considered sufficient for this determination. ...@@ -257,8 +246,6 @@ is considered sufficient for this determination.
of parameters followed by *NULL*. Returns the result of the call on success, or of parameters followed by *NULL*. Returns the result of the call on success, or
*NULL* on failure. *NULL* on failure.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL) .. cfunction:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL)
...@@ -268,8 +255,6 @@ is considered sufficient for this determination. ...@@ -268,8 +255,6 @@ is considered sufficient for this determination.
of parameters followed by *NULL*. Returns the result of the call on success, or of parameters followed by *NULL*. Returns the result of the call on success, or
*NULL* on failure. *NULL* on failure.
.. versionadded:: 2.2
.. cfunction:: long PyObject_Hash(PyObject *o) .. cfunction:: long PyObject_Hash(PyObject *o)
...@@ -311,8 +296,6 @@ is considered sufficient for this determination. ...@@ -311,8 +296,6 @@ is considered sufficient for this determination.
Return true if the object *o* is of type *type* or a subtype of *type*. Both Return true if the object *o* is of type *type* or a subtype of *type*. Both
parameters must be non-*NULL*. parameters must be non-*NULL*.
.. versionadded:: 2.2
.. cfunction:: Py_ssize_t PyObject_Length(PyObject *o) .. cfunction:: Py_ssize_t PyObject_Length(PyObject *o)
Py_ssize_t PyObject_Size(PyObject *o) Py_ssize_t PyObject_Size(PyObject *o)
...@@ -408,8 +391,6 @@ Number Protocol ...@@ -408,8 +391,6 @@ Number Protocol
Return the floor of *o1* divided by *o2*, or *NULL* on failure. This is Return the floor of *o1* divided by *o2*, or *NULL* on failure. This is
equivalent to the "classic" division of integers. equivalent to the "classic" division of integers.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2) .. cfunction:: PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2)
...@@ -419,8 +400,6 @@ Number Protocol ...@@ -419,8 +400,6 @@ Number Protocol
numbers in base two. This function can return a floating point value when numbers in base two. This function can return a floating point value when
passed two integers. passed two integers.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2) .. cfunction:: PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2)
...@@ -536,8 +515,6 @@ Number Protocol ...@@ -536,8 +515,6 @@ Number Protocol
The operation is done *in-place* when *o1* supports it. This is the equivalent The operation is done *in-place* when *o1* supports it. This is the equivalent
of the Python statement ``o1 //= o2``. of the Python statement ``o1 //= o2``.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2) .. cfunction:: PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2)
...@@ -547,8 +524,6 @@ Number Protocol ...@@ -547,8 +524,6 @@ Number Protocol
numbers in base two. This function can return a floating point value when numbers in base two. This function can return a floating point value when
passed two integers. The operation is done *in-place* when *o1* supports it. passed two integers. The operation is done *in-place* when *o1* supports it.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2) .. cfunction:: PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2)
...@@ -633,8 +608,6 @@ Number Protocol ...@@ -633,8 +608,6 @@ Number Protocol
Returns the *o* converted to a Python int or long on success or *NULL* with a Returns the *o* converted to a Python int or long on success or *NULL* with a
TypeError exception raised on failure. TypeError exception raised on failure.
.. versionadded:: 2.5
.. cfunction:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) .. cfunction:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc)
...@@ -646,16 +619,12 @@ Number Protocol ...@@ -646,16 +619,12 @@ Number Protocol
exception is cleared and the value is clipped to *PY_SSIZE_T_MIN* for a negative exception is cleared and the value is clipped to *PY_SSIZE_T_MIN* for a negative
integer or *PY_SSIZE_T_MAX* for a positive integer. integer or *PY_SSIZE_T_MAX* for a positive integer.
.. versionadded:: 2.5
.. cfunction:: int PyIndex_Check(PyObject *o) .. cfunction:: int PyIndex_Check(PyObject *o)
Returns True if *o* is an index integer (has the nb_index slot of the Returns True if *o* is an index integer (has the nb_index slot of the
tp_as_number structure filled in). tp_as_number structure filled in).
.. versionadded:: 2.5
.. _sequence: .. _sequence:
...@@ -801,8 +770,6 @@ Sequence Protocol ...@@ -801,8 +770,6 @@ Sequence Protocol
Return the underlying array of PyObject pointers. Assumes that *o* was returned Return the underlying array of PyObject pointers. Assumes that *o* was returned
by :cfunc:`PySequence_Fast` and *o* is not *NULL*. by :cfunc:`PySequence_Fast` and *o* is not *NULL*.
.. versionadded:: 2.4
.. cfunction:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) .. cfunction:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i)
...@@ -811,8 +778,6 @@ Sequence Protocol ...@@ -811,8 +778,6 @@ Sequence Protocol
:cfunc:`PySequence_Check(o)` is true and without adjustment for negative :cfunc:`PySequence_Check(o)` is true and without adjustment for negative
indices. indices.
.. versionadded:: 2.3
.. cfunction:: Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o) .. cfunction:: Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o)
...@@ -906,11 +871,8 @@ Mapping Protocol ...@@ -906,11 +871,8 @@ Mapping Protocol
Iterator Protocol Iterator Protocol
================= =================
.. versionadded:: 2.2
There are only a couple of functions specifically for working with iterators. There are only a couple of functions specifically for working with iterators.
.. cfunction:: int PyIter_Check(PyObject *o) .. cfunction:: int PyIter_Check(PyObject *o)
Return true if the object *o* supports the iterator protocol. Return true if the object *o* supports the iterator protocol.
...@@ -965,8 +927,6 @@ Buffer Protocol ...@@ -965,8 +927,6 @@ Buffer Protocol
*buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:`TypeError` *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:`TypeError`
on error. on error.
.. versionadded:: 1.6
.. cfunction:: int PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len) .. cfunction:: int PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len)
...@@ -975,16 +935,12 @@ Buffer Protocol ...@@ -975,16 +935,12 @@ Buffer Protocol
success, returns ``0``, sets *buffer* to the memory location and *buffer_len* to success, returns ``0``, sets *buffer* to the memory location and *buffer_len* to
the buffer length. Returns ``-1`` and sets a :exc:`TypeError` on error. the buffer length. Returns ``-1`` and sets a :exc:`TypeError` on error.
.. versionadded:: 1.6
.. cfunction:: int PyObject_CheckReadBuffer(PyObject *o) .. cfunction:: int PyObject_CheckReadBuffer(PyObject *o)
Returns ``1`` if *o* supports the single-segment readable buffer interface. Returns ``1`` if *o* supports the single-segment readable buffer interface.
Otherwise returns ``0``. Otherwise returns ``0``.
.. versionadded:: 2.2
.. cfunction:: int PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len) .. cfunction:: int PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len)
...@@ -993,5 +949,3 @@ Buffer Protocol ...@@ -993,5 +949,3 @@ Buffer Protocol
``0``, sets *buffer* to the memory location and *buffer_len* to the buffer ``0``, sets *buffer* to the memory location and *buffer_len* to the buffer
length. Returns ``-1`` and sets a :exc:`TypeError` on error. length. Returns ``-1`` and sets a :exc:`TypeError` on error.
.. versionadded:: 1.6
This diff is collapsed.
...@@ -257,8 +257,6 @@ in various ways. There is a separate error indicator for each thread. ...@@ -257,8 +257,6 @@ in various ways. There is a separate error indicator for each thread.
Similar to :cfunc:`PyErr_SetFromWindowsErr`, with an additional parameter Similar to :cfunc:`PyErr_SetFromWindowsErr`, with an additional parameter
specifying the exception type to be raised. Availability: Windows. specifying the exception type to be raised. Availability: Windows.
.. versionadded:: 2.3
.. cfunction:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename) .. cfunction:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename)
...@@ -272,8 +270,6 @@ in various ways. There is a separate error indicator for each thread. ...@@ -272,8 +270,6 @@ in various ways. There is a separate error indicator for each thread.
Similar to :cfunc:`PyErr_SetFromWindowsErrWithFilename`, with an additional Similar to :cfunc:`PyErr_SetFromWindowsErrWithFilename`, with an additional
parameter specifying the exception type to be raised. Availability: Windows. parameter specifying the exception type to be raised. Availability: Windows.
.. versionadded:: 2.3
.. cfunction:: void PyErr_BadInternalCall() .. cfunction:: void PyErr_BadInternalCall()
...@@ -399,7 +395,7 @@ the variables: ...@@ -399,7 +395,7 @@ the variables:
+------------------------------------+----------------------------+----------+ +------------------------------------+----------------------------+----------+
| C Name | Python Name | Notes | | C Name | Python Name | Notes |
+====================================+============================+==========+ +====================================+============================+==========+
| :cdata:`PyExc_BaseException` | :exc:`BaseException` | (1), (4) | | :cdata:`PyExc_BaseException` | :exc:`BaseException` | \(1) |
+------------------------------------+----------------------------+----------+ +------------------------------------+----------------------------+----------+
| :cdata:`PyExc_Exception` | :exc:`Exception` | \(1) | | :cdata:`PyExc_Exception` | :exc:`Exception` | \(1) |
+------------------------------------+----------------------------+----------+ +------------------------------------+----------------------------+----------+
...@@ -497,19 +493,3 @@ Notes: ...@@ -497,19 +493,3 @@ Notes:
(3) (3)
Only defined on Windows; protect code that uses this by testing that the Only defined on Windows; protect code that uses this by testing that the
preprocessor macro ``MS_WINDOWS`` is defined. preprocessor macro ``MS_WINDOWS`` is defined.
(4)
.. versionadded:: 2.5
Deprecation of String Exceptions
================================
.. index:: single: BaseException (built-in exception)
All exceptions built into Python or provided in the standard library are derived
from :exc:`BaseException`.
String exceptions are still supported in the interpreter to allow existing code
to run unmodified, but this will also change in a future release.
...@@ -42,8 +42,6 @@ Initialization, Finalization, and Threads ...@@ -42,8 +42,6 @@ Initialization, Finalization, and Threads
*initsigs* is 0, it skips initialization registration of signal handlers, which *initsigs* is 0, it skips initialization registration of signal handlers, which
might be useful when Python is embedded. might be useful when Python is embedded.
.. versionadded:: 2.4
.. cfunction:: int Py_IsInitialized() .. cfunction:: int Py_IsInitialized()
...@@ -290,8 +288,6 @@ Initialization, Finalization, and Threads ...@@ -290,8 +288,6 @@ Initialization, Finalization, and Threads
was built from. This number is a string because it may contain a trailing 'M' was built from. This number is a string because it may contain a trailing 'M'
if Python was built from a mixed revision source tree. if Python was built from a mixed revision source tree.
.. versionadded:: 2.5
.. cfunction:: const char* Py_GetPlatform() .. cfunction:: const char* Py_GetPlatform()
...@@ -570,8 +566,6 @@ supports the creation of additional interpreters (using ...@@ -570,8 +566,6 @@ supports the creation of additional interpreters (using
avoid calls to the locking API when running single-threaded. This function is avoid calls to the locking API when running single-threaded. This function is
not available when thread support is disabled at compile time. not available when thread support is disabled at compile time.
.. versionadded:: 2.4
.. cfunction:: void PyEval_AcquireLock() .. cfunction:: void PyEval_AcquireLock()
...@@ -719,10 +713,6 @@ created. ...@@ -719,10 +713,6 @@ created.
is available. If this function returns *NULL*, no exception has been raised and is available. If this function returns *NULL*, no exception has been raised and
the caller should assume no current thread state is available. the caller should assume no current thread state is available.
.. versionchanged:: 2.3
Previously this could only be called when a current thread is active, and *NULL*
meant that an exception was raised.
.. cfunction:: int PyThreadState_SetAsyncExc(long id, PyObject *exc) .. cfunction:: int PyThreadState_SetAsyncExc(long id, PyObject *exc)
...@@ -734,8 +724,6 @@ created. ...@@ -734,8 +724,6 @@ created.
zero if the thread id isn't found. If *exc* is :const:`NULL`, the pending zero if the thread id isn't found. If *exc* is :const:`NULL`, the pending
exception (if any) for the thread is cleared. This raises no exceptions. exception (if any) for the thread is cleared. This raises no exceptions.
.. versionadded:: 2.3
.. cfunction:: PyGILState_STATE PyGILState_Ensure() .. cfunction:: PyGILState_STATE PyGILState_Ensure()
...@@ -758,8 +746,6 @@ created. ...@@ -758,8 +746,6 @@ created.
When the function returns, the current thread will hold the GIL. Failure is a When the function returns, the current thread will hold the GIL. Failure is a
fatal error. fatal error.
.. versionadded:: 2.3
.. cfunction:: void PyGILState_Release(PyGILState_STATE) .. cfunction:: void PyGILState_Release(PyGILState_STATE)
...@@ -771,8 +757,6 @@ created. ...@@ -771,8 +757,6 @@ created.
Every call to :cfunc:`PyGILState_Ensure` must be matched by a call to Every call to :cfunc:`PyGILState_Ensure` must be matched by a call to
:cfunc:`PyGILState_Release` on the same thread. :cfunc:`PyGILState_Release` on the same thread.
.. versionadded:: 2.3
.. _profiling: .. _profiling:
...@@ -908,29 +892,21 @@ These functions are only intended to be used by advanced debugging tools. ...@@ -908,29 +892,21 @@ These functions are only intended to be used by advanced debugging tools.
Return the interpreter state object at the head of the list of all such objects. Return the interpreter state object at the head of the list of all such objects.
.. versionadded:: 2.2
.. cfunction:: PyInterpreterState* PyInterpreterState_Next(PyInterpreterState *interp) .. cfunction:: PyInterpreterState* PyInterpreterState_Next(PyInterpreterState *interp)
Return the next interpreter state object after *interp* from the list of all Return the next interpreter state object after *interp* from the list of all
such objects. such objects.
.. versionadded:: 2.2
.. cfunction:: PyThreadState * PyInterpreterState_ThreadHead(PyInterpreterState *interp) .. cfunction:: PyThreadState * PyInterpreterState_ThreadHead(PyInterpreterState *interp)
Return the a pointer to the first :ctype:`PyThreadState` object in the list of Return the a pointer to the first :ctype:`PyThreadState` object in the list of
threads associated with the interpreter *interp*. threads associated with the interpreter *interp*.
.. versionadded:: 2.2
.. cfunction:: PyThreadState* PyThreadState_Next(PyThreadState *tstate) .. cfunction:: PyThreadState* PyThreadState_Next(PyThreadState *tstate)
Return the next thread state object after *tstate* from the list of all such Return the next thread state object after *tstate* from the list of all such
objects belonging to the same :ctype:`PyInterpreterState` object. objects belonging to the same :ctype:`PyInterpreterState` object.
.. versionadded:: 2.2
...@@ -67,49 +67,41 @@ Allocating Objects on the Heap ...@@ -67,49 +67,41 @@ Allocating Objects on the Heap
.. cfunction:: PyObject* Py_InitModule(char *name, PyMethodDef *methods) .. cfunction:: PyObject* Py_InitModule(char *name, PyMethodDef *methods)
Create a new module object based on a name and table of functions, returning the Create a new module object based on a name and table of functions, returning
new module object. the new module object; the *methods* argument can be *NULL* if no methods are
to be defined for the module.
.. versionchanged:: 2.3
Older versions of Python did not support *NULL* as the value for the *methods*
argument.
.. cfunction:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc) .. cfunction:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc)
Create a new module object based on a name and table of functions, returning the Create a new module object based on a name and table of functions, returning
new module object. If *doc* is non-*NULL*, it will be used to define the the new module object. The *methods* argument can be *NULL* if no methods
docstring for the module. are to be defined for the module. If *doc* is non-*NULL*, it will be used to
define the docstring for the module.
.. versionchanged:: 2.3
Older versions of Python did not support *NULL* as the value for the *methods*
argument.
.. cfunction:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver) .. cfunction:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver)
Create a new module object based on a name and table of functions, returning the Create a new module object based on a name and table of functions, returning
new module object. If *doc* is non-*NULL*, it will be used to define the the new module object. The *methods* argument can be *NULL* if no methods
docstring for the module. If *self* is non-*NULL*, it will passed to the are to be defined for the module. If *doc* is non-*NULL*, it will be used to
functions of the module as their (otherwise *NULL*) first parameter. (This was define the docstring for the module. If *self* is non-*NULL*, it will passed
added as an experimental feature, and there are no known uses in the current to the functions of the module as their (otherwise *NULL*) first parameter.
version of Python.) For *apiver*, the only value which should be passed is (This was added as an experimental feature, and there are no known uses in
defined by the constant :const:`PYTHON_API_VERSION`. the current version of Python.) For *apiver*, the only value which should be
passed is defined by the constant :const:`PYTHON_API_VERSION`.
.. note:: .. note::
Most uses of this function should probably be using the :cfunc:`Py_InitModule3` Most uses of this function should probably be using the :cfunc:`Py_InitModule3`
instead; only use this if you are sure you need it. instead; only use this if you are sure you need it.
.. versionchanged:: 2.3
Older versions of Python did not support *NULL* as the value for the *methods*
argument.
.. cvar:: PyObject _Py_NoneStruct .. cvar:: PyObject _Py_NoneStruct
Object which is visible in Python as ``None``. This should only be accessed Object which is visible in Python as ``None``. This should only be accessed
using the ``Py_None`` macro, which evaluates to a pointer to this object. using the :cmacro:`Py_None` macro, which evaluates to a pointer to this
object.
.. _common-structs: .. _common-structs:
...@@ -263,6 +255,7 @@ convention flags can be combined with a binding flag. ...@@ -263,6 +255,7 @@ convention flags can be combined with a binding flag.
:ctype:`PyObject\*` parameter representing the single argument. :ctype:`PyObject\*` parameter representing the single argument.
.. XXX deprecated, should be removed
.. data:: METH_OLDARGS .. data:: METH_OLDARGS
This calling convention is deprecated. The method must be of type This calling convention is deprecated. The method must be of type
...@@ -286,8 +279,6 @@ method. ...@@ -286,8 +279,6 @@ method.
instance of the type. This is used to create *class methods*, similar to what instance of the type. This is used to create *class methods*, similar to what
is created when using the :func:`classmethod` built-in function. is created when using the :func:`classmethod` built-in function.
.. versionadded:: 2.3
.. data:: METH_STATIC .. data:: METH_STATIC
...@@ -297,8 +288,6 @@ method. ...@@ -297,8 +288,6 @@ method.
of the type. This is used to create *static methods*, similar to what is of the type. This is used to create *static methods*, similar to what is
created when using the :func:`staticmethod` built-in function. created when using the :func:`staticmethod` built-in function.
.. versionadded:: 2.3
One other constant controls whether a method is loaded in place of another One other constant controls whether a method is loaded in place of another
definition with the same method name. definition with the same method name.
...@@ -314,8 +303,6 @@ definition with the same method name. ...@@ -314,8 +303,6 @@ definition with the same method name.
object and will co-exist with the slot. This is helpful because calls to object and will co-exist with the slot. This is helpful because calls to
PyCFunctions are optimized more than wrapper object calls. PyCFunctions are optimized more than wrapper object calls.
.. versionadded:: 2.4
.. cfunction:: PyObject* Py_FindMethod(PyMethodDef table[], PyObject *ob, char *name) .. cfunction:: PyObject* Py_FindMethod(PyMethodDef table[], PyObject *ob, char *name)
...@@ -1718,8 +1705,6 @@ must name its arguments exactly *visit* and *arg*: ...@@ -1718,8 +1705,6 @@ must name its arguments exactly *visit* and *arg*:
return 0; return 0;
} }
.. versionadded:: 2.4
The :attr:`tp_clear` handler must be of the :ctype:`inquiry` type, or *NULL* if The :attr:`tp_clear` handler must be of the :ctype:`inquiry` type, or *NULL* if
the object is immutable. the object is immutable.
......
...@@ -61,12 +61,11 @@ objects. ...@@ -61,12 +61,11 @@ objects.
It is a good idea to use this macro whenever decrementing the value of a It is a good idea to use this macro whenever decrementing the value of a
variable that might be traversed during garbage collection. variable that might be traversed during garbage collection.
.. versionadded:: 2.4
The following functions are for runtime dynamic embedding of Python: The following functions are for runtime dynamic embedding of Python:
``Py_IncRef(PyObject \*o)``, `Py_DecRef(PyObject \*o)``. They are ``Py_IncRef(PyObject \*o)``, `Py_DecRef(PyObject \*o)``. They are simply
simply exported function versions of :cfunc:`Py_XINCREF` and exported function versions of :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF`,
:cfunc:`Py_XDECREF`, respectively. respectively.
The following functions or macros are only for use within the interpreter core: The following functions or macros are only for use within the interpreter core:
:cfunc:`_Py_Dealloc`, :cfunc:`_Py_ForgetReference`, :cfunc:`_Py_NewReference`, :cfunc:`_Py_Dealloc`, :cfunc:`_Py_ForgetReference`, :cfunc:`_Py_NewReference`,
......
...@@ -121,6 +121,7 @@ Importing Modules ...@@ -121,6 +121,7 @@ Importing Modules
.. index:: .. index::
single: package variable; __all__ single: package variable; __all__
single: __all__ (package variable) single: __all__ (package variable)
single: modules (in module sys)
This is a simplified interface to :cfunc:`PyImport_ImportModuleEx` below, This is a simplified interface to :cfunc:`PyImport_ImportModuleEx` below,
leaving the *globals* and *locals* arguments set to *NULL*. When the *name* leaving the *globals* and *locals* arguments set to *NULL*. When the *name*
...@@ -135,11 +136,6 @@ Importing Modules ...@@ -135,11 +136,6 @@ Importing Modules
to find out. Starting with Python 2.4, a failing import of a module no longer to find out. Starting with Python 2.4, a failing import of a module no longer
leaves the module in ``sys.modules``. leaves the module in ``sys.modules``.
.. versionchanged:: 2.4
failing imports remove incomplete module objects.
.. index:: single: modules (in module sys)
.. cfunction:: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist) .. cfunction:: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
...@@ -155,20 +151,16 @@ Importing Modules ...@@ -155,20 +151,16 @@ Importing Modules
when a submodule of a package was requested is normally the top-level package, when a submodule of a package was requested is normally the top-level package,
unless a non-empty *fromlist* was given. unless a non-empty *fromlist* was given.
.. versionchanged:: 2.4 Failing imports remove incomplete module objects, like with
failing imports remove incomplete module objects. :cfunc:`PyImport_ImportModule`.
.. cfunction:: PyObject* PyImport_Import(PyObject *name) .. cfunction:: PyObject* PyImport_Import(PyObject *name)
.. index::
module: rexec
module: ihooks
This is a higher-level interface that calls the current "import hook function". This is a higher-level interface that calls the current "import hook function".
It invokes the :func:`__import__` function from the ``__builtins__`` of the It invokes the :func:`__import__` function from the ``__builtins__`` of the
current globals. This means that the import is done using whatever import hooks current globals. This means that the import is done using whatever import hooks
are installed in the current environment, e.g. by :mod:`rexec` or :mod:`ihooks`. are installed in the current environment.
.. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m) .. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m)
...@@ -213,9 +205,6 @@ Importing Modules ...@@ -213,9 +205,6 @@ Importing Modules
If *name* points to a dotted name of the form ``package.module``, any package If *name* points to a dotted name of the form ``package.module``, any package
structures not already created will still not be created. structures not already created will still not be created.
.. versionchanged:: 2.4
*name* is removed from ``sys.modules`` in error cases.
.. cfunction:: long PyImport_GetMagicNumber() .. cfunction:: long PyImport_GetMagicNumber()
...@@ -345,25 +334,18 @@ upon unmarshalling. *Py_MARSHAL_VERSION* indicates the current file format ...@@ -345,25 +334,18 @@ upon unmarshalling. *Py_MARSHAL_VERSION* indicates the current file format
Marshal a :ctype:`long` integer, *value*, to *file*. This will only write the Marshal a :ctype:`long` integer, *value*, to *file*. This will only write the
least-significant 32 bits of *value*; regardless of the size of the native least-significant 32 bits of *value*; regardless of the size of the native
:ctype:`long` type. :ctype:`long` type. *version* indicates the file format.
.. versionchanged:: 2.4
*version* indicates the file format.
.. cfunction:: void PyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version) .. cfunction:: void PyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version)
Marshal a Python object, *value*, to *file*. Marshal a Python object, *value*, to *file*.
.. versionchanged:: 2.4
*version* indicates the file format. *version* indicates the file format.
.. cfunction:: PyObject* PyMarshal_WriteObjectToString(PyObject *value, int version) .. cfunction:: PyObject* PyMarshal_WriteObjectToString(PyObject *value, int version)
Return a string object containing the marshalled representation of *value*. Return a string object containing the marshalled representation of *value*.
.. versionchanged:: 2.4
*version* indicates the file format. *version* indicates the file format.
...@@ -557,8 +539,6 @@ variable(s) whose address should be passed. ...@@ -557,8 +539,6 @@ variable(s) whose address should be passed.
Convert a Python integer to a tiny int without overflow checking, stored in a C Convert a Python integer to a tiny int without overflow checking, stored in a C
:ctype:`unsigned char`. :ctype:`unsigned char`.
.. versionadded:: 2.3
``h`` (integer) [short int] ``h`` (integer) [short int]
Convert a Python integer to a C :ctype:`short int`. Convert a Python integer to a C :ctype:`short int`.
...@@ -566,8 +546,6 @@ variable(s) whose address should be passed. ...@@ -566,8 +546,6 @@ variable(s) whose address should be passed.
Convert a Python integer to a C :ctype:`unsigned short int`, without overflow Convert a Python integer to a C :ctype:`unsigned short int`, without overflow
checking. checking.
.. versionadded:: 2.3
``i`` (integer) [int] ``i`` (integer) [int]
Convert a Python integer to a plain C :ctype:`int`. Convert a Python integer to a plain C :ctype:`int`.
...@@ -575,8 +553,6 @@ variable(s) whose address should be passed. ...@@ -575,8 +553,6 @@ variable(s) whose address should be passed.
Convert a Python integer to a C :ctype:`unsigned int`, without overflow Convert a Python integer to a C :ctype:`unsigned int`, without overflow
checking. checking.
.. versionadded:: 2.3
``l`` (integer) [long int] ``l`` (integer) [long int]
Convert a Python integer to a C :ctype:`long int`. Convert a Python integer to a C :ctype:`long int`.
...@@ -584,8 +560,6 @@ variable(s) whose address should be passed. ...@@ -584,8 +560,6 @@ variable(s) whose address should be passed.
Convert a Python integer or long integer to a C :ctype:`unsigned long` without Convert a Python integer or long integer to a C :ctype:`unsigned long` without
overflow checking. overflow checking.
.. versionadded:: 2.3
``L`` (integer) [PY_LONG_LONG] ``L`` (integer) [PY_LONG_LONG]
Convert a Python integer to a C :ctype:`long long`. This format is only Convert a Python integer to a C :ctype:`long long`. This format is only
available on platforms that support :ctype:`long long` (or :ctype:`_int64` on available on platforms that support :ctype:`long long` (or :ctype:`_int64` on
...@@ -596,13 +570,9 @@ variable(s) whose address should be passed. ...@@ -596,13 +570,9 @@ variable(s) whose address should be passed.
without overflow checking. This format is only available on platforms that without overflow checking. This format is only available on platforms that
support :ctype:`unsigned long long` (or :ctype:`unsigned _int64` on Windows). support :ctype:`unsigned long long` (or :ctype:`unsigned _int64` on Windows).
.. versionadded:: 2.3
``n`` (integer) [Py_ssize_t] ``n`` (integer) [Py_ssize_t]
Convert a Python integer or long integer to a C :ctype:`Py_ssize_t`. Convert a Python integer or long integer to a C :ctype:`Py_ssize_t`.
.. versionadded:: 2.5
``c`` (string of length 1) [char] ``c`` (string of length 1) [char]
Convert a Python character, represented as a string of length 1, to a C Convert a Python character, represented as a string of length 1, to a C
:ctype:`char`. :ctype:`char`.
...@@ -677,13 +647,6 @@ variable(s) whose address should be passed. ...@@ -677,13 +647,6 @@ variable(s) whose address should be passed.
in *items*. The C arguments must correspond to the individual format units in in *items*. The C arguments must correspond to the individual format units in
*items*. Format units for sequences may be nested. *items*. Format units for sequences may be nested.
.. note::
Prior to Python version 1.5.2, this format specifier only accepted a tuple
containing the individual parameters, not an arbitrary sequence. Code which
previously caused :exc:`TypeError` to be raised here may now proceed without an
exception. This is not expected to be a problem for existing code.
It is possible to pass Python long integers where integers are requested; It is possible to pass Python long integers where integers are requested;
however no proper range checking is done --- the most significant bits are however no proper range checking is done --- the most significant bits are
silently truncated when the receiving field is too small to receive the value silently truncated when the receiving field is too small to receive the value
...@@ -798,8 +761,6 @@ return true, otherwise they return false and raise an appropriate exception. ...@@ -798,8 +761,6 @@ return true, otherwise they return false and raise an appropriate exception.
PyArg_ParseTuple(args, "O|O:ref", &object, &callback) PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
.. versionadded:: 2.2
.. cfunction:: PyObject* Py_BuildValue(const char *format, ...) .. cfunction:: PyObject* Py_BuildValue(const char *format, ...)
...@@ -898,8 +859,6 @@ return true, otherwise they return false and raise an appropriate exception. ...@@ -898,8 +859,6 @@ return true, otherwise they return false and raise an appropriate exception.
``n`` (int) [Py_ssize_t] ``n`` (int) [Py_ssize_t]
Convert a C :ctype:`Py_ssize_t` to a Python integer or long integer. Convert a C :ctype:`Py_ssize_t` to a Python integer or long integer.
.. versionadded:: 2.5
``c`` (string of length 1) [char] ``c`` (string of length 1) [char]
Convert a C :ctype:`int` representing a character to a Python string of length Convert a C :ctype:`int` representing a character to a Python string of length
1. 1.
...@@ -1010,8 +969,6 @@ The following functions provide locale-independent string to number conversions. ...@@ -1010,8 +969,6 @@ The following functions provide locale-independent string to number conversions.
:cfunc:`PyOS_ascii_strtod` should typically be used for reading configuration :cfunc:`PyOS_ascii_strtod` should typically be used for reading configuration
files or other non-user input that should be locale independent. files or other non-user input that should be locale independent.
.. versionadded:: 2.4
See the Unix man page :manpage:`strtod(2)` for details. See the Unix man page :manpage:`strtod(2)` for details.
...@@ -1025,14 +982,10 @@ The following functions provide locale-independent string to number conversions. ...@@ -1025,14 +982,10 @@ The following functions provide locale-independent string to number conversions.
The return value is a pointer to *buffer* with the converted string or NULL if The return value is a pointer to *buffer* with the converted string or NULL if
the conversion failed. the conversion failed.
.. versionadded:: 2.4
.. cfunction:: double PyOS_ascii_atof(const char *nptr) .. cfunction:: double PyOS_ascii_atof(const char *nptr)
Convert a string to a :ctype:`double` in a locale-independent way. Convert a string to a :ctype:`double` in a locale-independent way.
.. versionadded:: 2.4
See the Unix man page :manpage:`atof(2)` for details. See the Unix man page :manpage:`atof(2)` for details.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment