Commit 159c22cd authored by Sandro Tosi's avatar Sandro Tosi

update to new C roles and directives

parent 2a63a35c
......@@ -13,7 +13,7 @@ sequence types). When used on object types for which they do not apply, they
will raise a Python exception.
It is not possible to use these functions on objects that are not properly
initialized, such as a list object that has been created by :cfunc:`PyList_New`,
initialized, such as a list object that has been created by :c:func:`PyList_New`,
but whose items have not been set to some non-\ ``NULL`` value yet.
.. toctree::
......
......@@ -6,20 +6,20 @@ Allocating Objects on the Heap
==============================
.. cfunction:: PyObject* _PyObject_New(PyTypeObject *type)
.. c:function:: PyObject* _PyObject_New(PyTypeObject *type)
.. cfunction:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)
.. c:function:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)
.. versionchanged:: 2.5
This function used an :ctype:`int` type for *size*. This might require
This function used an :c:type:`int` type for *size*. This might require
changes in your code for properly supporting 64-bit systems.
.. cfunction:: void _PyObject_Del(PyObject *op)
.. c:function:: void _PyObject_Del(PyObject *op)
.. cfunction:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
.. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
Initialize a newly-allocated object *op* with its type and initial
reference. Returns the initialized object. If *type* indicates that the
......@@ -28,17 +28,17 @@ Allocating Objects on the Heap
affected.
.. cfunction:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
This does everything :cfunc:`PyObject_Init` does, and also initializes the
This does everything :c:func:`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
This function used an :c:type:`int` type for *size*. This might require
changes in your code for properly supporting 64-bit systems.
.. cfunction:: TYPE* PyObject_New(TYPE, PyTypeObject *type)
.. c:function:: TYPE* PyObject_New(TYPE, PyTypeObject *type)
Allocate a new Python object using the C structure type *TYPE* and the
Python type object *type*. Fields not defined by the Python object header
......@@ -47,7 +47,7 @@ Allocating Objects on the Heap
the type object.
.. cfunction:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
.. c:function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
Allocate a new Python object using the C structure type *TYPE* and the
Python type object *type*. Fields not defined by the Python object header
......@@ -59,20 +59,20 @@ Allocating Objects on the Heap
improving the memory management efficiency.
.. versionchanged:: 2.5
This function used an :ctype:`int` type for *size*. This might require
This function used an :c:type:`int` type for *size*. This might require
changes in your code for properly supporting 64-bit systems.
.. cfunction:: void PyObject_Del(PyObject *op)
.. c:function:: void PyObject_Del(PyObject *op)
Releases memory allocated to an object using :cfunc:`PyObject_New` or
:cfunc:`PyObject_NewVar`. This is normally called from the
Releases memory allocated to an object using :c:func:`PyObject_New` or
:c:func:`PyObject_NewVar`. This is normally called from the
:attr:`tp_dealloc` handler specified in the object's type. The fields of
the object should not be accessed after this call as the memory is no
longer a valid Python object.
.. cfunction:: PyObject* Py_InitModule(char *name, PyMethodDef *methods)
.. c:function:: 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.
......@@ -82,7 +82,7 @@ Allocating Objects on the Heap
*methods* argument.
.. cfunction:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc)
.. c:function:: 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
......@@ -93,7 +93,7 @@ Allocating Objects on the Heap
*methods* argument.
.. cfunction:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver)
.. c:function:: 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
......@@ -107,7 +107,7 @@ Allocating Objects on the Heap
.. note::
Most uses of this function should probably be using the
:cfunc:`Py_InitModule3` instead; only use this if you are sure you need
:c:func:`Py_InitModule3` instead; only use this if you are sure you need
it.
.. versionchanged:: 2.3
......@@ -115,7 +115,7 @@ Allocating Objects on the Heap
*methods* argument.
.. cvar:: PyObject _Py_NoneStruct
.. c:var:: 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
......
This diff is collapsed.
......@@ -11,26 +11,26 @@ creation and deletion functions don't apply to booleans. The following macros
are available, however.
.. cfunction:: int PyBool_Check(PyObject *o)
.. c:function:: int PyBool_Check(PyObject *o)
Return true if *o* is of type :cdata:`PyBool_Type`.
Return true if *o* is of type :c:data:`PyBool_Type`.
.. versionadded:: 2.3
.. cvar:: PyObject* Py_False
.. c:var:: PyObject* Py_False
The Python ``False`` object. This object has no methods. It needs to be
treated just like any other object with respect to reference counts.
.. cvar:: PyObject* Py_True
.. c:var:: PyObject* Py_True
The Python ``True`` object. This object has no methods. It needs to be treated
just like any other object with respect to reference counts.
.. cmacro:: Py_RETURN_FALSE
.. c:macro:: Py_RETURN_FALSE
Return :const:`Py_False` from a function, properly incrementing its reference
count.
......@@ -38,7 +38,7 @@ are available, however.
.. versionadded:: 2.4
.. cmacro:: Py_RETURN_TRUE
.. c:macro:: Py_RETURN_TRUE
Return :const:`Py_True` from a function, properly incrementing its reference
count.
......@@ -46,7 +46,7 @@ are available, however.
.. versionadded:: 2.4
.. cfunction:: PyObject* PyBool_FromLong(long v)
.. c:function:: PyObject* PyBool_FromLong(long v)
Return a new reference to :const:`Py_True` or :const:`Py_False` depending on the
truth value of *v*.
......
This diff is collapsed.
......@@ -10,26 +10,26 @@ Byte Array Objects
.. versionadded:: 2.6
.. ctype:: PyByteArrayObject
.. c:type:: PyByteArrayObject
This subtype of :ctype:`PyObject` represents a Python bytearray object.
This subtype of :c:type:`PyObject` represents a Python bytearray object.
.. cvar:: PyTypeObject PyByteArray_Type
.. c:var:: PyTypeObject PyByteArray_Type
This instance of :ctype:`PyTypeObject` represents the Python bytearray type;
This instance of :c:type:`PyTypeObject` represents the Python bytearray type;
it is the same object as ``bytearray`` in the Python layer.
Type check macros
^^^^^^^^^^^^^^^^^
.. cfunction:: int PyByteArray_Check(PyObject *o)
.. c:function:: int PyByteArray_Check(PyObject *o)
Return true if the object *o* is a bytearray object or an instance of a
subtype of the bytearray type.
.. cfunction:: int PyByteArray_CheckExact(PyObject *o)
.. c:function:: int PyByteArray_CheckExact(PyObject *o)
Return true if the object *o* is a bytearray object, but not an instance of a
subtype of the bytearray type.
......@@ -38,7 +38,7 @@ Type check macros
Direct API functions
^^^^^^^^^^^^^^^^^^^^
.. cfunction:: PyObject* PyByteArray_FromObject(PyObject *o)
.. c:function:: PyObject* PyByteArray_FromObject(PyObject *o)
Return a new bytearray object from any object, *o*, that implements the
buffer protocol.
......@@ -46,29 +46,29 @@ Direct API functions
.. XXX expand about the buffer protocol, at least somewhere
.. cfunction:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
.. c:function:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
Create a new bytearray object from *string* and its length, *len*. On
failure, *NULL* is returned.
.. cfunction:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b)
.. c:function:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b)
Concat bytearrays *a* and *b* and return a new bytearray with the result.
.. cfunction:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
.. c:function:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
Return the size of *bytearray* after checking for a *NULL* pointer.
.. cfunction:: char* PyByteArray_AsString(PyObject *bytearray)
.. c:function:: char* PyByteArray_AsString(PyObject *bytearray)
Return the contents of *bytearray* as a char array after checking for a
*NULL* pointer.
.. cfunction:: int PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len)
.. c:function:: int PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len)
Resize the internal buffer of *bytearray* to *len*.
......@@ -77,11 +77,11 @@ Macros
These macros trade safety for speed and they don't check pointers.
.. cfunction:: char* PyByteArray_AS_STRING(PyObject *bytearray)
.. c:function:: char* PyByteArray_AS_STRING(PyObject *bytearray)
Macro version of :cfunc:`PyByteArray_AsString`.
Macro version of :c:func:`PyByteArray_AsString`.
.. cfunction:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)
.. c:function:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)
Macro version of :cfunc:`PyByteArray_Size`.
Macro version of :c:func:`PyByteArray_Size`.
......@@ -10,33 +10,33 @@ Capsules
Refer to :ref:`using-capsules` for more information on using these objects.
.. ctype:: PyCapsule
.. c:type:: PyCapsule
This subtype of :ctype:`PyObject` represents an opaque value, useful for C
extension modules who need to pass an opaque value (as a :ctype:`void\*`
This subtype of :c:type:`PyObject` represents an opaque value, useful for C
extension modules who need to pass an opaque value (as a :c:type:`void\*`
pointer) through Python code to other C code. It is often used to make a C
function pointer defined in one module available to other modules, so the
regular import mechanism can be used to access C APIs defined in dynamically
loaded modules.
.. ctype:: PyCapsule_Destructor
.. c:type:: PyCapsule_Destructor
The type of a destructor callback for a capsule. Defined as::
typedef void (*PyCapsule_Destructor)(PyObject *);
See :cfunc:`PyCapsule_New` for the semantics of PyCapsule_Destructor
See :c:func:`PyCapsule_New` for the semantics of PyCapsule_Destructor
callbacks.
.. cfunction:: int PyCapsule_CheckExact(PyObject *p)
.. c:function:: int PyCapsule_CheckExact(PyObject *p)
Return true if its argument is a :ctype:`PyCapsule`.
Return true if its argument is a :c:type:`PyCapsule`.
.. cfunction:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor)
.. c:function:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor)
Create a :ctype:`PyCapsule` encapsulating the *pointer*. The *pointer*
Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer*
argument may not be *NULL*.
On failure, set an exception and return *NULL*.
......@@ -50,91 +50,91 @@ Refer to :ref:`using-capsules` for more information on using these objects.
If this capsule will be stored as an attribute of a module, the *name* should
be specified as ``modulename.attributename``. This will enable other modules
to import the capsule using :cfunc:`PyCapsule_Import`.
to import the capsule using :c:func:`PyCapsule_Import`.
.. cfunction:: void* PyCapsule_GetPointer(PyObject *capsule, const char *name)
.. c:function:: void* PyCapsule_GetPointer(PyObject *capsule, const char *name)
Retrieve the *pointer* stored in the capsule. On failure, set an exception
and return *NULL*.
The *name* parameter must compare exactly to the name stored in the capsule.
If the name stored in the capsule is *NULL*, the *name* passed in must also
be *NULL*. Python uses the C function :cfunc:`strcmp` to compare capsule
be *NULL*. Python uses the C function :c:func:`strcmp` to compare capsule
names.
.. cfunction:: PyCapsule_Destructor PyCapsule_GetDestructor(PyObject *capsule)
.. c:function:: PyCapsule_Destructor PyCapsule_GetDestructor(PyObject *capsule)
Return the current destructor stored in the capsule. On failure, set an
exception and return *NULL*.
It is legal for a capsule to have a *NULL* destructor. This makes a *NULL*
return code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or
:cfunc:`PyErr_Occurred` to disambiguate.
return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
:c:func:`PyErr_Occurred` to disambiguate.
.. cfunction:: void* PyCapsule_GetContext(PyObject *capsule)
.. c:function:: void* PyCapsule_GetContext(PyObject *capsule)
Return the current context stored in the capsule. On failure, set an
exception and return *NULL*.
It is legal for a capsule to have a *NULL* context. This makes a *NULL*
return code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or
:cfunc:`PyErr_Occurred` to disambiguate.
return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
:c:func:`PyErr_Occurred` to disambiguate.
.. cfunction:: const char* PyCapsule_GetName(PyObject *capsule)
.. c:function:: const char* PyCapsule_GetName(PyObject *capsule)
Return the current name stored in the capsule. On failure, set an exception
and return *NULL*.
It is legal for a capsule to have a *NULL* name. This makes a *NULL* return
code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or
:cfunc:`PyErr_Occurred` to disambiguate.
code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
:c:func:`PyErr_Occurred` to disambiguate.
.. cfunction:: void* PyCapsule_Import(const char *name, int no_block)
.. c:function:: void* PyCapsule_Import(const char *name, int no_block)
Import a pointer to a C object from a capsule attribute in a module. The
*name* parameter should specify the full name to the attribute, as in
``module.attribute``. The *name* stored in the capsule must match this
string exactly. If *no_block* is true, import the module without blocking
(using :cfunc:`PyImport_ImportModuleNoBlock`). If *no_block* is false,
import the module conventionally (using :cfunc:`PyImport_ImportModule`).
(using :c:func:`PyImport_ImportModuleNoBlock`). If *no_block* is false,
import the module conventionally (using :c:func:`PyImport_ImportModule`).
Return the capsule's internal *pointer* on success. On failure, set an
exception and return *NULL*. However, if :cfunc:`PyCapsule_Import` failed to
exception and return *NULL*. However, if :c:func:`PyCapsule_Import` failed to
import the module, and *no_block* was true, no exception is set.
.. cfunction:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
Determines whether or not *capsule* is a valid capsule. A valid capsule is
non-*NULL*, passes :cfunc:`PyCapsule_CheckExact`, has a non-*NULL* pointer
non-*NULL*, passes :c:func:`PyCapsule_CheckExact`, has a non-*NULL* pointer
stored in it, and its internal name matches the *name* parameter. (See
:cfunc:`PyCapsule_GetPointer` for information on how capsule names are
:c:func:`PyCapsule_GetPointer` for information on how capsule names are
compared.)
In other words, if :cfunc:`PyCapsule_IsValid` returns a true value, calls to
any of the accessors (any function starting with :cfunc:`PyCapsule_Get`) are
In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls to
any of the accessors (any function starting with :c:func:`PyCapsule_Get`) are
guaranteed to succeed.
Return a nonzero value if the object is valid and matches the name passed in.
Return 0 otherwise. This function will not fail.
.. cfunction:: int PyCapsule_SetContext(PyObject *capsule, void *context)
.. c:function:: int PyCapsule_SetContext(PyObject *capsule, void *context)
Set the context pointer inside *capsule* to *context*.
Return 0 on success. Return nonzero and set an exception on failure.
.. cfunction:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor)
.. c:function:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor)
Set the destructor inside *capsule* to *destructor*.
Return 0 on success. Return nonzero and set an exception on failure.
.. cfunction:: int PyCapsule_SetName(PyObject *capsule, const char *name)
.. c:function:: int PyCapsule_SetName(PyObject *capsule, const char *name)
Set the name inside *capsule* to *name*. If non-*NULL*, the name must
outlive the capsule. If the previous *name* stored in the capsule was not
......@@ -142,7 +142,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
Return 0 on success. Return nonzero and set an exception on failure.
.. cfunction:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer)
.. c:function:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer)
Set the void pointer inside *capsule* to *pointer*. The pointer may not be
*NULL*.
......
......@@ -15,39 +15,39 @@ generated byte-code; these are not automatically de-referenced when accessed.
Cell objects are not likely to be useful elsewhere.
.. ctype:: PyCellObject
.. c:type:: PyCellObject
The C structure used for cell objects.
.. cvar:: PyTypeObject PyCell_Type
.. c:var:: PyTypeObject PyCell_Type
The type object corresponding to cell objects.
.. cfunction:: int PyCell_Check(ob)
.. c:function:: int PyCell_Check(ob)
Return true if *ob* is a cell object; *ob* must not be *NULL*.
.. cfunction:: PyObject* PyCell_New(PyObject *ob)
.. c:function:: PyObject* PyCell_New(PyObject *ob)
Create and return a new cell object containing the value *ob*. The parameter may
be *NULL*.
.. cfunction:: PyObject* PyCell_Get(PyObject *cell)
.. c:function:: PyObject* PyCell_Get(PyObject *cell)
Return the contents of the cell *cell*.
.. cfunction:: PyObject* PyCell_GET(PyObject *cell)
.. c:function:: PyObject* PyCell_GET(PyObject *cell)
Return the contents of the cell *cell*, but without checking that *cell* is
non-*NULL* and a cell object.
.. cfunction:: int PyCell_Set(PyObject *cell, PyObject *value)
.. c:function:: int PyCell_Set(PyObject *cell, PyObject *value)
Set the contents of the cell object *cell* to *value*. This releases the
reference to any current content of the cell. *value* may be *NULL*. *cell*
......@@ -55,7 +55,7 @@ Cell objects are not likely to be useful elsewhere.
success, ``0`` will be returned.
.. cfunction:: void PyCell_SET(PyObject *cell, PyObject *value)
.. c:function:: void PyCell_SET(PyObject *cell, PyObject *value)
Sets the value of the cell object *cell* to *value*. No reference counts are
adjusted, and no checks are made for safety; *cell* must be non-*NULL* and must
......
......@@ -12,12 +12,12 @@ will go away in Python 3. When creating new types for extension modules, you
will want to work with type objects (section :ref:`typeobjects`).
.. ctype:: PyClassObject
.. c:type:: PyClassObject
The C structure of the objects used to describe built-in classes.
.. cvar:: PyObject* PyClass_Type
.. c:var:: PyObject* PyClass_Type
.. index:: single: ClassType (in module types)
......@@ -25,13 +25,13 @@ will want to work with type objects (section :ref:`typeobjects`).
``types.ClassType`` in the Python layer.
.. cfunction:: int PyClass_Check(PyObject *o)
.. c:function:: int PyClass_Check(PyObject *o)
Return true if the object *o* is a class object, including instances of types
derived from the standard class object. Return false in all other cases.
.. cfunction:: int PyClass_IsSubclass(PyObject *klass, PyObject *base)
.. c:function:: int PyClass_IsSubclass(PyObject *klass, PyObject *base)
Return true if *klass* is a subclass of *base*. Return false in all other cases.
......@@ -41,23 +41,23 @@ will want to work with type objects (section :ref:`typeobjects`).
There are very few functions specific to instance objects.
.. cvar:: PyTypeObject PyInstance_Type
.. c:var:: PyTypeObject PyInstance_Type
Type object for class instances.
.. cfunction:: int PyInstance_Check(PyObject *obj)
.. c:function:: int PyInstance_Check(PyObject *obj)
Return true if *obj* is an instance.
.. cfunction:: PyObject* PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw)
.. c:function:: PyObject* PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw)
Create a new instance of a specific class. The parameters *arg* and *kw* are
used as the positional and keyword parameters to the object's constructor.
.. cfunction:: PyObject* PyInstance_NewRaw(PyObject *class, PyObject *dict)
.. c:function:: PyObject* PyInstance_NewRaw(PyObject *class, PyObject *dict)
Create a new instance of a specific class without calling its constructor.
*class* is the class of new object. The *dict* parameter will be used as the
......
......@@ -13,47 +13,47 @@ CObjects
The CObject API is deprecated as of Python 2.7. Please switch to the new
:ref:`capsules` API.
.. ctype:: PyCObject
.. c:type:: PyCObject
This subtype of :ctype:`PyObject` represents an opaque value, useful for C
extension modules who need to pass an opaque value (as a :ctype:`void\*`
This subtype of :c:type:`PyObject` represents an opaque value, useful for C
extension modules who need to pass an opaque value (as a :c:type:`void\*`
pointer) through Python code to other C code. It is often used to make a C
function pointer defined in one module available to other modules, so the
regular import mechanism can be used to access C APIs defined in dynamically
loaded modules.
.. cfunction:: int PyCObject_Check(PyObject *p)
.. c:function:: int PyCObject_Check(PyObject *p)
Return true if its argument is a :ctype:`PyCObject`.
Return true if its argument is a :c:type:`PyCObject`.
.. cfunction:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))
.. c:function:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))
Create a :ctype:`PyCObject` from the ``void *`` *cobj*. The *destr* function
Create a :c:type:`PyCObject` from the ``void *`` *cobj*. The *destr* function
will be called when the object is reclaimed, unless it is *NULL*.
.. cfunction:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *))
.. c:function:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *))
Create a :ctype:`PyCObject` from the :ctype:`void \*` *cobj*. The *destr*
Create a :c:type:`PyCObject` from the :c:type:`void \*` *cobj*. The *destr*
function will be called when the object is reclaimed. The *desc* argument can
be used to pass extra callback data for the destructor function.
.. cfunction:: void* PyCObject_AsVoidPtr(PyObject* self)
.. c:function:: void* PyCObject_AsVoidPtr(PyObject* self)
Return the object :ctype:`void \*` that the :ctype:`PyCObject` *self* was
Return the object :c:type:`void \*` that the :c:type:`PyCObject` *self* was
created with.
.. cfunction:: void* PyCObject_GetDesc(PyObject* self)
.. c:function:: void* PyCObject_GetDesc(PyObject* self)
Return the description :ctype:`void \*` that the :ctype:`PyCObject` *self* was
Return the description :c:type:`void \*` that the :c:type:`PyCObject` *self* was
created with.
.. cfunction:: int PyCObject_SetVoidPtr(PyObject* self, void* cobj)
.. c:function:: int PyCObject_SetVoidPtr(PyObject* self, void* cobj)
Set the void pointer inside *self* to *cobj*. The :ctype:`PyCObject` must not
Set the void pointer inside *self* to *cobj*. The :c:type:`PyCObject` must not
have an associated destructor. Return true on success, false on failure.
......@@ -15,35 +15,35 @@ Code objects are a low-level detail of the CPython implementation.
Each one represents a chunk of executable code that hasn't yet been
bound into a function.
.. ctype:: PyCodeObject
.. c:type:: PyCodeObject
The C structure of the objects used to describe code objects. The
fields of this type are subject to change at any time.
.. cvar:: PyTypeObject PyCode_Type
.. c:var:: PyTypeObject PyCode_Type
This is an instance of :ctype:`PyTypeObject` representing the Python
This is an instance of :c:type:`PyTypeObject` representing the Python
:class:`code` type.
.. cfunction:: int PyCode_Check(PyObject *co)
.. c:function:: int PyCode_Check(PyObject *co)
Return true if *co* is a :class:`code` object
.. cfunction:: int PyCode_GetNumFree(PyObject *co)
.. c:function:: int PyCode_GetNumFree(PyObject *co)
Return the number of free variables in *co*.
.. cfunction:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
.. c:function:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
Return a new code object. If you need a dummy code object to
create a frame, use :cfunc:`PyCode_NewEmpty` instead. Calling
:cfunc:`PyCode_New` directly can bind you to a precise Python
create a frame, use :c:func:`PyCode_NewEmpty` instead. Calling
:c:func:`PyCode_New` directly can bind you to a precise Python
version since the definition of the bytecode changes often.
.. cfunction:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
.. c:function:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
Return a new empty code object with the specified filename,
function name, and first line number. It is illegal to
......
......@@ -3,19 +3,19 @@
Codec registry and support functions
====================================
.. cfunction:: int PyCodec_Register(PyObject *search_function)
.. c:function:: int PyCodec_Register(PyObject *search_function)
Register a new codec search function.
As side effect, this tries to load the :mod:`encodings` package, if not yet
done, to make sure that it is always first in the list of search functions.
.. cfunction:: int PyCodec_KnownEncoding(const char *encoding)
.. c:function:: int PyCodec_KnownEncoding(const char *encoding)
Return ``1`` or ``0`` depending on whether there is a registered codec for
the given *encoding*.
.. cfunction:: PyObject* PyCodec_Encode(PyObject *object, const char *encoding, const char *errors)
.. c:function:: PyObject* PyCodec_Encode(PyObject *object, const char *encoding, const char *errors)
Generic codec based encoding API.
......@@ -24,7 +24,7 @@ Codec registry and support functions
be *NULL* to use the default method defined for the codec. Raises a
:exc:`LookupError` if no encoder can be found.
.. cfunction:: PyObject* PyCodec_Decode(PyObject *object, const char *encoding, const char *errors)
.. c:function:: PyObject* PyCodec_Decode(PyObject *object, const char *encoding, const char *errors)
Generic codec based decoding API.
......@@ -42,27 +42,27 @@ lower-case characters, which makes encodings looked up through this mechanism
effectively case-insensitive. If no codec is found, a :exc:`KeyError` is set
and *NULL* returned.
.. cfunction:: PyObject* PyCodec_Encoder(const char *encoding)
.. c:function:: PyObject* PyCodec_Encoder(const char *encoding)
Get an encoder function for the given *encoding*.
.. cfunction:: PyObject* PyCodec_Decoder(const char *encoding)
.. c:function:: PyObject* PyCodec_Decoder(const char *encoding)
Get a decoder function for the given *encoding*.
.. cfunction:: PyObject* PyCodec_IncrementalEncoder(const char *encoding, const char *errors)
.. c:function:: PyObject* PyCodec_IncrementalEncoder(const char *encoding, const char *errors)
Get an :class:`IncrementalEncoder` object for the given *encoding*.
.. cfunction:: PyObject* PyCodec_IncrementalDecoder(const char *encoding, const char *errors)
.. c:function:: PyObject* PyCodec_IncrementalDecoder(const char *encoding, const char *errors)
Get an :class:`IncrementalDecoder` object for the given *encoding*.
.. cfunction:: PyObject* PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors)
.. c:function:: PyObject* PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors)
Get a :class:`StreamReader` factory function for the given *encoding*.
.. cfunction:: PyObject* PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors)
.. c:function:: PyObject* PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors)
Get a :class:`StreamWriter` factory function for the given *encoding*.
......@@ -70,7 +70,7 @@ and *NULL* returned.
Registry API for Unicode encoding error handlers
------------------------------------------------
.. cfunction:: int PyCodec_RegisterError(const char *name, PyObject *error)
.. c:function:: int PyCodec_RegisterError(const char *name, PyObject *error)
Register the error handling callback function *error* under the given *name*.
This callback function will be called by a codec when it encounters
......@@ -89,29 +89,29 @@ Registry API for Unicode encoding error handlers
Return ``0`` on success, ``-1`` on error.
.. cfunction:: PyObject* PyCodec_LookupError(const char *name)
.. c:function:: PyObject* PyCodec_LookupError(const char *name)
Lookup the error handling callback function registered under *name*. As a
special case *NULL* can be passed, in which case the error handling callback
for "strict" will be returned.
.. cfunction:: PyObject* PyCodec_StrictErrors(PyObject *exc)
.. c:function:: PyObject* PyCodec_StrictErrors(PyObject *exc)
Raise *exc* as an exception.
.. cfunction:: PyObject* PyCodec_IgnoreErrors(PyObject *exc)
.. c:function:: PyObject* PyCodec_IgnoreErrors(PyObject *exc)
Ignore the unicode error, skipping the faulty input.
.. cfunction:: PyObject* PyCodec_ReplaceErrors(PyObject *exc)
.. c:function:: PyObject* PyCodec_ReplaceErrors(PyObject *exc)
Replace the unicode encode error with ``?`` or ``U+FFFD``.
.. cfunction:: PyObject* PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
.. c:function:: PyObject* PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
Replace the unicode encode error with XML character references.
.. cfunction:: PyObject* PyCodec_BackslashReplaceErrors(PyObject *exc)
.. c:function:: PyObject* PyCodec_BackslashReplaceErrors(PyObject *exc)
Replace the unicode encode error with backslash escapes (``\x``, ``\u`` and
``\U``).
......
......@@ -21,7 +21,7 @@ them as results do so *by value* rather than dereferencing them through
pointers. This is consistent throughout the API.
.. ctype:: Py_complex
.. c:type:: Py_complex
The C structure which corresponds to the value portion of a Python complex
number object. Most of the functions for dealing with complex number objects
......@@ -34,103 +34,103 @@ pointers. This is consistent throughout the API.
} Py_complex;
.. cfunction:: Py_complex _Py_c_sum(Py_complex left, Py_complex right)
.. c:function:: Py_complex _Py_c_sum(Py_complex left, Py_complex right)
Return the sum of two complex numbers, using the C :ctype:`Py_complex`
Return the sum of two complex numbers, using the C :c:type:`Py_complex`
representation.
.. cfunction:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
Return the difference between two complex numbers, using the C
:ctype:`Py_complex` representation.
:c:type:`Py_complex` representation.
.. cfunction:: Py_complex _Py_c_neg(Py_complex complex)
.. c:function:: Py_complex _Py_c_neg(Py_complex complex)
Return the negation of the complex number *complex*, using the C
:ctype:`Py_complex` representation.
:c:type:`Py_complex` representation.
.. cfunction:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
.. c:function:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
Return the product of two complex numbers, using the C :ctype:`Py_complex`
Return the product of two complex numbers, using the C :c:type:`Py_complex`
representation.
.. cfunction:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
Return the quotient of two complex numbers, using the C :ctype:`Py_complex`
Return the quotient of two complex numbers, using the C :c:type:`Py_complex`
representation.
If *divisor* is null, this method returns zero and sets
:cdata:`errno` to :cdata:`EDOM`.
:c:data:`errno` to :c:data:`EDOM`.
.. cfunction:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
Return the exponentiation of *num* by *exp*, using the C :ctype:`Py_complex`
Return the exponentiation of *num* by *exp*, using the C :c:type:`Py_complex`
representation.
If *num* is null and *exp* is not a positive real number,
this method returns zero and sets :cdata:`errno` to :cdata:`EDOM`.
this method returns zero and sets :c:data:`errno` to :c:data:`EDOM`.
Complex Numbers as Python Objects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. ctype:: PyComplexObject
.. c:type:: PyComplexObject
This subtype of :ctype:`PyObject` represents a Python complex number object.
This subtype of :c:type:`PyObject` represents a Python complex number object.
.. cvar:: PyTypeObject PyComplex_Type
.. c:var:: PyTypeObject PyComplex_Type
This instance of :ctype:`PyTypeObject` represents the Python complex number
This instance of :c:type:`PyTypeObject` represents the Python complex number
type. It is the same object as ``complex`` and ``types.ComplexType``.
.. cfunction:: int PyComplex_Check(PyObject *p)
.. c:function:: int PyComplex_Check(PyObject *p)
Return true if its argument is a :ctype:`PyComplexObject` or a subtype of
:ctype:`PyComplexObject`.
Return true if its argument is a :c:type:`PyComplexObject` or a subtype of
:c:type:`PyComplexObject`.
.. versionchanged:: 2.2
Allowed subtypes to be accepted.
.. cfunction:: int PyComplex_CheckExact(PyObject *p)
.. c:function:: int PyComplex_CheckExact(PyObject *p)
Return true if its argument is a :ctype:`PyComplexObject`, but not a subtype of
:ctype:`PyComplexObject`.
Return true if its argument is a :c:type:`PyComplexObject`, but not a subtype of
:c:type:`PyComplexObject`.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyComplex_FromCComplex(Py_complex v)
.. c:function:: PyObject* PyComplex_FromCComplex(Py_complex v)
Create a new Python complex number object from a C :ctype:`Py_complex` value.
Create a new Python complex number object from a C :c:type:`Py_complex` value.
.. cfunction:: PyObject* PyComplex_FromDoubles(double real, double imag)
.. c:function:: PyObject* PyComplex_FromDoubles(double real, double imag)
Return a new :ctype:`PyComplexObject` object from *real* and *imag*.
Return a new :c:type:`PyComplexObject` object from *real* and *imag*.
.. cfunction:: double PyComplex_RealAsDouble(PyObject *op)
.. c:function:: double PyComplex_RealAsDouble(PyObject *op)
Return the real part of *op* as a C :ctype:`double`.
Return the real part of *op* as a C :c:type:`double`.
.. cfunction:: double PyComplex_ImagAsDouble(PyObject *op)
.. c:function:: double PyComplex_ImagAsDouble(PyObject *op)
Return the imaginary part of *op* as a C :ctype:`double`.
Return the imaginary part of *op* as a C :c:type:`double`.
.. cfunction:: Py_complex PyComplex_AsCComplex(PyObject *op)
.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op)
Return the :ctype:`Py_complex` value of the complex number *op*.
Return the :c:type:`Py_complex` value of the complex number *op*.
Upon failure, this method returns ``-1.0`` as a real value.
.. versionchanged:: 2.6
......
......@@ -11,7 +11,7 @@ The functions in this chapter are specific to certain Python object types.
Passing them an object of the wrong type is not a good idea; if you receive an
object from a Python program and you are not sure that it has the right type,
you must perform a type check first; for example, to check that an object is a
dictionary, use :cfunc:`PyDict_Check`. The chapter is structured like the
dictionary, use :c:func:`PyDict_Check`. The chapter is structured like the
"family tree" of Python object types.
.. warning::
......
......@@ -8,20 +8,20 @@ String conversion and formatting
Functions for number conversion and formatted string output.
.. cfunction:: int PyOS_snprintf(char *str, size_t size, const char *format, ...)
.. c:function:: int PyOS_snprintf(char *str, size_t size, const char *format, ...)
Output not more than *size* bytes to *str* according to the format string
*format* and the extra arguments. See the Unix man page :manpage:`snprintf(2)`.
.. cfunction:: int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
.. c:function:: int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
Output not more than *size* bytes to *str* according to the format string
*format* and the variable argument list *va*. Unix man page
:manpage:`vsnprintf(2)`.
:cfunc:`PyOS_snprintf` and :cfunc:`PyOS_vsnprintf` wrap the Standard C library
functions :cfunc:`snprintf` and :cfunc:`vsnprintf`. Their purpose is to
:c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` wrap the Standard C library
functions :c:func:`snprintf` and :c:func:`vsnprintf`. Their purpose is to
guarantee consistent behavior in corner cases, which the Standard C functions do
not.
......@@ -30,7 +30,7 @@ never write more than *size* bytes (including the trailing ``'\0'`` into str.
Both functions require that ``str != NULL``, ``size > 0`` and ``format !=
NULL``.
If the platform doesn't have :cfunc:`vsnprintf` and the buffer size needed to
If the platform doesn't have :c:func:`vsnprintf` and the buffer size needed to
avoid truncation exceeds *size* by more than 512 bytes, Python aborts with a
*Py_FatalError*.
......@@ -51,9 +51,9 @@ The return value (*rv*) for these functions should be interpreted as follows:
The following functions provide locale-independent string to number conversions.
.. cfunction:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception)
.. c:function:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception)
Convert a string ``s`` to a :ctype:`double`, raising a Python
Convert a string ``s`` to a :c:type:`double`, raising a Python
exception on failure. The set of accepted strings corresponds to
the set of strings accepted by Python's :func:`float` constructor,
except that ``s`` must not have leading or trailing whitespace.
......@@ -85,13 +85,13 @@ The following functions provide locale-independent string to number conversions.
.. versionadded:: 2.7
.. cfunction:: double PyOS_ascii_strtod(const char *nptr, char **endptr)
.. c:function:: double PyOS_ascii_strtod(const char *nptr, char **endptr)
Convert a string to a :ctype:`double`. This function behaves like the Standard C
function :cfunc:`strtod` does in the C locale. It does this without changing the
Convert a string to a :c:type:`double`. This function behaves like the Standard C
function :c:func:`strtod` does in the C locale. It does this without changing the
current locale, since that would not be thread-safe.
:cfunc:`PyOS_ascii_strtod` should typically be used for reading configuration
:c:func:`PyOS_ascii_strtod` should typically be used for reading configuration
files or other non-user input that should be locale independent.
See the Unix man page :manpage:`strtod(2)` for details.
......@@ -99,14 +99,14 @@ The following functions provide locale-independent string to number conversions.
.. versionadded:: 2.4
.. deprecated:: 2.7
Use :cfunc:`PyOS_string_to_double` instead.
Use :c:func:`PyOS_string_to_double` instead.
.. cfunction:: char* PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d)
.. c:function:: char* PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d)
Convert a :ctype:`double` to a string using the ``'.'`` as the decimal
separator. *format* is a :cfunc:`printf`\ -style format string specifying the
Convert a :c:type:`double` to a string using the ``'.'`` as the decimal
separator. *format* is a :c:func:`printf`\ -style format string specifying the
number format. Allowed conversion characters are ``'e'``, ``'E'``, ``'f'``,
``'F'``, ``'g'`` and ``'G'``.
......@@ -119,9 +119,9 @@ The following functions provide locale-independent string to number conversions.
instead.
.. cfunction:: char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype)
.. c:function:: char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype)
Convert a :ctype:`double` *val* to a string using supplied
Convert a :c:type:`double` *val* to a string using supplied
*format_code*, *precision*, and *flags*.
*format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``,
......@@ -139,7 +139,7 @@ The following functions provide locale-independent string to number conversions.
like an integer.
* *Py_DTSF_ALT* means to apply "alternate" formatting rules. See the
documentation for the :cfunc:`PyOS_snprintf` ``'#'`` specifier for
documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for
details.
If *ptype* is non-NULL, then the value it points to will be set to one of
......@@ -148,34 +148,34 @@ 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. The caller is responsible for freeing the
returned string by calling :cfunc:`PyMem_Free`.
returned string by calling :c:func:`PyMem_Free`.
.. versionadded:: 2.7
.. cfunction:: double PyOS_ascii_atof(const char *nptr)
.. c:function:: double PyOS_ascii_atof(const char *nptr)
Convert a string to a :ctype:`double` in a locale-independent way.
Convert a string to a :c:type:`double` in a locale-independent way.
See the Unix man page :manpage:`atof(2)` for details.
.. versionadded:: 2.4
.. deprecated:: 3.1
Use :cfunc:`PyOS_string_to_double` instead.
Use :c:func:`PyOS_string_to_double` instead.
.. cfunction:: char* PyOS_stricmp(char *s1, char *s2)
.. c:function:: char* PyOS_stricmp(char *s1, char *s2)
Case insensitive comparison of strings. The function works almost
identically to :cfunc:`strcmp` except that it ignores the case.
identically to :c:func:`strcmp` except that it ignores the case.
.. versionadded:: 2.6
.. cfunction:: char* PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size)
.. c:function:: char* PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size)
Case insensitive comparison of strings. The function works almost
identically to :cfunc:`strncmp` except that it ignores the case.
identically to :c:func:`strncmp` except that it ignores the case.
.. versionadded:: 2.6
......@@ -8,89 +8,89 @@ DateTime Objects
Various date and time objects are supplied by the :mod:`datetime` module.
Before using any of these functions, the header file :file:`datetime.h` must be
included in your source (note that this is not included by :file:`Python.h`),
and the macro :cmacro:`PyDateTime_IMPORT` must be invoked, usually as part of
and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as part of
the module initialisation function. The macro puts a pointer to a C structure
into a static variable, :cdata:`PyDateTimeAPI`, that is used by the following
into a static variable, :c:data:`PyDateTimeAPI`, that is used by the following
macros.
Type-check macros:
.. cfunction:: int PyDate_Check(PyObject *ob)
.. c:function:: 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*.
Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype of
:c:data:`PyDateTime_DateType`. *ob* must not be *NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyDate_CheckExact(PyObject *ob)
.. c:function:: int PyDate_CheckExact(PyObject *ob)
Return true if *ob* is of type :cdata:`PyDateTime_DateType`. *ob* must not be
Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not be
*NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyDateTime_Check(PyObject *ob)
.. c:function:: 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*.
Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a subtype of
:c:data:`PyDateTime_DateTimeType`. *ob* must not be *NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyDateTime_CheckExact(PyObject *ob)
.. c:function:: int PyDateTime_CheckExact(PyObject *ob)
Return true if *ob* is of type :cdata:`PyDateTime_DateTimeType`. *ob* must not
Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must not
be *NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyTime_Check(PyObject *ob)
.. c:function:: 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*.
Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype of
:c:data:`PyDateTime_TimeType`. *ob* must not be *NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyTime_CheckExact(PyObject *ob)
.. c:function:: int PyTime_CheckExact(PyObject *ob)
Return true if *ob* is of type :cdata:`PyDateTime_TimeType`. *ob* must not be
Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not be
*NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyDelta_Check(PyObject *ob)
.. c:function:: 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*.
Return true if *ob* is of type :c:data:`PyDateTime_DeltaType` or a subtype of
:c:data:`PyDateTime_DeltaType`. *ob* must not be *NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyDelta_CheckExact(PyObject *ob)
.. c:function:: int PyDelta_CheckExact(PyObject *ob)
Return true if *ob* is of type :cdata:`PyDateTime_DeltaType`. *ob* must not be
Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not be
*NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyTZInfo_Check(PyObject *ob)
.. c:function:: 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*.
Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype of
:c:data:`PyDateTime_TZInfoType`. *ob* must not be *NULL*.
.. versionadded:: 2.4
.. cfunction:: int PyTZInfo_CheckExact(PyObject *ob)
.. c:function:: int PyTZInfo_CheckExact(PyObject *ob)
Return true if *ob* is of type :cdata:`PyDateTime_TZInfoType`. *ob* must not be
Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must not be
*NULL*.
.. versionadded:: 2.4
......@@ -98,14 +98,14 @@ Type-check macros:
Macros to create objects:
.. cfunction:: PyObject* PyDate_FromDate(int year, int month, int day)
.. c:function:: 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)
.. c:function:: 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.
......@@ -113,7 +113,7 @@ Macros to create objects:
.. versionadded:: 2.4
.. cfunction:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond)
.. c:function:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond)
Return a ``datetime.time`` object with the specified hour, minute, second and
microsecond.
......@@ -121,7 +121,7 @@ Macros to create objects:
.. versionadded:: 2.4
.. cfunction:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds)
.. c:function:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds)
Return a ``datetime.timedelta`` object representing the given number of days,
seconds and microseconds. Normalization is performed so that the resulting
......@@ -131,90 +131,90 @@ Macros to create 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
:c:data:`PyDateTime_Date`, including subclasses (such as
:c:data:`PyDateTime_DateTime`). The argument must not be *NULL*, and the type is
not checked:
.. cfunction:: int PyDateTime_GET_YEAR(PyDateTime_Date *o)
.. c:function:: 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)
.. c:function:: 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)
.. c:function:: 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
instance of :c:data:`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)
.. c:function:: 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)
.. c:function:: 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)
.. c:function:: 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)
.. c:function:: 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*,
:c:data:`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)
.. c:function:: 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)
.. c:function:: 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)
.. c:function:: 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)
.. c:function:: int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o)
Return the microsecond, as an int from 0 through 999999.
......@@ -223,7 +223,7 @@ and the type is not checked:
Macros for the convenience of modules implementing the DB API:
.. cfunction:: PyObject* PyDateTime_FromTimestamp(PyObject *args)
.. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args)
Create and return a new ``datetime.datetime`` object given an argument tuple
suitable for passing to ``datetime.datetime.fromtimestamp()``.
......@@ -231,7 +231,7 @@ Macros for the convenience of modules implementing the DB API:
.. versionadded:: 2.4
.. cfunction:: PyObject* PyDate_FromTimestamp(PyObject *args)
.. c:function:: PyObject* PyDate_FromTimestamp(PyObject *args)
Create and return a new ``datetime.date`` object given an argument tuple
suitable for passing to ``datetime.date.fromtimestamp()``.
......
......@@ -9,39 +9,39 @@ Descriptor Objects
found in the dictionary of type objects.
.. cvar:: PyTypeObject PyProperty_Type
.. c:var:: PyTypeObject PyProperty_Type
The type object for the built-in descriptor types.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyDescr_NewGetSet(PyTypeObject *type, struct PyGetSetDef *getset)
.. c:function:: PyObject* PyDescr_NewGetSet(PyTypeObject *type, struct PyGetSetDef *getset)
.. versionadded:: 2.2
.. cfunction:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth)
.. c:function:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth)
.. versionadded:: 2.2
.. cfunction:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth)
.. c:function:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth)
.. versionadded:: 2.2
.. cfunction:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped)
.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped)
.. versionadded:: 2.2
.. cfunction:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
.. c:function:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
.. versionadded:: 2.3
.. cfunction:: int PyDescr_IsData(PyObject *descr)
.. c:function:: int PyDescr_IsData(PyObject *descr)
Return true if the descriptor objects *descr* describes a data attribute, or
false if it describes a method. *descr* must be a descriptor object; there is
......@@ -50,6 +50,6 @@ found in the dictionary of type objects.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyWrapper_New(PyObject *, PyObject *)
.. c:function:: PyObject* PyWrapper_New(PyObject *, PyObject *)
.. versionadded:: 2.2
......@@ -8,23 +8,23 @@ Dictionary Objects
.. index:: object: dictionary
.. ctype:: PyDictObject
.. c:type:: PyDictObject
This subtype of :ctype:`PyObject` represents a Python dictionary object.
This subtype of :c:type:`PyObject` represents a Python dictionary object.
.. cvar:: PyTypeObject PyDict_Type
.. c:var:: PyTypeObject PyDict_Type
.. index::
single: DictType (in module types)
single: DictionaryType (in module types)
This instance of :ctype:`PyTypeObject` represents the Python dictionary
This instance of :c:type:`PyTypeObject` represents the Python dictionary
type. This is exposed to Python programs as ``dict`` and
``types.DictType``.
.. cfunction:: int PyDict_Check(PyObject *p)
.. c:function:: int PyDict_Check(PyObject *p)
Return true if *p* is a dict object or an instance of a subtype of the dict
type.
......@@ -33,7 +33,7 @@ Dictionary Objects
Allowed subtypes to be accepted.
.. cfunction:: int PyDict_CheckExact(PyObject *p)
.. c:function:: int PyDict_CheckExact(PyObject *p)
Return true if *p* is a dict object, but not an instance of a subtype of
the dict type.
......@@ -41,12 +41,12 @@ Dictionary Objects
.. versionadded:: 2.4
.. cfunction:: PyObject* PyDict_New()
.. c:function:: PyObject* PyDict_New()
Return a new empty dictionary, or *NULL* on failure.
.. cfunction:: PyObject* PyDictProxy_New(PyObject *dict)
.. c:function:: PyObject* PyDictProxy_New(PyObject *dict)
Return a proxy object for a mapping which enforces read-only behavior.
This is normally used to create a proxy to prevent modification of the
......@@ -55,12 +55,12 @@ Dictionary Objects
.. versionadded:: 2.2
.. cfunction:: void PyDict_Clear(PyObject *p)
.. c:function:: void PyDict_Clear(PyObject *p)
Empty an existing dictionary of all key-value pairs.
.. cfunction:: int PyDict_Contains(PyObject *p, PyObject *key)
.. c:function:: int PyDict_Contains(PyObject *p, PyObject *key)
Determine if dictionary *p* contains *key*. If an item in *p* is matches
*key*, return ``1``, otherwise return ``0``. On error, return ``-1``.
......@@ -69,74 +69,74 @@ Dictionary Objects
.. versionadded:: 2.4
.. cfunction:: PyObject* PyDict_Copy(PyObject *p)
.. c:function:: 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)
.. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val)
Insert *value* into the dictionary *p* with a key of *key*. *key* must be
:term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return
``0`` on success or ``-1`` on failure.
.. cfunction:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val)
.. c:function:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val)
.. index:: single: PyString_FromString()
Insert *value* into the dictionary *p* using *key* as a key. *key* should
be a :ctype:`char\*`. The key object is created using
be a :c:type:`char\*`. The key object is created using
``PyString_FromString(key)``. Return ``0`` on success or ``-1`` on
failure.
.. cfunction:: int PyDict_DelItem(PyObject *p, PyObject *key)
.. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key)
Remove the entry in dictionary *p* with key *key*. *key* must be hashable;
if it isn't, :exc:`TypeError` is raised. Return ``0`` on success or ``-1``
on failure.
.. cfunction:: int PyDict_DelItemString(PyObject *p, char *key)
.. c:function:: int PyDict_DelItemString(PyObject *p, char *key)
Remove the entry in dictionary *p* which has a key specified by the string
*key*. Return ``0`` on success or ``-1`` on failure.
.. cfunction:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key)
.. c:function:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key)
Return the object from dictionary *p* which has a key *key*. Return *NULL*
if the key *key* is not present, but *without* setting an exception.
.. cfunction:: PyObject* PyDict_GetItemString(PyObject *p, const char *key)
.. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key)
This is the same as :cfunc:`PyDict_GetItem`, but *key* is specified as a
:ctype:`char\*`, rather than a :ctype:`PyObject\*`.
This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a
:c:type:`char\*`, rather than a :c:type:`PyObject\*`.
.. cfunction:: PyObject* PyDict_Items(PyObject *p)
.. c:function:: PyObject* PyDict_Items(PyObject *p)
Return a :ctype:`PyListObject` containing all the items from the
Return a :c:type:`PyListObject` containing all the items from the
dictionary, as in the dictionary method :meth:`dict.items`.
.. cfunction:: PyObject* PyDict_Keys(PyObject *p)
.. c:function:: PyObject* PyDict_Keys(PyObject *p)
Return a :ctype:`PyListObject` containing all the keys from the dictionary,
Return a :c:type:`PyListObject` containing all the keys from the dictionary,
as in the dictionary method :meth:`dict.keys`.
.. cfunction:: PyObject* PyDict_Values(PyObject *p)
.. c:function:: PyObject* PyDict_Values(PyObject *p)
Return a :ctype:`PyListObject` containing all the values from the
Return a :c:type:`PyListObject` containing all the values from the
dictionary *p*, as in the dictionary method :meth:`dict.values`.
.. cfunction:: Py_ssize_t PyDict_Size(PyObject *p)
.. c:function:: Py_ssize_t PyDict_Size(PyObject *p)
.. index:: builtin: len
......@@ -144,18 +144,18 @@ Dictionary Objects
``len(p)`` on a dictionary.
.. versionchanged:: 2.5
This function returned an :ctype:`int` type. This might require changes
This function returned an :c:type:`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)
.. c:function:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
Iterate over all key-value pairs in the dictionary *p*. The
:ctype:`Py_ssize_t` referred to by *ppos* must be initialized to ``0``
:c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0``
prior to the first call to this function to start the iteration; the
function returns true for each pair in the dictionary, and false once all
pairs have been reported. The parameters *pkey* and *pvalue* should either
point to :ctype:`PyObject\*` variables that will be filled in with each key
point to :c:type:`PyObject\*` variables that will be filled in with each key
and value, respectively, or may be *NULL*. Any references returned through
them are borrowed. *ppos* should not be altered during iteration. Its
value represents offsets within the internal dictionary structure, and
......@@ -192,15 +192,15 @@ Dictionary Objects
}
.. versionchanged:: 2.5
This function used an :ctype:`int *` type for *ppos*. This might require
This function used an :c:type:`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)
.. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override)
Iterate over mapping object *b* adding key-value pairs to dictionary *a*.
*b* may be a dictionary, or any object supporting :cfunc:`PyMapping_Keys`
and :cfunc:`PyObject_GetItem`. If *override* is true, existing pairs in *a*
*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys`
and :c:func:`PyObject_GetItem`. If *override* is true, existing pairs in *a*
will be replaced if a matching key is found in *b*, otherwise pairs will
only be added if there is not a matching key in *a*. Return ``0`` on
success or ``-1`` if an exception was raised.
......@@ -208,7 +208,7 @@ Dictionary Objects
.. versionadded:: 2.2
.. cfunction:: int PyDict_Update(PyObject *a, PyObject *b)
.. c:function:: 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.
......@@ -216,7 +216,7 @@ Dictionary Objects
.. versionadded:: 2.2
.. cfunction:: int PyDict_MergeFromSeq2(PyObject *a, PyObject *seq2, int override)
.. c:function:: int PyDict_MergeFromSeq2(PyObject *a, PyObject *seq2, int override)
Update or merge into dictionary *a*, from the key-value pairs in *seq2*.
*seq2* must be an iterable object producing iterable objects of length 2,
......
This diff is collapsed.
......@@ -7,79 +7,79 @@ File Objects
.. index:: object: file
Python's built-in file objects are implemented entirely on the :ctype:`FILE\*`
Python's built-in file objects are implemented entirely on the :c:type:`FILE\*`
support from the C standard library. This is an implementation detail and may
change in future releases of Python.
.. ctype:: PyFileObject
.. c:type:: PyFileObject
This subtype of :ctype:`PyObject` represents a Python file object.
This subtype of :c:type:`PyObject` represents a Python file object.
.. cvar:: PyTypeObject PyFile_Type
.. c:var:: PyTypeObject PyFile_Type
.. index:: single: FileType (in module types)
This instance of :ctype:`PyTypeObject` represents the Python file type. This is
This instance of :c:type:`PyTypeObject` represents the Python file type. This is
exposed to Python programs as ``file`` and ``types.FileType``.
.. cfunction:: int PyFile_Check(PyObject *p)
.. c:function:: int PyFile_Check(PyObject *p)
Return true if its argument is a :ctype:`PyFileObject` or a subtype of
:ctype:`PyFileObject`.
Return true if its argument is a :c:type:`PyFileObject` or a subtype of
:c:type:`PyFileObject`.
.. versionchanged:: 2.2
Allowed subtypes to be accepted.
.. cfunction:: int PyFile_CheckExact(PyObject *p)
.. c:function:: int PyFile_CheckExact(PyObject *p)
Return true if its argument is a :ctype:`PyFileObject`, but not a subtype of
:ctype:`PyFileObject`.
Return true if its argument is a :c:type:`PyFileObject`, but not a subtype of
:c:type:`PyFileObject`.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyFile_FromString(char *filename, char *mode)
.. c:function:: PyObject* PyFile_FromString(char *filename, char *mode)
.. index:: single: fopen()
On success, return a new file object that is opened on the file given by
*filename*, with a file mode given by *mode*, where *mode* has the same
semantics as the standard C routine :cfunc:`fopen`. On failure, return *NULL*.
semantics as the standard C routine :c:func:`fopen`. On failure, return *NULL*.
.. cfunction:: PyObject* PyFile_FromFile(FILE *fp, char *name, char *mode, int (*close)(FILE*))
.. c:function:: PyObject* PyFile_FromFile(FILE *fp, char *name, char *mode, int (*close)(FILE*))
Create a new :ctype:`PyFileObject` from the already-open standard C file
Create a new :c:type:`PyFileObject` from the already-open standard C file
pointer, *fp*. The function *close* will be called when the file should be
closed. Return *NULL* and close the file using *close* on failure.
*close* is optional and can be set to *NULL*.
.. cfunction:: FILE* PyFile_AsFile(PyObject \*p)
.. c:function:: FILE* PyFile_AsFile(PyObject \*p)
Return the file object associated with *p* as a :ctype:`FILE\*`.
Return the file object associated with *p* as a :c:type:`FILE\*`.
If the caller will ever use the returned :ctype:`FILE\*` object while
the :term:`GIL` is released it must also call the :cfunc:`PyFile_IncUseCount` and
:cfunc:`PyFile_DecUseCount` functions described below as appropriate.
If the caller will ever use the returned :c:type:`FILE\*` object while
the :term:`GIL` is released it must also call the :c:func:`PyFile_IncUseCount` and
:c:func:`PyFile_DecUseCount` functions described below as appropriate.
.. cfunction:: void PyFile_IncUseCount(PyFileObject \*p)
.. c:function:: void PyFile_IncUseCount(PyFileObject \*p)
Increments the PyFileObject's internal use count to indicate
that the underlying :ctype:`FILE\*` is being used.
that the underlying :c:type:`FILE\*` is being used.
This prevents Python from calling f_close() on it from another thread.
Callers of this must call :cfunc:`PyFile_DecUseCount` when they are
finished with the :ctype:`FILE\*`. Otherwise the file object will
Callers of this must call :c:func:`PyFile_DecUseCount` when they are
finished with the :c:type:`FILE\*`. Otherwise the file object will
never be closed by Python.
The :term:`GIL` must be held while calling this function.
The suggested use is to call this after :cfunc:`PyFile_AsFile` and before
The suggested use is to call this after :c:func:`PyFile_AsFile` and before
you release the GIL::
FILE *fp = PyFile_AsFile(p);
......@@ -94,11 +94,11 @@ change in future releases of Python.
.. versionadded:: 2.6
.. cfunction:: void PyFile_DecUseCount(PyFileObject \*p)
.. c:function:: void PyFile_DecUseCount(PyFileObject \*p)
Decrements the PyFileObject's internal unlocked_count member to
indicate that the caller is done with its own use of the :ctype:`FILE\*`.
This may only be called to undo a prior call to :cfunc:`PyFile_IncUseCount`.
indicate that the caller is done with its own use of the :c:type:`FILE\*`.
This may only be called to undo a prior call to :c:func:`PyFile_IncUseCount`.
The :term:`GIL` must be held while calling this function (see the example
above).
......@@ -106,7 +106,7 @@ change in future releases of Python.
.. versionadded:: 2.6
.. cfunction:: PyObject* PyFile_GetLine(PyObject *p, int n)
.. c:function:: PyObject* PyFile_GetLine(PyObject *p, int n)
.. index:: single: EOFError (built-in exception)
......@@ -120,20 +120,20 @@ change in future releases of Python.
raised if the end of the file is reached immediately.
.. cfunction:: PyObject* PyFile_Name(PyObject *p)
.. c:function:: PyObject* PyFile_Name(PyObject *p)
Return the name of the file specified by *p* as a string object.
.. cfunction:: void PyFile_SetBufSize(PyFileObject *p, int n)
.. c:function:: void PyFile_SetBufSize(PyFileObject *p, int n)
.. index:: single: setvbuf()
Available on systems with :cfunc:`setvbuf` only. This should only be called
Available on systems with :c:func:`setvbuf` only. This should only be called
immediately after file object creation.
.. cfunction:: int PyFile_SetEncoding(PyFileObject *p, const char *enc)
.. c:function:: int PyFile_SetEncoding(PyFileObject *p, const char *enc)
Set the file's encoding for Unicode output to *enc*. Return 1 on success and 0
on failure.
......@@ -141,7 +141,7 @@ change in future releases of Python.
.. versionadded:: 2.3
.. cfunction:: int PyFile_SetEncodingAndErrors(PyFileObject *p, const char *enc, *errors)
.. c:function:: int PyFile_SetEncodingAndErrors(PyFileObject *p, const char *enc, *errors)
Set the file's encoding for Unicode output to *enc*, and its error
mode to *err*. Return 1 on success and 0 on failure.
......@@ -149,7 +149,7 @@ change in future releases of Python.
.. versionadded:: 2.6
.. cfunction:: int PyFile_SoftSpace(PyObject *p, int newflag)
.. c:function:: int PyFile_SoftSpace(PyObject *p, int newflag)
.. index:: single: softspace (file attribute)
......@@ -163,7 +163,7 @@ change in future releases of Python.
but doing so should not be needed.
.. cfunction:: int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags)
.. c:function:: int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags)
.. index:: single: Py_PRINT_RAW
......@@ -173,7 +173,7 @@ change in future releases of Python.
appropriate exception will be set.
.. cfunction:: int PyFile_WriteString(const char *s, PyObject *p)
.. c:function:: int PyFile_WriteString(const char *s, PyObject *p)
Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on
failure; the appropriate exception will be set.
......@@ -8,64 +8,64 @@ Floating Point Objects
.. index:: object: floating point
.. ctype:: PyFloatObject
.. c:type:: PyFloatObject
This subtype of :ctype:`PyObject` represents a Python floating point object.
This subtype of :c:type:`PyObject` represents a Python floating point object.
.. cvar:: PyTypeObject PyFloat_Type
.. c:var:: PyTypeObject PyFloat_Type
.. index:: single: FloatType (in modules types)
This instance of :ctype:`PyTypeObject` represents the Python floating point
This instance of :c:type:`PyTypeObject` represents the Python floating point
type. This is the same object as ``float`` and ``types.FloatType``.
.. cfunction:: int PyFloat_Check(PyObject *p)
.. c:function:: int PyFloat_Check(PyObject *p)
Return true if its argument is a :ctype:`PyFloatObject` or a subtype of
:ctype:`PyFloatObject`.
Return true if its argument is a :c:type:`PyFloatObject` or a subtype of
:c:type:`PyFloatObject`.
.. versionchanged:: 2.2
Allowed subtypes to be accepted.
.. cfunction:: int PyFloat_CheckExact(PyObject *p)
.. c:function:: int PyFloat_CheckExact(PyObject *p)
Return true if its argument is a :ctype:`PyFloatObject`, but not a subtype of
:ctype:`PyFloatObject`.
Return true if its argument is a :c:type:`PyFloatObject`, but not a subtype of
:c:type:`PyFloatObject`.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyFloat_FromString(PyObject *str, char **pend)
.. c:function:: PyObject* PyFloat_FromString(PyObject *str, char **pend)
Create a :ctype:`PyFloatObject` object based on the string value in *str*, or
Create a :c:type:`PyFloatObject` object based on the string value in *str*, or
*NULL* on failure. The *pend* argument is ignored. It remains only for
backward compatibility.
.. cfunction:: PyObject* PyFloat_FromDouble(double v)
.. c:function:: PyObject* PyFloat_FromDouble(double v)
Create a :ctype:`PyFloatObject` object from *v*, or *NULL* on failure.
Create a :c:type:`PyFloatObject` object from *v*, or *NULL* on failure.
.. cfunction:: double PyFloat_AsDouble(PyObject *pyfloat)
.. c:function:: double PyFloat_AsDouble(PyObject *pyfloat)
Return a C :ctype:`double` representation of the contents of *pyfloat*. If
Return a C :c:type:`double` representation of the contents of *pyfloat*. If
*pyfloat* is not a Python floating point object but has a :meth:`__float__`
method, this method will first be called to convert *pyfloat* into a float.
This method returns ``-1.0`` upon failure, so one should call
:cfunc:`PyErr_Occurred` to check for errors.
:c:func:`PyErr_Occurred` to check for errors.
.. cfunction:: double PyFloat_AS_DOUBLE(PyObject *pyfloat)
.. c:function:: double PyFloat_AS_DOUBLE(PyObject *pyfloat)
Return a C :ctype:`double` representation of the contents of *pyfloat*, but
Return a C :c:type:`double` representation of the contents of *pyfloat*, but
without error checking.
.. cfunction:: PyObject* PyFloat_GetInfo(void)
.. c:function:: PyObject* PyFloat_GetInfo(void)
Return a structseq instance which contains information about the
precision, minimum and maximum values of a float. It's a thin wrapper
......@@ -74,21 +74,21 @@ Floating Point Objects
.. versionadded:: 2.6
.. cfunction:: double PyFloat_GetMax()
.. c:function:: double PyFloat_GetMax()
Return the maximum representable finite float *DBL_MAX* as C :ctype:`double`.
Return the maximum representable finite float *DBL_MAX* as C :c:type:`double`.
.. versionadded:: 2.6
.. cfunction:: double PyFloat_GetMin()
.. c:function:: double PyFloat_GetMin()
Return the minimum normalized positive float *DBL_MIN* as C :ctype:`double`.
Return the minimum normalized positive float *DBL_MIN* as C :c:type:`double`.
.. versionadded:: 2.6
.. cfunction:: int PyFloat_ClearFreeList()
.. c:function:: int PyFloat_ClearFreeList()
Clear the float free list. Return the number of items that could not
be freed.
......@@ -96,7 +96,7 @@ Floating Point Objects
.. versionadded:: 2.6
.. cfunction:: void PyFloat_AsString(char *buf, PyFloatObject *v)
.. c:function:: void PyFloat_AsString(char *buf, PyFloatObject *v)
Convert the argument *v* to a string, using the same rules as
:func:`str`. The length of *buf* should be at least 100.
......@@ -108,7 +108,7 @@ Floating Point Objects
Use :func:`PyObject_Str` or :func:`PyOS_double_to_string` instead.
.. cfunction:: void PyFloat_AsReprString(char *buf, PyFloatObject *v)
.. c:function:: void PyFloat_AsReprString(char *buf, PyFloatObject *v)
Same as PyFloat_AsString, except uses the same rules as
:func:`repr`. The length of *buf* should be at least 100.
......
......@@ -10,26 +10,26 @@ Function Objects
There are a few functions specific to Python functions.
.. ctype:: PyFunctionObject
.. c:type:: PyFunctionObject
The C structure used for functions.
.. cvar:: PyTypeObject PyFunction_Type
.. c:var:: PyTypeObject PyFunction_Type
.. index:: single: MethodType (in module types)
This is an instance of :ctype:`PyTypeObject` and represents the Python function
This is an instance of :c:type:`PyTypeObject` and represents the Python function
type. It is exposed to Python programmers as ``types.FunctionType``.
.. cfunction:: int PyFunction_Check(PyObject *o)
.. c:function:: int PyFunction_Check(PyObject *o)
Return true if *o* is a function object (has type :cdata:`PyFunction_Type`).
Return true if *o* is a function object (has type :c:data:`PyFunction_Type`).
The parameter must not be *NULL*.
.. cfunction:: PyObject* PyFunction_New(PyObject *code, PyObject *globals)
.. c:function:: PyObject* PyFunction_New(PyObject *code, PyObject *globals)
Return a new function object associated with the code object *code*. *globals*
must be a dictionary with the global variables accessible to the function.
......@@ -38,30 +38,30 @@ There are a few functions specific to Python functions.
object, the argument defaults and closure are set to *NULL*.
.. cfunction:: PyObject* PyFunction_GetCode(PyObject *op)
.. c:function:: PyObject* PyFunction_GetCode(PyObject *op)
Return the code object associated with the function object *op*.
.. cfunction:: PyObject* PyFunction_GetGlobals(PyObject *op)
.. c:function:: PyObject* PyFunction_GetGlobals(PyObject *op)
Return the globals dictionary associated with the function object *op*.
.. cfunction:: PyObject* PyFunction_GetModule(PyObject *op)
.. c:function:: PyObject* PyFunction_GetModule(PyObject *op)
Return the *__module__* attribute of the function object *op*. This is normally
a string containing the module name, but can be set to any other object by
Python code.
.. cfunction:: PyObject* PyFunction_GetDefaults(PyObject *op)
.. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op)
Return the argument default values of the function object *op*. This can be a
tuple of arguments or *NULL*.
.. cfunction:: int PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
.. c:function:: int PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
Set the argument default values for the function object *op*. *defaults* must be
*Py_None* or a tuple.
......@@ -69,13 +69,13 @@ There are a few functions specific to Python functions.
Raises :exc:`SystemError` and returns ``-1`` on failure.
.. cfunction:: PyObject* PyFunction_GetClosure(PyObject *op)
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
Return the closure associated with the function object *op*. This can be *NULL*
or a tuple of cell objects.
.. cfunction:: int PyFunction_SetClosure(PyObject *op, PyObject *closure)
.. c:function:: int PyFunction_SetClosure(PyObject *op, PyObject *closure)
Set the closure associated with the function object *op*. *closure* must be
*Py_None* or a tuple of cell objects.
......
......@@ -30,40 +30,40 @@ include the :const:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the
Constructors for container types must conform to two rules:
#. The memory for the object must be allocated using :cfunc:`PyObject_GC_New`
or :cfunc:`PyObject_GC_NewVar`.
#. The memory for the object must be allocated using :c:func:`PyObject_GC_New`
or :c:func:`PyObject_GC_NewVar`.
#. Once all the fields which may contain references to other containers are
initialized, it must call :cfunc:`PyObject_GC_Track`.
initialized, it must call :c:func:`PyObject_GC_Track`.
.. cfunction:: TYPE* PyObject_GC_New(TYPE, PyTypeObject *type)
.. c:function:: TYPE* PyObject_GC_New(TYPE, PyTypeObject *type)
Analogous to :cfunc:`PyObject_New` but for container objects with the
Analogous to :c:func:`PyObject_New` but for container objects with the
:const:`Py_TPFLAGS_HAVE_GC` flag set.
.. cfunction:: TYPE* PyObject_GC_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
.. c:function:: TYPE* PyObject_GC_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
Analogous to :cfunc:`PyObject_NewVar` but for container objects with the
Analogous to :c:func:`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
This function used an :c:type:`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)
.. c:function:: TYPE* PyObject_GC_Resize(TYPE, PyVarObject *op, Py_ssize_t newsize)
Resize an object allocated by :cfunc:`PyObject_NewVar`. Returns the
Resize an object allocated by :c:func:`PyObject_NewVar`. Returns the
resized object or *NULL* on failure.
.. versionchanged:: 2.5
This function used an :ctype:`int` type for *newsize*. This might
This function used an :c:type:`int` type for *newsize*. This might
require changes in your code for properly supporting 64-bit systems.
.. cfunction:: void PyObject_GC_Track(PyObject *op)
.. c:function:: void PyObject_GC_Track(PyObject *op)
Adds the object *op* to the set of container objects tracked by the
collector. The collector can run at unexpected times so objects must be
......@@ -72,44 +72,44 @@ Constructors for container types must conform to two rules:
end of the constructor.
.. cfunction:: void _PyObject_GC_TRACK(PyObject *op)
.. c:function:: void _PyObject_GC_TRACK(PyObject *op)
A macro version of :cfunc:`PyObject_GC_Track`. It should not be used for
A macro version of :c:func:`PyObject_GC_Track`. It should not be used for
extension modules.
Similarly, the deallocator for the object must conform to a similar pair of
rules:
#. Before fields which refer to other containers are invalidated,
:cfunc:`PyObject_GC_UnTrack` must be called.
:c:func:`PyObject_GC_UnTrack` must be called.
#. The object's memory must be deallocated using :cfunc:`PyObject_GC_Del`.
#. The object's memory must be deallocated using :c:func:`PyObject_GC_Del`.
.. cfunction:: void PyObject_GC_Del(void *op)
.. c:function:: void PyObject_GC_Del(void *op)
Releases memory allocated to an object using :cfunc:`PyObject_GC_New` or
:cfunc:`PyObject_GC_NewVar`.
Releases memory allocated to an object using :c:func:`PyObject_GC_New` or
:c:func:`PyObject_GC_NewVar`.
.. cfunction:: void PyObject_GC_UnTrack(void *op)
.. c:function:: void PyObject_GC_UnTrack(void *op)
Remove the object *op* from the set of container objects tracked by the
collector. Note that :cfunc:`PyObject_GC_Track` can be called again on
collector. Note that :c:func:`PyObject_GC_Track` can be called again on
this object to add it back to the set of tracked objects. The deallocator
(:attr:`tp_dealloc` handler) should call this for the object before any of
the fields used by the :attr:`tp_traverse` handler become invalid.
.. cfunction:: void _PyObject_GC_UNTRACK(PyObject *op)
.. c:function:: void _PyObject_GC_UNTRACK(PyObject *op)
A macro version of :cfunc:`PyObject_GC_UnTrack`. It should not be used for
A macro version of :c:func:`PyObject_GC_UnTrack`. It should not be used for
extension modules.
The :attr:`tp_traverse` handler accepts a function parameter of this type:
.. ctype:: int (*visitproc)(PyObject *object, void *arg)
.. c:type:: int (*visitproc)(PyObject *object, void *arg)
Type of the visitor function passed to the :attr:`tp_traverse` handler.
The function should be called with an object to traverse as *object* and
......@@ -121,7 +121,7 @@ The :attr:`tp_traverse` handler accepts a function parameter of this type:
The :attr:`tp_traverse` handler must have the following type:
.. ctype:: int (*traverseproc)(PyObject *self, visitproc visit, void *arg)
.. c:type:: int (*traverseproc)(PyObject *self, visitproc visit, void *arg)
Traversal function for a container object. Implementations must call the
*visit* function for each object directly contained by *self*, with the
......@@ -130,12 +130,12 @@ The :attr:`tp_traverse` handler must have the following type:
object argument. If *visit* returns a non-zero value that value should be
returned immediately.
To simplify writing :attr:`tp_traverse` handlers, a :cfunc:`Py_VISIT` macro is
To simplify writing :attr:`tp_traverse` handlers, a :c:func:`Py_VISIT` macro is
provided. In order to use this macro, the :attr:`tp_traverse` implementation
must name its arguments exactly *visit* and *arg*:
.. cfunction:: void Py_VISIT(PyObject *o)
.. c:function:: void Py_VISIT(PyObject *o)
Call the *visit* callback, with arguments *o* and *arg*. If *visit* returns
a non-zero value, then return it. Using this macro, :attr:`tp_traverse`
......@@ -151,15 +151,15 @@ must name its arguments exactly *visit* and *arg*:
.. versionadded:: 2.4
The :attr:`tp_clear` handler must be of the :ctype:`inquiry` type, or *NULL*
The :attr:`tp_clear` handler must be of the :c:type:`inquiry` type, or *NULL*
if the object is immutable.
.. ctype:: int (*inquiry)(PyObject *self)
.. c:type:: int (*inquiry)(PyObject *self)
Drop references that may have created reference cycles. Immutable objects
do not have to define this method since they can never directly create
reference cycles. Note that the object must still be valid after calling
this method (don't just call :cfunc:`Py_DECREF` on a reference). The
this method (don't just call :c:func:`Py_DECREF` on a reference). The
collector will call this method if it detects that this object is involved
in a reference cycle.
......@@ -7,31 +7,31 @@ Generator Objects
Generator objects are what Python uses to implement generator iterators. They
are normally created by iterating over a function that yields values, rather
than explicitly calling :cfunc:`PyGen_New`.
than explicitly calling :c:func:`PyGen_New`.
.. ctype:: PyGenObject
.. c:type:: PyGenObject
The C structure used for generator objects.
.. cvar:: PyTypeObject PyGen_Type
.. c:var:: PyTypeObject PyGen_Type
The type object corresponding to generator objects
.. cfunction:: int PyGen_Check(ob)
.. c:function:: int PyGen_Check(ob)
Return true if *ob* is a generator object; *ob* must not be *NULL*.
.. cfunction:: int PyGen_CheckExact(ob)
.. c:function:: int PyGen_CheckExact(ob)
Return true if *ob*'s type is *PyGen_Type* is a generator object; *ob* must not
be *NULL*.
.. cfunction:: PyObject* PyGen_New(PyFrameObject *frame)
.. c:function:: PyObject* PyGen_New(PyFrameObject *frame)
Create and return a new generator object based on the *frame* object. A
reference to *frame* is stolen by this function. The parameter must not be
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,39 +8,39 @@ Plain Integer Objects
.. index:: object: integer
.. ctype:: PyIntObject
.. c:type:: PyIntObject
This subtype of :ctype:`PyObject` represents a Python integer object.
This subtype of :c:type:`PyObject` represents a Python integer object.
.. cvar:: PyTypeObject PyInt_Type
.. c:var:: PyTypeObject PyInt_Type
.. index:: single: IntType (in modules types)
This instance of :ctype:`PyTypeObject` represents the Python plain integer type.
This instance of :c:type:`PyTypeObject` represents the Python plain integer type.
This is the same object as ``int`` and ``types.IntType``.
.. cfunction:: int PyInt_Check(PyObject *o)
.. c:function:: int PyInt_Check(PyObject *o)
Return true if *o* is of type :cdata:`PyInt_Type` or a subtype of
:cdata:`PyInt_Type`.
Return true if *o* is of type :c:data:`PyInt_Type` or a subtype of
:c:data:`PyInt_Type`.
.. versionchanged:: 2.2
Allowed subtypes to be accepted.
.. cfunction:: int PyInt_CheckExact(PyObject *o)
.. c:function:: int PyInt_CheckExact(PyObject *o)
Return true if *o* is of type :cdata:`PyInt_Type`, but not a subtype of
:cdata:`PyInt_Type`.
Return true if *o* is of type :c:data:`PyInt_Type`, but not a subtype of
:c:data:`PyInt_Type`.
.. versionadded:: 2.2
.. cfunction:: PyObject* PyInt_FromString(char *str, char **pend, int base)
.. c:function:: PyObject* PyInt_FromString(char *str, char **pend, int base)
Return a new :ctype:`PyIntObject` or :ctype:`PyLongObject` based on the string
Return a new :c:type:`PyIntObject` or :c:type:`PyLongObject` based on the string
value in *str*, which is interpreted according to the radix in *base*. If
*pend* is non-*NULL*, ``*pend`` will point to the first character in *str* which
follows the representation of the number. If *base* is ``0``, the radix will be
......@@ -49,13 +49,13 @@ Plain Integer Objects
8 will be used; otherwise radix 10 will be used. If *base* is not ``0``, it
must be between ``2`` and ``36``, inclusive. Leading spaces are ignored. If
there are no digits, :exc:`ValueError` will be raised. If the string represents
a number too large to be contained within the machine's :ctype:`long int` type
and overflow warnings are being suppressed, a :ctype:`PyLongObject` will be
a number too large to be contained within the machine's :c:type:`long int` type
and overflow warnings are being suppressed, a :c:type:`PyLongObject` will be
returned. If overflow warnings are not being suppressed, *NULL* will be
returned in this case.
.. cfunction:: PyObject* PyInt_FromLong(long ival)
.. c:function:: PyObject* PyInt_FromLong(long ival)
Create a new integer object with a value of *ival*.
......@@ -66,7 +66,7 @@ Plain Integer Objects
undefined. :-)
.. cfunction:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival)
.. c:function:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival)
Create a new integer object with a value of *ival*. If the value is larger
than ``LONG_MAX`` or smaller than ``LONG_MIN``, a long integer object is
......@@ -75,7 +75,7 @@ Plain Integer Objects
.. versionadded:: 2.5
.. cfunction:: PyObject* PyInt_FromSize_t(size_t ival)
.. c:function:: PyObject* PyInt_FromSize_t(size_t ival)
Create a new integer object with a value of *ival*. If the value exceeds
``LONG_MAX``, a long integer object is returned.
......@@ -83,47 +83,47 @@ Plain Integer Objects
.. versionadded:: 2.5
.. cfunction:: long PyInt_AsLong(PyObject *io)
.. c:function:: long PyInt_AsLong(PyObject *io)
Will first attempt to cast the object to a :ctype:`PyIntObject`, if it is not
Will first attempt to cast the object to a :c:type:`PyIntObject`, if it is not
already one, and then return its value. If there is an error, ``-1`` is
returned, and the caller should check ``PyErr_Occurred()`` to find out whether
there was an error, or whether the value just happened to be -1.
.. cfunction:: long PyInt_AS_LONG(PyObject *io)
.. c:function:: long PyInt_AS_LONG(PyObject *io)
Return the value of the object *io*. No error checking is performed.
.. cfunction:: unsigned long PyInt_AsUnsignedLongMask(PyObject *io)
.. c:function:: unsigned long PyInt_AsUnsignedLongMask(PyObject *io)
Will first attempt to cast the object to a :ctype:`PyIntObject` or
:ctype:`PyLongObject`, if it is not already one, and then return its value as
Will first attempt to cast the object to a :c:type:`PyIntObject` or
:c:type:`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)
.. c:function:: unsigned PY_LONG_LONG PyInt_AsUnsignedLongLongMask(PyObject *io)
Will first attempt to cast the object to a :ctype:`PyIntObject` or
:ctype:`PyLongObject`, if it is not already one, and then return its value as
Will first attempt to cast the object to a :c:type:`PyIntObject` or
:c:type:`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)
.. c:function:: Py_ssize_t PyInt_AsSsize_t(PyObject *io)
Will first attempt to cast the object to a :ctype:`PyIntObject` or
:ctype:`PyLongObject`, if it is not already one, and then return its value as
:ctype:`Py_ssize_t`.
Will first attempt to cast the object to a :c:type:`PyIntObject` or
:c:type:`PyLongObject`, if it is not already one, and then return its value as
:c:type:`Py_ssize_t`.
.. versionadded:: 2.5
.. cfunction:: long PyInt_GetMax()
.. c:function:: long PyInt_GetMax()
.. index:: single: LONG_MAX
......@@ -131,7 +131,7 @@ Plain Integer Objects
(:const:`LONG_MAX`, as defined in the system header files).
.. cfunction:: int PyInt_ClearFreeList()
.. c:function:: int PyInt_ClearFreeList()
Clear the integer free list. Return the number of items that could not
be freed.
......
This diff is collapsed.
......@@ -10,12 +10,12 @@ Iterator Protocol
There are only a couple of functions specifically for working with iterators.
.. cfunction:: int PyIter_Check(PyObject *o)
.. c:function:: int PyIter_Check(PyObject *o)
Return true if the object *o* supports the iterator protocol.
.. cfunction:: PyObject* PyIter_Next(PyObject *o)
.. c:function:: PyObject* PyIter_Next(PyObject *o)
Return the next value from the iteration *o*. If the object is an iterator,
this retrieves the next value from the iteration, and returns *NULL* with no
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -7,22 +7,22 @@ The None Object
.. index:: object: None
Note that the :ctype:`PyTypeObject` for ``None`` is not directly exposed in the
Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the
Python/C API. Since ``None`` is a singleton, testing for object identity (using
``==`` in C) is sufficient. There is no :cfunc:`PyNone_Check` function for the
``==`` in C) is sufficient. There is no :c:func:`PyNone_Check` function for the
same reason.
.. cvar:: PyObject* Py_None
.. c:var:: PyObject* Py_None
The Python ``None`` object, denoting lack of value. This object has no methods.
It needs to be treated just like any other object with respect to reference
counts.
.. cmacro:: Py_RETURN_NONE
.. c:macro:: Py_RETURN_NONE
Properly handle returning :cdata:`Py_None` from within a C function.
Properly handle returning :c:data:`Py_None` from within a C function.
.. versionadded:: 2.4
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -426,7 +426,7 @@ built-in functions in the installation script.
Which folders are available depends on the exact Windows version, and probably
also the configuration. For details refer to Microsoft's documentation of the
:cfunc:`SHGetSpecialFolderPath` function.
:c:func:`SHGetSpecialFolderPath` function.
.. function:: create_shortcut(target, description, filename[, arguments[, workdir[, iconpath[, iconindex]]]])
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -117,7 +117,7 @@ SAM (stand-alone modules), which is part of the Tix distribution
(http://tix.sourceforge.net/).
Build Tix with SAM enabled, perform the appropriate call to
:cfunc:`Tclsam_init`, etc. inside Python's
:c:func:`Tclsam_init`, etc. inside Python's
:file:`Modules/tkappinit.c`, and link with libtclsam and libtksam (you
might include the Tix libraries as well).
......@@ -126,7 +126,7 @@ Can I have Tk events handled while waiting for I/O?
---------------------------------------------------
Yes, and you don't even need threads! But you'll have to restructure your I/O
code a bit. Tk has the equivalent of Xt's :cfunc:`XtAddInput()` call, which allows you
code a bit. Tk has the equivalent of Xt's :c:func:`XtAddInput()` call, which allows you
to register a callback function which will be called from the Tk mainloop when
I/O is possible on a file descriptor. Here's what you need::
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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