diff options
author | Georg Brandl <georg@python.org> | 2007-09-01 12:33:24 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-09-01 12:33:24 (GMT) |
commit | 321976b6e74db8f649e47f2b791c4bcc2a71d127 (patch) | |
tree | f3553ef3dd5133f7a285bdd392a85d49c773749d | |
parent | 2326a79de134281b12b3ed04eeabcc8c403df57d (diff) | |
download | cpython-321976b6e74db8f649e47f2b791c4bcc2a71d127.zip cpython-321976b6e74db8f649e47f2b791c4bcc2a71d127.tar.gz cpython-321976b6e74db8f649e47f2b791c4bcc2a71d127.tar.bz2 |
Remove versionadded and versionchanged directives, fold information into text where necessary.
-rw-r--r-- | Doc/c-api/abstract.rst | 46 | ||||
-rw-r--r-- | Doc/c-api/concrete.rst | 272 | ||||
-rw-r--r-- | Doc/c-api/exceptions.rst | 22 | ||||
-rw-r--r-- | Doc/c-api/init.rst | 24 | ||||
-rw-r--r-- | Doc/c-api/newtypes.rst | 51 | ||||
-rw-r--r-- | Doc/c-api/refcounting.rst | 7 | ||||
-rw-r--r-- | Doc/c-api/utilities.rst | 61 |
7 files changed, 41 insertions, 442 deletions
diff --git a/Doc/c-api/abstract.rst b/Doc/c-api/abstract.rst index 1a1ff13..7b5de86 100644 --- a/Doc/c-api/abstract.rst +++ b/Doc/c-api/abstract.rst @@ -170,10 +170,6 @@ Object Protocol of the value of that attribute with *cls* will be used to determine the result 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 wrinkle that implementors of extensions to the class system may want to be aware @@ -196,11 +192,6 @@ is considered sufficient for this determination. ``0``. If either *derived* or *cls* is not an actual class object (or tuple), 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) @@ -217,8 +208,6 @@ is considered sufficient for this determination. success, or *NULL* on failure. This is the equivalent of the Python expression ``callable_object(*args, **kw)``. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args) @@ -257,8 +246,6 @@ is considered sufficient for this determination. of parameters followed by *NULL*. Returns the result of the call on success, or *NULL* on failure. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL) @@ -268,8 +255,6 @@ is considered sufficient for this determination. of parameters followed by *NULL*. Returns the result of the call on success, or *NULL* on failure. - .. versionadded:: 2.2 - .. cfunction:: long PyObject_Hash(PyObject *o) @@ -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 parameters must be non-*NULL*. - .. versionadded:: 2.2 - .. cfunction:: Py_ssize_t PyObject_Length(PyObject *o) Py_ssize_t PyObject_Size(PyObject *o) @@ -408,8 +391,6 @@ Number Protocol Return the floor of *o1* divided by *o2*, or *NULL* on failure. This is equivalent to the "classic" division of integers. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2) @@ -419,8 +400,6 @@ Number Protocol numbers in base two. This function can return a floating point value when passed two integers. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2) @@ -536,8 +515,6 @@ Number Protocol The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 //= o2``. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2) @@ -547,8 +524,6 @@ Number Protocol 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. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2) @@ -633,8 +608,6 @@ Number Protocol Returns the *o* converted to a Python int or long on success or *NULL* with a TypeError exception raised on failure. - .. versionadded:: 2.5 - .. cfunction:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) @@ -646,16 +619,12 @@ Number Protocol 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. - .. versionadded:: 2.5 - .. cfunction:: int PyIndex_Check(PyObject *o) Returns True if *o* is an index integer (has the nb_index slot of the tp_as_number structure filled in). - .. versionadded:: 2.5 - .. _sequence: @@ -801,8 +770,6 @@ Sequence Protocol Return the underlying array of PyObject pointers. Assumes that *o* was returned by :cfunc:`PySequence_Fast` and *o* is not *NULL*. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) @@ -811,8 +778,6 @@ Sequence Protocol :cfunc:`PySequence_Check(o)` is true and without adjustment for negative indices. - .. versionadded:: 2.3 - .. cfunction:: Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o) @@ -906,11 +871,8 @@ Mapping Protocol Iterator Protocol ================= -.. versionadded:: 2.2 - There are only a couple of functions specifically for working with iterators. - .. cfunction:: int PyIter_Check(PyObject *o) Return true if the object *o* supports the iterator protocol. @@ -965,8 +927,6 @@ Buffer Protocol *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:`TypeError` on error. - .. versionadded:: 1.6 - .. cfunction:: int PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len) @@ -975,16 +935,12 @@ Buffer Protocol 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. - .. versionadded:: 1.6 - .. cfunction:: int PyObject_CheckReadBuffer(PyObject *o) Returns ``1`` if *o* supports the single-segment readable buffer interface. Otherwise returns ``0``. - .. versionadded:: 2.2 - .. cfunction:: int PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len) @@ -993,5 +949,3 @@ Buffer Protocol ``0``, sets *buffer* to the memory location and *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:`TypeError` on error. - .. versionadded:: 1.6 - diff --git a/Doc/c-api/concrete.rst b/Doc/c-api/concrete.rst index 0774c7e..8d913ca 100644 --- a/Doc/c-api/concrete.rst +++ b/Doc/c-api/concrete.rst @@ -62,8 +62,6 @@ Type Objects Return true if the object *o* is a type object, but not a subtype of the standard type object. Return false in all other cases. - .. versionadded:: 2.2 - .. cfunction:: int PyType_HasFeature(PyObject *o, int feature) @@ -76,24 +74,20 @@ Type Objects Return true if the type object includes support for the cycle detector; this tests the type flag :const:`Py_TPFLAGS_HAVE_GC`. - .. versionadded:: 2.0 - .. cfunction:: int PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b) Return true if *a* is a subtype of *b*. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) - .. versionadded:: 2.2 + XXX: Document. .. cfunction:: PyObject* PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds) - .. versionadded:: 2.2 + XXX: Document. .. cfunction:: int PyType_Ready(PyTypeObject *type) @@ -103,8 +97,6 @@ Type Objects from a type's base class. Return ``0`` on success, or return ``-1`` and sets an exception on error. - .. versionadded:: 2.2 - .. _noneobject: @@ -128,9 +120,8 @@ same reason. .. cmacro:: Py_RETURN_NONE - Properly handle returning :cdata:`Py_None` from within a C function. - - .. versionadded:: 2.4 + Properly handle returning :cdata:`Py_None` from within a C function (that is, + increment the reference count of None and return it.) .. _numericobjects: @@ -167,17 +158,12 @@ Plain Integer Objects Return true if *o* is of type :cdata:`PyInt_Type` or a subtype of :cdata:`PyInt_Type`. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyInt_CheckExact(PyObject *o) Return true if *o* is of type :cdata:`PyInt_Type`, but not a subtype of :cdata:`PyInt_Type`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyInt_FromString(char *str, char **pend, int base) @@ -212,8 +198,6 @@ Plain Integer Objects Create a new integer object with a value of *ival*. If the value exceeds ``LONG_MAX``, a long integer object is returned. - .. versionadded:: 2.5 - .. cfunction:: long PyInt_AsLong(PyObject *io) @@ -234,8 +218,6 @@ Plain Integer Objects :ctype:`PyLongObject`, if it is not already one, and then return its value as unsigned long. This function does not check for overflow. - .. versionadded:: 2.3 - .. cfunction:: unsigned PY_LONG_LONG PyInt_AsUnsignedLongLongMask(PyObject *io) @@ -243,8 +225,6 @@ Plain Integer Objects :ctype:`PyLongObject`, if it is not already one, and then return its value as unsigned long long, without checking for overflow. - .. versionadded:: 2.3 - .. cfunction:: Py_ssize_t PyInt_AsSsize_t(PyObject *io) @@ -252,8 +232,6 @@ Plain Integer Objects :ctype:`PyLongObject`, if it is not already one, and then return its value as :ctype:`Py_ssize_t`. - .. versionadded:: 2.5 - .. cfunction:: long PyInt_GetMax() @@ -278,8 +256,6 @@ are available, however. Return true if *o* is of type :cdata:`PyBool_Type`. - .. versionadded:: 2.3 - .. cvar:: PyObject* Py_False @@ -298,24 +274,18 @@ are available, however. Return :const:`Py_False` from a function, properly incrementing its reference count. - .. versionadded:: 2.4 - .. cmacro:: Py_RETURN_TRUE Return :const:`Py_True` from a function, properly incrementing its reference count. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyBool_FromLong(long v) Return a new reference to :const:`Py_True` or :const:`Py_False` depending on the truth value of *v*. - .. versionadded:: 2.3 - .. _longobjects: @@ -343,17 +313,12 @@ Long Integer Objects Return true if its argument is a :ctype:`PyLongObject` or a subtype of :ctype:`PyLongObject`. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyLong_CheckExact(PyObject *p) Return true if its argument is a :ctype:`PyLongObject`, but not a subtype of :ctype:`PyLongObject`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyLong_FromLong(long v) @@ -405,18 +370,12 @@ Long Integer Objects radix must be in the range [2, 36]; if it is out of range, :exc:`ValueError` will be raised. - .. versionadded:: 1.6 - .. cfunction:: PyObject* PyLong_FromVoidPtr(void *p) Create a Python integer or long integer from the pointer *p*. The pointer value can be retrieved from the resulting value using :cfunc:`PyLong_AsVoidPtr`. - - .. versionadded:: 1.5.2 - - .. versionchanged:: 2.5 - If the integer is larger than LONG_MAX, a positive long integer is returned. + If the integer is larger than LONG_MAX, a positive long integer is returned. .. cfunction:: long PyLong_AsLong(PyObject *pylong) @@ -445,8 +404,6 @@ Long Integer Objects Return a C :ctype:`long long` from a Python long integer. If *pylong* cannot be represented as a :ctype:`long long`, an :exc:`OverflowError` will be raised. - .. versionadded:: 2.2 - .. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong) @@ -455,24 +412,18 @@ Long Integer Objects will be raised if the value is positive, or a :exc:`TypeError` will be raised if the value is negative. - .. versionadded:: 2.2 - .. cfunction:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io) Return a C :ctype:`unsigned long` from a Python long integer, without checking for overflow. - .. versionadded:: 2.3 - .. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(PyObject *io) Return a C :ctype:`unsigned long long` from a Python long integer, without checking for overflow. - .. versionadded:: 2.3 - .. cfunction:: double PyLong_AsDouble(PyObject *pylong) @@ -488,10 +439,7 @@ Long Integer Objects is only assured to produce a usable :ctype:`void` pointer for values created with :cfunc:`PyLong_FromVoidPtr`. - .. versionadded:: 1.5.2 - - .. versionchanged:: 2.5 - For values outside 0..LONG_MAX, both signed and unsigned integers are acccepted. + For values outside 0..LONG_MAX, both signed and unsigned integers are acccepted. .. _floatobjects: @@ -520,17 +468,12 @@ Floating Point Objects Return true if its argument is a :ctype:`PyFloatObject` or a subtype of :ctype:`PyFloatObject`. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyFloat_CheckExact(PyObject *p) Return true if its argument is a :ctype:`PyFloatObject`, but not a subtype of :ctype:`PyFloatObject`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyFloat_FromString(PyObject *str) @@ -646,17 +589,12 @@ Complex Numbers as Python Objects Return true if its argument is a :ctype:`PyComplexObject` or a subtype of :ctype:`PyComplexObject`. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyComplex_CheckExact(PyObject *p) Return true if its argument is a :ctype:`PyComplexObject`, but not a subtype of :ctype:`PyComplexObject`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyComplex_FromCComplex(Py_complex v) @@ -682,10 +620,9 @@ Complex Numbers as Python Objects Return the :ctype:`Py_complex` value of the complex number *op*. - .. versionchanged:: 2.6 - If *op* is not a Python complex number object but has a :meth:`__complex__` - method, this method will first be called to convert *op* to a Python complex - number object. + If *op* is not a Python complex number object but has a :meth:`__complex__` + method, this method will first be called to convert *op* to a Python complex + number object. .. _sequenceobjects: @@ -729,17 +666,12 @@ called with a non-string parameter. Return true if the object *o* is a string object or an instance of a subtype of the string type. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyString_CheckExact(PyObject *o) Return true if the object *o* is a string object, but not an instance of a subtype of the string type. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyString_FromString(const char *v) @@ -763,9 +695,9 @@ called with a non-string parameter. must correspond exactly to the format characters in the *format* string. The following format characters are allowed: - .. % This should be exactly the same as the table in PyErr_Format. + .. % XXX: This should be exactly the same as the table in PyErr_Format. .. % One should just refer to the other. - .. % The descriptions for %zd and %zu are wrong, but the truth is complicated + .. % XXX: The descriptions for %zd and %zu are wrong, but the truth is complicated .. % because not all compilers support the %z width modifier -- we fake it .. % when necessary via interpolating PY_FORMAT_SIZE_T. .. % %u, %lu, %zu should have "new in Python 2.5" blurbs. @@ -1011,17 +943,12 @@ access internal read-only data of Unicode objects: Return true if the object *o* is a Unicode object or an instance of a Unicode subtype. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyUnicode_CheckExact(PyObject *o) Return true if the object *o* is a Unicode object, but not an instance of a subtype. - .. versionadded:: 2.2 - .. cfunction:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o) @@ -1162,16 +1089,12 @@ APIs: *NULL*, the return value might be a shared object. Therefore, modification of the resulting Unicode object is only allowed when *u* is *NULL*. - .. versionadded:: 3.0 - .. cfunction:: PyObject *PyUnicode_FromString(const char *u) Create a Unicode object from an UTF-8 encoded null-terminated char buffer *u*. - .. versionadded:: 3.0 - .. cfunction:: PyObject* PyUnicode_FromFormat(const char *format, ...) @@ -1247,16 +1170,12 @@ APIs: An unrecognized format character causes all the rest of the format string to be copied as-is to the result string, and any extra arguments discarded. - .. versionadded:: 3.0 - .. cfunction:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs) Identical to :func:`PyUnicode_FromFormat` except that it takes exactly two arguments. - .. versionadded:: 3.0 - .. cfunction:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode) @@ -1390,8 +1309,6 @@ These are the UTF-8 codec APIs: treated as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors) @@ -1434,8 +1351,6 @@ These are the UTF-32 codec APIs: Return *NULL* if an exception was raised by the codec. - .. versionadded:: 2.6 - .. cfunction:: PyObject* PyUnicode_DecodeUTF32Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed) @@ -1445,8 +1360,6 @@ These are the UTF-32 codec APIs: by four) as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*. - .. versionadded:: 2.6 - .. cfunction:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder) @@ -1466,8 +1379,6 @@ These are the UTF-32 codec APIs: Return *NULL* if an exception was raised by the codec. - .. versionadded:: 2.6 - .. cfunction:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode) @@ -1475,8 +1386,6 @@ These are the UTF-32 codec APIs: string always starts with a BOM mark. Error handling is "strict". Return *NULL* if an exception was raised by the codec. - .. versionadded:: 2.6 - These are the UTF-16 codec APIs: @@ -1514,8 +1423,6 @@ These are the UTF-16 codec APIs: split surrogate pair) as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder) @@ -1674,9 +1581,6 @@ characters to different code points. Byte values greater that the length of the string and U+FFFE "characters" are treated as "undefined mapping". - .. versionchanged:: 2.4 - Allowed unicode string as mapping argument. - .. cfunction:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *mapping, const char *errors) @@ -1728,8 +1632,6 @@ the user settings on the machine running the codec. trailing lead byte and the number of bytes that have been decoded will be stored in *consumed*. - .. versionadded:: 2.5 - .. cfunction:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors) @@ -2032,17 +1934,12 @@ Tuple Objects Return true if *p* is a tuple object or an instance of a subtype of the tuple type. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyTuple_CheckExact(PyObject *p) Return true if *p* is a tuple object, but not an instance of a subtype of the tuple type. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyTuple_New(Py_ssize_t len) @@ -2055,8 +1952,6 @@ Tuple Objects are initialized to the subsequent *n* C arguments pointing to Python objects. ``PyTuple_Pack(2, a, b)`` is equivalent to ``Py_BuildValue("(OO)", a, b)``. - .. versionadded:: 2.4 - .. cfunction:: int PyTuple_Size(PyObject *p) @@ -2119,9 +2014,6 @@ Tuple Objects ``*p`` is destroyed. On failure, returns ``-1`` and sets ``*p`` to *NULL*, and raises :exc:`MemoryError` or :exc:`SystemError`. - .. versionchanged:: 2.2 - Removed unused third parameter, *last_is_sticky*. - .. _listobjects: @@ -2149,17 +2041,12 @@ List Objects Return true if *p* is a list object or an instance of a subtype of the list type. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyList_CheckExact(PyObject *p) Return true if *p* is a list object, but not an instance of a subtype of the list type. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyList_New(Py_ssize_t len) @@ -2306,17 +2193,12 @@ Dictionary Objects Return true if *p* is a dict object or an instance of a subtype of the dict type. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyDict_CheckExact(PyObject *p) Return true if *p* is a dict object, but not an instance of a subtype of the dict type. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyDict_New() @@ -2329,8 +2211,6 @@ Dictionary Objects normally used to create a proxy to prevent modification of the dictionary for non-dynamic class types. - .. versionadded:: 2.2 - .. cfunction:: void PyDict_Clear(PyObject *p) @@ -2343,15 +2223,11 @@ Dictionary Objects return ``1``, otherwise return ``0``. On error, return ``-1``. This is equivalent to the Python expression ``key in p``. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyDict_Copy(PyObject *p) Return a new dictionary that contains the same key-value pairs as *p*. - .. versionadded:: 1.6 - .. cfunction:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val) @@ -2471,16 +2347,12 @@ Dictionary Objects if there is not a matching key in *a*. Return ``0`` on success or ``-1`` if an exception was raised. - .. versionadded:: 2.2 - .. cfunction:: int PyDict_Update(PyObject *a, PyObject *b) This is the same as ``PyDict_Merge(a, b, 1)`` in C, or ``a.update(b)`` in Python. Return ``0`` on success or ``-1`` if an exception was raised. - .. versionadded:: 2.2 - .. cfunction:: int PyDict_MergeFromSeq2(PyObject *a, PyObject *seq2, int override) @@ -2495,8 +2367,6 @@ Dictionary Objects if override or key not in a: a[key] = value - .. versionadded:: 2.2 - .. _otherobjects: @@ -2533,17 +2403,12 @@ change in future releases of Python. Return true if its argument is a :ctype:`PyFileObject` or a subtype of :ctype:`PyFileObject`. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyFile_CheckExact(PyObject *p) Return true if its argument is a :ctype:`PyFileObject`, but not a subtype of :ctype:`PyFileObject`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyFile_FromString(char *filename, char *mode) @@ -2598,8 +2463,6 @@ change in future releases of Python. Set the file's encoding for Unicode output to *enc*. Return 1 on success and 0 on failure. - .. versionadded:: 2.3 - .. cfunction:: int PyFile_SoftSpace(PyObject *p, int newflag) @@ -2801,17 +2664,12 @@ There are only a few functions special to module objects. Return true if *p* is a module object, or a subtype of a module object. - .. versionchanged:: 2.2 - Allowed subtypes to be accepted. - .. cfunction:: int PyModule_CheckExact(PyObject *p) Return true if *p* is a module object, but not a subtype of :cdata:`PyModule_Type`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyModule_New(const char *name) @@ -2863,8 +2721,6 @@ There are only a few functions special to module objects. be used from the module's initialization function. This steals a reference to *value*. Return ``-1`` on error, ``0`` on success. - .. versionadded:: 2.0 - .. cfunction:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value) @@ -2872,8 +2728,6 @@ There are only a few functions special to module objects. used from the module's initialization function. Return ``-1`` on error, ``0`` on success. - .. versionadded:: 2.0 - .. cfunction:: int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value) @@ -2881,8 +2735,6 @@ There are only a few functions special to module objects. used from the module's initialization function. The string *value* must be null-terminated. Return ``-1`` on error, ``0`` on success. - .. versionadded:: 2.0 - .. _iterator-objects: @@ -2902,15 +2754,11 @@ sentinel value is returned. one-argument form of the :func:`iter` built-in function for built-in sequence types. - .. versionadded:: 2.2 - .. cfunction:: int PySeqIter_Check(op) Return true if the type of *op* is :cdata:`PySeqIter_Type`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PySeqIter_New(PyObject *seq) @@ -2918,23 +2766,17 @@ sentinel value is returned. iteration ends when the sequence raises :exc:`IndexError` for the subscripting operation. - .. versionadded:: 2.2 - .. cvar:: PyTypeObject PyCallIter_Type Type object for iterator objects returned by :cfunc:`PyCallIter_New` and the two-argument form of the :func:`iter` built-in function. - .. versionadded:: 2.2 - .. cfunction:: int PyCallIter_Check(op) Return true if the type of *op* is :cdata:`PyCallIter_Type`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyCallIter_New(PyObject *callable, PyObject *sentinel) @@ -2943,8 +2785,6 @@ sentinel value is returned. return the next item in the iteration. When *callable* returns a value equal to *sentinel*, the iteration will be terminated. - .. versionadded:: 2.2 - .. _descriptor-objects: @@ -2954,38 +2794,27 @@ Descriptor Objects "Descriptors" are objects that describe some attribute of an object. They are found in the dictionary of type objects. +.. XXX document these! .. cvar:: PyTypeObject PyProperty_Type The type object for the built-in descriptor types. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyDescr_NewGetSet(PyTypeObject *type, struct PyGetSetDef *getset) - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth) - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth) - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped) - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method) - .. versionadded:: 2.3 - .. cfunction:: int PyDescr_IsData(PyObject *descr) @@ -2993,13 +2822,9 @@ found in the dictionary of type objects. false if it describes a method. *descr* must be a descriptor object; there is no error checking. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyWrapper_New(PyObject *, PyObject *) - .. versionadded:: 2.2 - .. _slice-objects: @@ -3054,8 +2879,6 @@ Slice Objects Returns 0 on success and -1 on error with exception set. - .. versionadded:: 2.3 - .. _weakrefobjects: @@ -3072,22 +2895,16 @@ as much as it can. Return true if *ob* is either a reference or proxy object. - .. versionadded:: 2.2 - .. cfunction:: int PyWeakref_CheckRef(ob) Return true if *ob* is a reference object. - .. versionadded:: 2.2 - .. cfunction:: int PyWeakref_CheckProxy(ob) Return true if *ob* is a proxy object. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyWeakref_NewRef(PyObject *ob, PyObject *callback) @@ -3100,8 +2917,6 @@ as much as it can. weakly-referencable object, or if *callback* is not callable, ``None``, or *NULL*, this will return *NULL* and raise :exc:`TypeError`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyWeakref_NewProxy(PyObject *ob, PyObject *callback) @@ -3114,24 +2929,18 @@ as much as it can. is not a weakly-referencable object, or if *callback* is not callable, ``None``, or *NULL*, this will return *NULL* and raise :exc:`TypeError`. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyWeakref_GetObject(PyObject *ref) Return the referenced object from a weak reference, *ref*. If the referent is no longer live, returns ``None``. - .. versionadded:: 2.2 - .. cfunction:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref) Similar to :cfunc:`PyWeakref_GetObject`, but implemented as a macro that does no error checking. - .. versionadded:: 2.2 - .. _cobjects: @@ -3305,111 +3114,84 @@ used by the following macros. Type-check macros: - .. cfunction:: int PyDate_Check(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_DateType` or a subtype of :cdata:`PyDateTime_DateType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyDate_CheckExact(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_DateType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_Check(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_DateTimeType` or a subtype of :cdata:`PyDateTime_DateTimeType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_CheckExact(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_DateTimeType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyTime_Check(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_TimeType` or a subtype of :cdata:`PyDateTime_TimeType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyTime_CheckExact(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_TimeType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyDelta_Check(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_DeltaType` or a subtype of :cdata:`PyDateTime_DeltaType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyDelta_CheckExact(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_DeltaType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyTZInfo_Check(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_TZInfoType` or a subtype of :cdata:`PyDateTime_TZInfoType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 - .. cfunction:: int PyTZInfo_CheckExact(PyObject *ob) Return true if *ob* is of type :cdata:`PyDateTime_TZInfoType`. *ob* must not be *NULL*. - .. versionadded:: 2.4 Macros to create objects: - .. cfunction:: PyObject* PyDate_FromDate(int year, int month, int day) Return a ``datetime.date`` object with the specified year, month and day. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyDateTime_FromDateAndTime(int year, int month, int day, int hour, int minute, int second, int usecond) Return a ``datetime.datetime`` object with the specified year, month, day, hour, minute, second and microsecond. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond) Return a ``datetime.time`` object with the specified hour, minute, second and microsecond. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds) @@ -3418,116 +3200,88 @@ Macros to create objects: number of microseconds and seconds lie in the ranges documented for ``datetime.timedelta`` objects. - .. versionadded:: 2.4 Macros to extract fields from date objects. The argument must be an instance of :cdata:`PyDateTime_Date`, including subclasses (such as :cdata:`PyDateTime_DateTime`). The argument must not be *NULL*, and the type is not checked: - .. cfunction:: int PyDateTime_GET_YEAR(PyDateTime_Date *o) Return the year, as a positive int. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_GET_MONTH(PyDateTime_Date *o) Return the month, as an int from 1 through 12. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_GET_DAY(PyDateTime_Date *o) Return the day, as an int from 1 through 31. - .. versionadded:: 2.4 Macros to extract fields from datetime objects. The argument must be an instance of :cdata:`PyDateTime_DateTime`, including subclasses. The argument must not be *NULL*, and the type is not checked: - .. cfunction:: int PyDateTime_DATE_GET_HOUR(PyDateTime_DateTime *o) Return the hour, as an int from 0 through 23. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_DATE_GET_MINUTE(PyDateTime_DateTime *o) Return the minute, as an int from 0 through 59. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_DATE_GET_SECOND(PyDateTime_DateTime *o) Return the second, as an int from 0 through 59. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_DATE_GET_MICROSECOND(PyDateTime_DateTime *o) Return the microsecond, as an int from 0 through 999999. - .. versionadded:: 2.4 Macros to extract fields from time objects. The argument must be an instance of :cdata:`PyDateTime_Time`, including subclasses. The argument must not be *NULL*, and the type is not checked: - .. cfunction:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o) Return the hour, as an int from 0 through 23. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_TIME_GET_MINUTE(PyDateTime_Time *o) Return the minute, as an int from 0 through 59. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_TIME_GET_SECOND(PyDateTime_Time *o) Return the second, as an int from 0 through 59. - .. versionadded:: 2.4 - .. cfunction:: int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o) Return the microsecond, as an int from 0 through 999999. - .. versionadded:: 2.4 Macros for the convenience of modules implementing the DB API: - .. cfunction:: PyObject* PyDateTime_FromTimestamp(PyObject *args) Create and return a new ``datetime.datetime`` object given an argument tuple suitable for passing to ``datetime.datetime.fromtimestamp()``. - .. versionadded:: 2.4 - .. cfunction:: PyObject* PyDate_FromTimestamp(PyObject *args) Create and return a new ``datetime.date`` object given an argument tuple suitable for passing to ``datetime.date.fromtimestamp()``. - .. versionadded:: 2.4 - .. _setobjects: @@ -3541,8 +3295,6 @@ Set Objects object: set object: frozenset -.. versionadded:: 2.5 - This section details the public API for :class:`set` and :class:`frozenset` objects. Any functionality not listed below is best accessed using the either the abstract object protocol (including :cfunc:`PyObject_CallMethod`, diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 68ac090..2148463 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -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 specifying the exception type to be raised. Availability: Windows. - .. versionadded:: 2.3 - .. 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. Similar to :cfunc:`PyErr_SetFromWindowsErrWithFilename`, with an additional parameter specifying the exception type to be raised. Availability: Windows. - .. versionadded:: 2.3 - .. cfunction:: void PyErr_BadInternalCall() @@ -399,7 +395,7 @@ the variables: +------------------------------------+----------------------------+----------+ | C Name | Python Name | Notes | +====================================+============================+==========+ -| :cdata:`PyExc_BaseException` | :exc:`BaseException` | (1), (4) | +| :cdata:`PyExc_BaseException` | :exc:`BaseException` | \(1) | +------------------------------------+----------------------------+----------+ | :cdata:`PyExc_Exception` | :exc:`Exception` | \(1) | +------------------------------------+----------------------------+----------+ @@ -497,19 +493,3 @@ Notes: (3) Only defined on Windows; protect code that uses this by testing that the 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. - diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 2509e0b..0058e10 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -42,8 +42,6 @@ Initialization, Finalization, and Threads *initsigs* is 0, it skips initialization registration of signal handlers, which might be useful when Python is embedded. - .. versionadded:: 2.4 - .. cfunction:: int Py_IsInitialized() @@ -290,8 +288,6 @@ Initialization, Finalization, and Threads 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. - .. versionadded:: 2.5 - .. cfunction:: const char* Py_GetPlatform() @@ -570,8 +566,6 @@ supports the creation of additional interpreters (using avoid calls to the locking API when running single-threaded. This function is not available when thread support is disabled at compile time. - .. versionadded:: 2.4 - .. cfunction:: void PyEval_AcquireLock() @@ -719,10 +713,6 @@ created. is available. If this function returns *NULL*, no exception has been raised and 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) @@ -734,8 +724,6 @@ created. 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. - .. versionadded:: 2.3 - .. cfunction:: PyGILState_STATE PyGILState_Ensure() @@ -758,8 +746,6 @@ created. When the function returns, the current thread will hold the GIL. Failure is a fatal error. - .. versionadded:: 2.3 - .. cfunction:: void PyGILState_Release(PyGILState_STATE) @@ -771,8 +757,6 @@ created. Every call to :cfunc:`PyGILState_Ensure` must be matched by a call to :cfunc:`PyGILState_Release` on the same thread. - .. versionadded:: 2.3 - .. _profiling: @@ -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. - .. versionadded:: 2.2 - .. cfunction:: PyInterpreterState* PyInterpreterState_Next(PyInterpreterState *interp) Return the next interpreter state object after *interp* from the list of all such objects. - .. versionadded:: 2.2 - .. cfunction:: PyThreadState * PyInterpreterState_ThreadHead(PyInterpreterState *interp) Return the a pointer to the first :ctype:`PyThreadState` object in the list of threads associated with the interpreter *interp*. - .. versionadded:: 2.2 - .. cfunction:: PyThreadState* PyThreadState_Next(PyThreadState *tstate) Return the next thread state object after *tstate* from the list of all such objects belonging to the same :ctype:`PyInterpreterState` object. - .. versionadded:: 2.2 - diff --git a/Doc/c-api/newtypes.rst b/Doc/c-api/newtypes.rst index 09091e1..f8386b6 100644 --- a/Doc/c-api/newtypes.rst +++ b/Doc/c-api/newtypes.rst @@ -67,49 +67,41 @@ Allocating Objects on the Heap .. cfunction:: PyObject* Py_InitModule(char *name, PyMethodDef *methods) - Create a new module object based on a name and table of functions, returning the - new module object. - - .. versionchanged:: 2.3 - Older versions of Python did not support *NULL* as the value for the *methods* - argument. + Create a new module object based on a name and table of functions, returning + the new module object; the *methods* argument can be *NULL* if no methods are + to be defined for the module. .. 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 - new module object. 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. + Create a new module object based on a name and table of functions, returning + the new module object. The *methods* argument can be *NULL* if no methods + are to be defined for the module. If *doc* is non-*NULL*, it will be used to + define the docstring for the module. .. 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 - new module object. If *doc* is non-*NULL*, it will be used to define the - docstring for the module. If *self* is non-*NULL*, it will passed to the - functions of the module as their (otherwise *NULL*) first parameter. (This was - added as an experimental feature, and there are no known uses in the current - version of Python.) For *apiver*, the only value which should be passed is - defined by the constant :const:`PYTHON_API_VERSION`. + Create a new module object based on a name and table of functions, returning + the new module object. The *methods* argument can be *NULL* if no methods + are to be defined for the module. If *doc* is non-*NULL*, it will be used to + define the docstring for the module. If *self* is non-*NULL*, it will passed + to the functions of the module as their (otherwise *NULL*) first parameter. + (This was added as an experimental feature, and there are no known uses in + the current version of Python.) For *apiver*, the only value which should be + passed is defined by the constant :const:`PYTHON_API_VERSION`. .. note:: Most uses of this function should probably be using the :cfunc:`Py_InitModule3` 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 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: @@ -263,6 +255,7 @@ convention flags can be combined with a binding flag. :ctype:`PyObject\*` parameter representing the single argument. +.. XXX deprecated, should be removed .. data:: METH_OLDARGS This calling convention is deprecated. The method must be of type @@ -286,8 +279,6 @@ method. instance of the type. This is used to create *class methods*, similar to what is created when using the :func:`classmethod` built-in function. - .. versionadded:: 2.3 - .. data:: METH_STATIC @@ -297,8 +288,6 @@ method. of the type. This is used to create *static methods*, similar to what is 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 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 PyCFunctions are optimized more than wrapper object calls. - .. versionadded:: 2.4 - .. cfunction:: PyObject* Py_FindMethod(PyMethodDef table[], PyObject *ob, char *name) @@ -1718,8 +1705,6 @@ must name its arguments exactly *visit* and *arg*: return 0; } - .. versionadded:: 2.4 - The :attr:`tp_clear` handler must be of the :ctype:`inquiry` type, or *NULL* if the object is immutable. diff --git a/Doc/c-api/refcounting.rst b/Doc/c-api/refcounting.rst index 9dc357f..e75ff73 100644 --- a/Doc/c-api/refcounting.rst +++ b/Doc/c-api/refcounting.rst @@ -61,12 +61,11 @@ objects. It is a good idea to use this macro whenever decrementing the value of a variable that might be traversed during garbage collection. - .. versionadded:: 2.4 The following functions are for runtime dynamic embedding of Python: -``Py_IncRef(PyObject \*o)``, `Py_DecRef(PyObject \*o)``. They are -simply exported function versions of :cfunc:`Py_XINCREF` and -:cfunc:`Py_XDECREF`, respectively. +``Py_IncRef(PyObject \*o)``, `Py_DecRef(PyObject \*o)``. They are simply +exported function versions of :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF`, +respectively. The following functions or macros are only for use within the interpreter core: :cfunc:`_Py_Dealloc`, :cfunc:`_Py_ForgetReference`, :cfunc:`_Py_NewReference`, diff --git a/Doc/c-api/utilities.rst b/Doc/c-api/utilities.rst index 71e9560..35bfe86 100644 --- a/Doc/c-api/utilities.rst +++ b/Doc/c-api/utilities.rst @@ -121,6 +121,7 @@ Importing Modules .. index:: single: package variable; __all__ single: __all__ (package variable) + single: modules (in module sys) This is a simplified interface to :cfunc:`PyImport_ImportModuleEx` below, leaving the *globals* and *locals* arguments set to *NULL*. When the *name* @@ -135,11 +136,6 @@ Importing Modules to find out. Starting with Python 2.4, a failing import of a module no longer 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) @@ -155,20 +151,16 @@ Importing Modules when a submodule of a package was requested is normally the top-level package, unless a non-empty *fromlist* was given. - .. versionchanged:: 2.4 - failing imports remove incomplete module objects. + Failing imports remove incomplete module objects, like with + :cfunc:`PyImport_ImportModule`. .. cfunction:: PyObject* PyImport_Import(PyObject *name) - .. index:: - module: rexec - module: ihooks - This is a higher-level interface that calls the current "import hook function". It invokes the :func:`__import__` function from the ``__builtins__`` of the 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) @@ -213,9 +205,6 @@ Importing Modules If *name* points to a dotted name of the form ``package.module``, any package 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() @@ -345,26 +334,19 @@ upon unmarshalling. *Py_MARSHAL_VERSION* indicates the current file format 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 - :ctype:`long` type. - - .. versionchanged:: 2.4 - *version* indicates the file format. + :ctype:`long` type. *version* indicates the file format. .. cfunction:: void PyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version) 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) Return a string object containing the marshalled representation of *value*. - - .. versionchanged:: 2.4 - *version* indicates the file format. + *version* indicates the file format. The following functions allow marshalled values to be read back in. @@ -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 :ctype:`unsigned char`. - .. versionadded:: 2.3 - ``h`` (integer) [short int] Convert a Python integer to a C :ctype:`short int`. @@ -566,8 +546,6 @@ variable(s) whose address should be passed. Convert a Python integer to a C :ctype:`unsigned short int`, without overflow checking. - .. versionadded:: 2.3 - ``i`` (integer) [int] Convert a Python integer to a plain C :ctype:`int`. @@ -575,8 +553,6 @@ variable(s) whose address should be passed. Convert a Python integer to a C :ctype:`unsigned int`, without overflow checking. - .. versionadded:: 2.3 - ``l`` (integer) [long int] Convert a Python integer to a C :ctype:`long int`. @@ -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 overflow checking. - .. versionadded:: 2.3 - ``L`` (integer) [PY_LONG_LONG] 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 @@ -596,13 +570,9 @@ variable(s) whose address should be passed. without overflow checking. This format is only available on platforms that support :ctype:`unsigned long long` (or :ctype:`unsigned _int64` on Windows). - .. versionadded:: 2.3 - ``n`` (integer) [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] Convert a Python character, represented as a string of length 1, to a C :ctype:`char`. @@ -677,13 +647,6 @@ variable(s) whose address should be passed. in *items*. The C arguments must correspond to the individual format units in *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; 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 @@ -798,8 +761,6 @@ return true, otherwise they return false and raise an appropriate exception. PyArg_ParseTuple(args, "O|O:ref", &object, &callback) - .. versionadded:: 2.2 - .. cfunction:: PyObject* Py_BuildValue(const char *format, ...) @@ -898,8 +859,6 @@ return true, otherwise they return false and raise an appropriate exception. ``n`` (int) [Py_ssize_t] Convert a C :ctype:`Py_ssize_t` to a Python integer or long integer. - .. versionadded:: 2.5 - ``c`` (string of length 1) [char] Convert a C :ctype:`int` representing a character to a Python string of length 1. @@ -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 files or other non-user input that should be locale independent. - .. versionadded:: 2.4 - See the Unix man page :manpage:`strtod(2)` for details. @@ -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 conversion failed. - .. versionadded:: 2.4 - .. cfunction:: double PyOS_ascii_atof(const char *nptr) 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. |