/usr/share/doc/python2-docs/html/_sources/c-api
NameSizeModeActions
abstract.rst.txt7020644editdlrm
allocation.rst.txt47960644editdlrm
arg.rst.txt260040644editdlrm
bool.rst.txt13040644editdlrm
buffer.rst.txt229650644editdlrm
bytearray.rst.txt21810644editdlrm
capsule.rst.txt57410644editdlrm
cell.rst.txt19400644editdlrm
class.rst.txt18660644editdlrm
cobject.rst.txt18700644editdlrm
code.rst.txt16350644editdlrm
codec.rst.txt46430644editdlrm
complex.rst.txt40790644editdlrm
concrete.rst.txt19630644editdlrm
conversion.rst.txt70920644editdlrm
datetime.rst.txt64130644editdlrm
descriptor.rst.txt12960644editdlrm
dict.rst.txt77570644editdlrm
exceptions.rst.txt353040644editdlrm
file.rst.txt61980644editdlrm
float.rst.txt33710644editdlrm
function.rst.txt24210644editdlrm
gcsupport.rst.txt65870644editdlrm
gen.rst.txt9200644editdlrm
import.rst.txt112210644editdlrm
index.rst.txt5780644editdlrm
init.rst.txt491600644editdlrm
int.rst.txt45780644editdlrm
intro.rst.txt284730644editdlrm
iter.rst.txt13900644editdlrm
iterator.rst.txt17960644editdlrm
list.rst.txt63620644editdlrm
long.rst.txt79870644editdlrm
mapping.rst.txt28740644editdlrm
marshal.rst.txt39850644editdlrm
memory.rst.txt115560644editdlrm
method.rst.txt20990644editdlrm
module.rst.txt38670644editdlrm
none.rst.txt6970644editdlrm
number.rst.txt119390644editdlrm
objbuffer.rst.txt25160644editdlrm
object.rst.txt174910644editdlrm
objimpl.rst.txt3050644editdlrm
refcounting.rst.txt29340644editdlrm
reflection.rst.txt15670644editdlrm
sequence.rst.txt87160644editdlrm
set.rst.txt65880644editdlrm
slice.rst.txt29790644editdlrm
string.rst.txt154220644editdlrm
structures.rst.txt149660644editdlrm
sys.rst.txt57140644editdlrm
tuple.rst.txt54910644editdlrm
type.rst.txt27610644editdlrm
typeobj.rst.txt669360644editdlrm
unicode.rst.txt451260644editdlrm
utilities.rst.txt4150644editdlrm
veryhigh.rst.txt133630644editdlrm
weakref.rst.txt28200644editdlrm
Edit: /usr/share/doc/python2-docs/html/_sources/c-api/sys.rst.txt (5714B)
.. highlightlang:: c .. _os: Operating System Utilities ========================== .. c:function:: int Py_FdIsInteractive(FILE *fp, const char *filename) Return true (nonzero) if the standard I/O file *fp* with name *filename* is deemed interactive. This is the case for files for which ``isatty(fileno(fp))`` is true. If the global flag :c:data:`Py_InteractiveFlag` is true, this function also returns true if the *filename* pointer is *NULL* or if the name is equal to one of the strings ``''`` or ``'???'``. .. c:function:: void PyOS_AfterFork() Function to update some internal state after a process fork; this should be called in the new process if the Python interpreter will continue to be used. If a new executable is loaded into the new process, this function does not need to be called. .. c:function:: int PyOS_CheckStack() Return true when the interpreter runs out of stack space. This is a reliable check, but is only available when :const:`USE_STACKCHECK` is defined (currently on Windows using the Microsoft Visual C++ compiler). :const:`USE_STACKCHECK` will be defined automatically; you should never change the definition in your own code. .. c:function:: PyOS_sighandler_t PyOS_getsig(int i) Return the current signal handler for signal *i*. This is a thin wrapper around either :c:func:`sigaction` or :c:func:`signal`. Do not call those functions directly! :c:type:`PyOS_sighandler_t` is a typedef alias for :c:type:`void (\*)(int)`. .. c:function:: PyOS_sighandler_t PyOS_setsig(int i, PyOS_sighandler_t h) Set the signal handler for signal *i* to be *h*; return the old signal handler. This is a thin wrapper around either :c:func:`sigaction` or :c:func:`signal`. Do not call those functions directly! :c:type:`PyOS_sighandler_t` is a typedef alias for :c:type:`void (\*)(int)`. .. _systemfunctions: System Functions ================ These are utility functions that make functionality from the :mod:`sys` module accessible to C code. They all work with the current interpreter thread's :mod:`sys` module's dict, which is contained in the internal thread state structure. .. c:function:: PyObject *PySys_GetObject(char *name) Return the object *name* from the :mod:`sys` module or *NULL* if it does not exist, without setting an exception. .. c:function:: FILE *PySys_GetFile(char *name, FILE *def) Return the :c:type:`FILE*` associated with the object *name* in the :mod:`sys` module, or *def* if *name* is not in the module or is not associated with a :c:type:`FILE*`. .. c:function:: int PySys_SetObject(char *name, PyObject *v) Set *name* in the :mod:`sys` module to *v* unless *v* is *NULL*, in which case *name* is deleted from the sys module. Returns ``0`` on success, ``-1`` on error. .. c:function:: void PySys_ResetWarnOptions() Reset :data:`sys.warnoptions` to an empty list. .. c:function:: void PySys_AddWarnOption(char *s) Append *s* to :data:`sys.warnoptions`. .. c:function:: void PySys_SetPath(char *path) Set :data:`sys.path` to a list object of paths found in *path* which should be a list of paths separated with the platform's search path delimiter (``:`` on Unix, ``;`` on Windows). .. c:function:: void PySys_WriteStdout(const char *format, ...) Write the output string described by *format* to :data:`sys.stdout`. No exceptions are raised, even if truncation occurs (see below). *format* should limit the total size of the formatted output string to 1000 bytes or less -- after 1000 bytes, the output string is truncated. In particular, this means that no unrestricted "%s" formats should occur; these should be limited using "%.s" where is a decimal number calculated so that plus the maximum size of other formatted text does not exceed 1000 bytes. Also watch out for "%f", which can print hundreds of digits for very large numbers. If a problem occurs, or :data:`sys.stdout` is unset, the formatted message is written to the real (C level) *stdout*. .. c:function:: void PySys_WriteStderr(const char *format, ...) As above, but write to :data:`sys.stderr` or *stderr* instead. .. _processcontrol: Process Control =============== .. c:function:: void Py_FatalError(const char *message) .. index:: single: abort() Print a fatal error message and kill the process. No cleanup is performed. This function should only be invoked when a condition is detected that would make it dangerous to continue using the Python interpreter; e.g., when the object administration appears to be corrupted. On Unix, the standard C library function :c:func:`abort` is called which will attempt to produce a :file:`core` file. .. c:function:: void Py_Exit(int status) .. index:: single: Py_Finalize() single: exit() Exit the current process. This calls :c:func:`Py_Finalize` and then calls the standard C library function ``exit(status)``. .. c:function:: int Py_AtExit(void (*func) ()) .. index:: single: Py_Finalize() single: cleanup functions Register a cleanup function to be called by :c:func:`Py_Finalize`. The cleanup function will be called with no arguments and should return no value. At most 32 cleanup functions can be registered. When the registration is successful, :c:func:`Py_AtExit` returns ``0``; on failure, it returns ``-1``. The cleanup function registered last is called first. Each cleanup function will be called at most once. Since Python's internal finalization will have completed before the cleanup function, no Python APIs should be called by *func*.