.. cfunction:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
This does everything :cfunc:`PyObject_Init` does, and also initializes the
length information for a variable-size object.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: TYPE* PyObject_New(TYPE, PyTypeObject *type)
fields into the same allocation decreases the number of allocations,
improving the memory management efficiency.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: void PyObject_Del(PyObject *op)
PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *min* and *max*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* Py_BuildValue(const char *format, ...)
Return the number of items in the dictionary. This is equivalent to
``len(p)`` on a dictionary.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
Py_DECREF(o);
}
- .. versionchanged:: 2.5
- This function used an :ctype:`int *` type for *ppos*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyDict_Merge(PyObject *a, PyObject *b, int override)
Analogous to :cfunc:`PyObject_NewVar` but for container objects with the
:const:`Py_TPFLAGS_HAVE_GC` flag set.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: TYPE* PyObject_GC_Resize(TYPE, PyVarObject *op, Py_ssize_t newsize)
Resize an object allocated by :cfunc:`PyObject_NewVar`. Returns the
resized object or *NULL* on failure.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *newsize*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: void PyObject_GC_Track(PyObject *op)
:cfunc:`PySequence_SetItem` or expose the object to Python code before
setting all items to a real object with :cfunc:`PyList_SetItem`.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PyList_Size(PyObject *list)
Return the length of the list object in *list*; this is equivalent to
``len(list)`` on a list object.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int`. This might require changes in
- your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PyList_GET_SIZE(PyObject *list)
Macro form of :cfunc:`PyList_Size` without error checking.
- .. versionchanged:: 2.5
- This macro returned an :ctype:`int`. This might require changes in your
- code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
supported. If *pos* is out of bounds, return *NULL* and set an
:exc:`IndexError` exception.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` for *index*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)
Macro form of :cfunc:`PyList_GetItem` without error checking.
- .. versionchanged:: 2.5
- This macro used an :ctype:`int` for *i*. This might require changes in
- your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item)
This function "steals" a reference to *item* and discards a reference to
an item already in the list at the affected position.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` for *index*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: void PyList_SET_ITEM(PyObject *list, Py_ssize_t i, PyObject *o)
is being replaced; any reference in *list* at position *i* will be
leaked.
- .. versionchanged:: 2.5
- This macro used an :ctype:`int` for *i*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyList_Insert(PyObject *list, Py_ssize_t index, PyObject *item)
``0`` if successful; return ``-1`` and set an exception if unsuccessful.
Analogous to ``list.insert(index, item)``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` for *index*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyList_Append(PyObject *list, PyObject *item)
*low* and *high*. Return *NULL* and set an exception if unsuccessful.
Analogous to ``list[low:high]``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` for *low* and *high*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist)
be *NULL*, indicating the assignment of an empty list (slice deletion).
Return ``0`` on success, ``-1`` on failure.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` for *low* and *high*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyList_Sort(PyObject *list)
string is first encoded to a byte string using :cfunc:`PyUnicode_EncodeDecimal`
and then converted using :cfunc:`PyLong_FromString`.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` for *length*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyLong_FromVoidPtr(void *p)
objects that do not provide mapping protocol, this is equivalent to the Python
expression ``len(o)``.
- .. versionchanged:: 2.5
- These functions returned an :ctype:`int` type. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyMapping_DelItemString(PyObject *o, char *key)
appropriate exception (:exc:`EOFError` or :exc:`TypeError`) and returns
*NULL*.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *len*. This might require
- changes in your code for properly supporting 64-bit systems.
and *buffer_len* to the buffer length. Returns ``-1`` and sets a
:exc:`TypeError` on error.
- .. versionchanged:: 2.5
- This function used an :ctype:`int *` type for *buffer_len*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len)
and *buffer_len* to the buffer length. Returns ``-1`` and sets a
:exc:`TypeError` on error.
- .. versionchanged:: 2.5
- This function used an :ctype:`int *` type for *buffer_len*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyObject_CheckReadBuffer(PyObject *o)
returns ``0``, sets *buffer* to the memory location and *buffer_len* to the
buffer length. Returns ``-1`` and sets a :exc:`TypeError` on error.
- .. versionchanged:: 2.5
- This function used an :ctype:`int *` type for *buffer_len*. This might
- require changes in your code for properly supporting 64-bit systems.
-
and mapping protocols, the sequence length is returned. On error, ``-1`` is
returned. This is the equivalent to the Python expression ``len(o)``.
- .. versionchanged:: 2.5
- These functions returned an :ctype:`int` type. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyObject_GetItem(PyObject *o, PyObject *key)
For objects that do not provide sequence protocol, this is equivalent to the
Python expression ``len(o)``.
- .. versionchanged:: 2.5
- These functions returned an :ctype:`int` type. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PySequence_Concat(PyObject *o1, PyObject *o2)
Return the result of repeating sequence object *o* *count* times, or *NULL* on
failure. This is the equivalent of the Python expression ``o * count``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *count*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PySequence_InPlaceConcat(PyObject *o1, PyObject *o2)
failure. The operation is done *in-place* when *o* supports it. This is the
equivalent of the Python expression ``o *= count``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *count*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PySequence_GetItem(PyObject *o, Py_ssize_t i)
Return the *i*th element of *o*, or *NULL* on failure. This is the equivalent of
the Python expression ``o[i]``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2)
Return the slice of sequence object *o* between *i1* and *i2*, or *NULL* on
failure. This is the equivalent of the Python expression ``o[i1:i2]``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i1* and *i2*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v)
is the equivalent of the Python statement ``o[i] = v``. This function *does
not* steal a reference to *v*.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PySequence_DelItem(PyObject *o, Py_ssize_t i)
Delete the *i*th element of object *o*. Returns ``-1`` on failure. This is the
equivalent of the Python statement ``del o[i]``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v)
Assign the sequence object *v* to the slice in sequence object *o* from *i1* to
*i2*. This is the equivalent of the Python statement ``o[i1:i2] = v``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i1* and *i2*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2)
Delete the slice in sequence object *o* from *i1* to *i2*. Returns ``-1`` on
failure. This is the equivalent of the Python statement ``del o[i1:i2]``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i1* and *i2*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PySequence_Count(PyObject *o, PyObject *value)
of keys for which ``o[key] == value``. On failure, return ``-1``. This is
equivalent to the Python expression ``o.count(value)``.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PySequence_Contains(PyObject *o, PyObject *value)
Return the first index *i* for which ``o[i] == value``. On error, return
``-1``. This is equivalent to the Python expression ``o.index(value)``.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PySequence_List(PyObject *o)
Return the *i*th element of *o*, assuming that *o* was returned by
:cfunc:`PySequence_Fast`, *o* is not *NULL*, and that *i* is within bounds.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject** PySequence_Fast_ITEMS(PyObject *o)
:cfunc:`PySequence_Check(o)` is true and without adjustment for negative
indices.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *i*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o)
``len(anyset)``. Raises a :exc:`PyExc_SystemError` if *anyset* is not a
:class:`set`, :class:`frozenset`, or an instance of a subtype.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int`. This might require changes in
- your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PySet_GET_SIZE(PyObject *anyset)
You probably do not want to use this function.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *length* and an
- :ctype:`int *` type for *start*, *stop*, and *step*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PySlice_GetIndicesEx(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength)
Returns 0 on success and -1 on error with exception set.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *length* and an
- :ctype:`int *` type for *start*, *stop*, *step*, and *slicelength*. This
- might require changes in your code for properly supporting 64-bit
- systems.
Return a new tuple object of size *len*, or *NULL* on failure.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *len*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyTuple_Pack(Py_ssize_t n, ...)
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)``.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *n*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PyTuple_Size(PyObject *p)
Take a pointer to a tuple object, and return the size of that tuple.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PyTuple_GET_SIZE(PyObject *p)
Return the size of the tuple *p*, which must be non-*NULL* and point to a tuple;
no error checking is performed.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
Return the object at position *pos* in the tuple pointed to by *p*. If *pos* is
out of bounds, return *NULL* and sets an :exc:`IndexError` exception.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *pos*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos)
Like :cfunc:`PyTuple_GetItem`, but does no checking of its arguments.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *pos*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyTuple_GetSlice(PyObject *p, Py_ssize_t low, Py_ssize_t high)
Take a slice of the tuple pointed to by *p* from *low* to *high* and return it
as a new tuple.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *low* and *high*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyTuple_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o)
This function "steals" a reference to *o*.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *pos*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: void PyTuple_SET_ITEM(PyObject *p, Py_ssize_t pos, PyObject *o)
This function "steals" a reference to *o*.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *pos*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize)
``*p`` is destroyed. On failure, returns ``-1`` and sets ``*p`` to *NULL*, and
raises :exc:`MemoryError` or :exc:`SystemError`.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *newsize*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyTuple_ClearFreeList(void)
XXX: Document.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *nitems*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
This field is not inherited by subtypes.
- .. versionchanged:: 2.5
- This field used to be an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cmember:: PyTypeObject* PyObject.ob_type
Return the size of the object. *o* has to be a :ctype:`PyUnicodeObject` (not
checked).
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *o)
Return the size of the object's internal buffer in bytes. *o* has to be a
:ctype:`PyUnicodeObject` (not checked).
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o)
Therefore, modification of the resulting Unicode object is only allowed when *u*
is *NULL*.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
.. cfunction:: PyObject* PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
Return the length of the Unicode object.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type. This might require changes
- in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, const char *encoding, const char *errors)
using wcslen.
Return *NULL* on failure.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode, wchar_t *w, Py_ssize_t size)
to make sure that the :ctype:`wchar_t` string is 0-terminated in case this is
required by the application.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type and used an :ctype:`int`
- type for *size*. This might require changes in your code for properly
- supporting 64-bit systems.
-
.. _builtincodecs:
using the Python codec registry. Return *NULL* if an exception was raised by
the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, const char *encoding, const char *errors)
to be used is looked up using the Python codec registry. Return *NULL* if an
exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, const char *encoding, const char *errors)
Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string
*s*. Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
treated as an error. Those bytes will not be decoded and the number of bytes
that have been decoded will be stored in *consumed*.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
return a Python bytes object. Return *NULL* if an exception was raised by
the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsUTF8String(PyObject *unicode)
Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_DecodeUTF16Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed)
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*.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size* and an :ctype:`int *`
- type for *consumed*. This might require changes in your code for
- properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder)
Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode)
Create a Unicode object by decoding *size* bytes of the Unicode-Escape encoded
string *s*. Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size)
return a Python string object. Return *NULL* if an exception was raised by the
codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape
encoded string *s*. Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
and return a Python string object. Return *NULL* if an exception was raised by
the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
Create a Unicode object by decoding *size* bytes of the Latin-1 encoded string
*s*. Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
return a Python bytes object. Return *NULL* if an exception was raised by
the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode)
Create a Unicode object by decoding *size* bytes of the ASCII encoded string
*s*. Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors)
return a Python bytes object. Return *NULL* if an exception was raised by
the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode)
Byte values greater that the length of the string and U+FFFE "characters" are
treated as "undefined mapping".
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *mapping, const char *errors)
*mapping* object and return a Python string object. Return *NULL* if an
exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsCharmapString(PyObject *unicode, PyObject *mapping)
and sequences work well. Unmapped character ordinals (ones which cause a
:exc:`LookupError`) are left untouched and are copied as-is.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
These are the MBCS codec APIs. They are currently only available on Windows and
use the Win32 MBCS converters to implement the conversions. Note that MBCS (or
Create a Unicode object by decoding *size* bytes of the MBCS encoded string *s*.
Return *NULL* if an exception was raised by the codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_DecodeMBCSStateful(const char *s, int size, const char *errors, int *consumed)
a Python bytes object. Return *NULL* if an exception was raised by the
codec.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *size*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode)
separator. At most *maxsplit* splits will be done. If negative, no limit is
set. Separators are not included in the resulting list.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *maxsplit*. This might require
- changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_Splitlines(PyObject *s, int keepend)
(*direction* == -1 means to do a prefix match, *direction* == 1 a suffix match),
0 otherwise. Return ``-1`` if an error occurred.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *start* and *end*. This
- might require changes in your code for properly supporting 64-bit
- systems.
-
.. cfunction:: Py_ssize_t PyUnicode_Find(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction)
``-1`` indicates that no match was found, and ``-2`` indicates that an error
occurred and an exception has been set.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *start* and *end*. This
- might require changes in your code for properly supporting 64-bit
- systems.
-
.. cfunction:: Py_ssize_t PyUnicode_Count(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end)
Return the number of non-overlapping occurrences of *substr* in
``str[start:end]``. Return ``-1`` if an error occurred.
- .. versionchanged:: 2.5
- This function returned an :ctype:`int` type and used an :ctype:`int`
- type for *start* and *end*. This might require changes in your code for
- properly supporting 64-bit systems.
-
.. cfunction:: PyObject* PyUnicode_Replace(PyObject *str, PyObject *substr, PyObject *replstr, Py_ssize_t maxcount)
return the resulting Unicode object. *maxcount* == -1 means replace all
occurrences.
- .. versionchanged:: 2.5
- This function used an :ctype:`int` type for *maxcount*. This might
- require changes in your code for properly supporting 64-bit systems.
-
.. cfunction:: int PyUnicode_Compare(PyObject *left, PyObject *right)
scripts=['scripts/xmlproc_parse', 'scripts/xmlproc_val']
)
-.. versionchanged:: 2.7
- All the scripts will also be added to the ``MANIFEST``
- file if no template is provided. See :ref:`manifest`.
.. _distutils-installing-package-data:
)
-.. versionchanged:: 2.7
- All the files that match ``package_data`` will be added to the ``MANIFEST``
- file if no template is provided. See :ref:`manifest`.
-
-
.. _distutils-additional-files:
Installing Additional Files
files directly in the target directory, an empty string should be given as the
directory.
-.. versionchanged:: 2.7
- All the files that match ``data_files`` will be added to the ``MANIFEST``
- file if no template is provided. See :ref:`manifest`.
-
-
.. _meta-data:
>>> re.split("(?m)^$", "foo\n\nbar\n")
['foo\n\nbar\n']
- .. versionchanged:: 2.7,3.1
+ .. versionchanged:: 3.1
Added the optional flags argument.
character ``'0'``. The backreference ``\g<0>`` substitutes in the entire
substring matched by the RE.
- .. versionchanged:: 2.7,3.1
+ .. versionchanged:: 3.1
Added the optional flags argument.
Perform the same operation as :func:`sub`, but return a tuple ``(new_string,
number_of_subs_made)``.
- .. versionchanged:: 2.7,3.1
+ .. versionchanged:: 3.1
Added the optional flags argument.