PageRenderTime 472ms CodeModel.GetById 131ms app.highlight 225ms RepoModel.GetById 96ms app.codeStats 1ms

/pypy/module/cpyext/stubs.py

https://bitbucket.org/dac_io/pypy
Python | 2505 lines | 2496 code | 5 blank | 4 comment | 2 complexity | 5ce6b99c9b4a05d4f8e0cbd3476c305a MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1from pypy.module.cpyext.api import (
   2    cpython_api, PyObject, PyObjectP, CANNOT_FAIL
   3    )
   4from pypy.module.cpyext.complexobject import Py_complex_ptr as Py_complex
   5from pypy.rpython.lltypesystem import rffi, lltype
   6
   7# we don't really care
   8PyTypeObjectPtr = rffi.VOIDP
   9Py_ssize_t = rffi.SSIZE_T
  10PyMethodDef = rffi.VOIDP
  11PyGetSetDef = rffi.VOIDP
  12PyMemberDef = rffi.VOIDP
  13Py_buffer = rffi.VOIDP
  14va_list = rffi.VOIDP
  15PyDateTime_Date = rffi.VOIDP
  16PyDateTime_DateTime = rffi.VOIDP
  17PyDateTime_Time = rffi.VOIDP
  18wrapperbase = rffi.VOIDP
  19FILE = rffi.VOIDP
  20PyFileObject = rffi.VOIDP
  21PyCodeObject = rffi.VOIDP
  22PyFrameObject = rffi.VOIDP
  23PyFloatObject = rffi.VOIDP
  24_inittab = rffi.VOIDP
  25PyThreadState = rffi.VOIDP
  26PyInterpreterState = rffi.VOIDP
  27Py_UNICODE = lltype.UniChar
  28PyCompilerFlags = rffi.VOIDP
  29_node = rffi.VOIDP
  30Py_tracefunc = rffi.VOIDP
  31
  32@cpython_api([PyObject], lltype.Void)
  33def _PyObject_Del(space, op):
  34    raise NotImplementedError
  35
  36@cpython_api([rffi.CCHARP], Py_ssize_t, error=CANNOT_FAIL)
  37def PyBuffer_SizeFromFormat(space, format):
  38    """Return the implied ~Py_buffer.itemsize from the struct-stype
  39    ~Py_buffer.format."""
  40    raise NotImplementedError
  41
  42@cpython_api([rffi.INT_real, Py_ssize_t, Py_ssize_t, Py_ssize_t, lltype.Char], lltype.Void)
  43def PyBuffer_FillContiguousStrides(space, ndim, shape, strides, itemsize, fortran):
  44    """Fill the strides array with byte-strides of a contiguous (C-style if
  45    fortran is 'C' or Fortran-style if fortran is 'F' array of the
  46    given shape with the given number of bytes per element."""
  47    raise NotImplementedError
  48
  49@cpython_api([Py_buffer], PyObject)
  50def PyMemoryView_FromBuffer(space, view):
  51    """Create a memoryview object wrapping the given buffer-info structure view.
  52    The memoryview object then owns the buffer, which means you shouldn't
  53    try to release it yourself: it will be released on deallocation of the
  54    memoryview object."""
  55    raise NotImplementedError
  56
  57@cpython_api([PyObject, rffi.INT_real, lltype.Char], PyObject)
  58def PyMemoryView_GetContiguous(space, obj, buffertype, order):
  59    """Create a memoryview object to a contiguous chunk of memory (in either
  60    'C' or 'F'ortran order) from an object that defines the buffer
  61    interface. If memory is contiguous, the memoryview object points to the
  62    original memory. Otherwise copy is made and the memoryview points to a
  63    new bytes object."""
  64    raise NotImplementedError
  65
  66@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
  67def PyMemoryView_Check(space, obj):
  68    """Return true if the object obj is a memoryview object.  It is not
  69    currently allowed to create subclasses of memoryview."""
  70    raise NotImplementedError
  71
  72@cpython_api([PyObject], Py_buffer)
  73def PyMemoryView_GET_BUFFER(space, obj):
  74    """Return a pointer to the buffer-info structure wrapped by the given
  75    object.  The object must be a memoryview instance; this macro doesn't
  76    check its type, you must do it yourself or you will risk crashes."""
  77    raise NotImplementedError
  78
  79@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
  80def PyByteArray_Check(space, o):
  81    """Return true if the object o is a bytearray object or an instance of a
  82    subtype of the bytearray type."""
  83    raise NotImplementedError
  84
  85@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
  86def PyByteArray_CheckExact(space, o):
  87    """Return true if the object o is a bytearray object, but not an instance of a
  88    subtype of the bytearray type."""
  89    raise NotImplementedError
  90
  91@cpython_api([PyObject], PyObject)
  92def PyByteArray_FromObject(space, o):
  93    """Return a new bytearray object from any object, o, that implements the
  94    buffer protocol.
  95
  96    XXX expand about the buffer protocol, at least somewhere"""
  97    raise NotImplementedError
  98
  99@cpython_api([rffi.CCHARP, Py_ssize_t], PyObject)
 100def PyByteArray_FromStringAndSize(space, string, len):
 101    """Create a new bytearray object from string and its length, len.  On
 102    failure, NULL is returned."""
 103    raise NotImplementedError
 104
 105@cpython_api([PyObject, PyObject], PyObject)
 106def PyByteArray_Concat(space, a, b):
 107    """Concat bytearrays a and b and return a new bytearray with the result."""
 108    raise NotImplementedError
 109
 110@cpython_api([PyObject], Py_ssize_t, error=-1)
 111def PyByteArray_Size(space, bytearray):
 112    """Return the size of bytearray after checking for a NULL pointer."""
 113    raise NotImplementedError
 114
 115@cpython_api([PyObject], rffi.CCHARP)
 116def PyByteArray_AsString(space, bytearray):
 117    """Return the contents of bytearray as a char array after checking for a
 118    NULL pointer."""
 119    raise NotImplementedError
 120
 121@cpython_api([PyObject, Py_ssize_t], rffi.INT_real, error=-1)
 122def PyByteArray_Resize(space, bytearray, len):
 123    """Resize the internal buffer of bytearray to len."""
 124    raise NotImplementedError
 125
 126@cpython_api([PyObject], rffi.CCHARP)
 127def PyByteArray_AS_STRING(space, bytearray):
 128    """Macro version of PyByteArray_AsString()."""
 129    raise NotImplementedError
 130
 131@cpython_api([PyObject], Py_ssize_t, error=-1)
 132def PyByteArray_GET_SIZE(space, bytearray):
 133    """Macro version of PyByteArray_Size()."""
 134    raise NotImplementedError
 135
 136@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
 137def PyCell_Check(space, ob):
 138    """Return true if ob is a cell object; ob must not be NULL."""
 139    raise NotImplementedError
 140
 141@cpython_api([PyObject], PyObject)
 142def PyCell_New(space, ob):
 143    """Create and return a new cell object containing the value ob. The parameter may
 144    be NULL."""
 145    raise NotImplementedError
 146
 147@cpython_api([PyObject], PyObject)
 148def PyCell_Get(space, cell):
 149    """Return the contents of the cell cell."""
 150    raise NotImplementedError
 151
 152@cpython_api([PyObject], PyObject)
 153def PyCell_GET(space, cell):
 154    """Return the contents of the cell cell, but without checking that cell is
 155    non-NULL and a cell object."""
 156    borrow_from()
 157    raise NotImplementedError
 158
 159@cpython_api([PyObject, PyObject], rffi.INT_real, error=-1)
 160def PyCell_Set(space, cell, value):
 161    """Set the contents of the cell object cell to value.  This releases the
 162    reference to any current content of the cell. value may be NULL.  cell
 163    must be non-NULL; if it is not a cell object, -1 will be returned.  On
 164    success, 0 will be returned."""
 165    raise NotImplementedError
 166
 167@cpython_api([PyObject, PyObject], lltype.Void)
 168def PyCell_SET(space, cell, value):
 169    """Sets the value of the cell object cell to value.  No reference counts are
 170    adjusted, and no checks are made for safety; cell must be non-NULL and must
 171    be a cell object."""
 172    raise NotImplementedError
 173
 174@cpython_api([PyObject, PyObject], rffi.INT_real, error=CANNOT_FAIL)
 175def PyClass_IsSubclass(space, klass, base):
 176    """Return true if klass is a subclass of base. Return false in all other cases."""
 177    raise NotImplementedError
 178
 179@cpython_api([PyObject, PyObject, PyObject], PyObject)
 180def PyInstance_New(space, cls, arg, kw):
 181    """Create a new instance of a specific class.  The parameters arg and kw are
 182    used as the positional and keyword parameters to the object's constructor."""
 183    raise NotImplementedError
 184
 185@cpython_api([PyObject], rffi.INT_real, error=-1)
 186def PyCodec_Register(space, search_function):
 187    """Register a new codec search function.
 188
 189    As side effect, this tries to load the encodings package, if not yet
 190    done, to make sure that it is always first in the list of search functions."""
 191    raise NotImplementedError
 192
 193@cpython_api([PyObject, rffi.CCHARP, rffi.CCHARP], PyObject)
 194def PyCodec_Encode(space, object, encoding, errors):
 195    """Generic codec based encoding API.
 196
 197    object is passed through the encoder function found for the given
 198    encoding using the error handling method defined by errors.  errors may
 199    be NULL to use the default method defined for the codec.  Raises a
 200    LookupError if no encoder can be found."""
 201    raise NotImplementedError
 202
 203@cpython_api([PyObject, rffi.CCHARP, rffi.CCHARP], PyObject)
 204def PyCodec_Decode(space, object, encoding, errors):
 205    """Generic codec based decoding API.
 206
 207    object is passed through the decoder function found for the given
 208    encoding using the error handling method defined by errors.  errors may
 209    be NULL to use the default method defined for the codec.  Raises a
 210    LookupError if no encoder can be found."""
 211    raise NotImplementedError
 212
 213@cpython_api([rffi.CCHARP], PyObject)
 214def PyCodec_Encoder(space, encoding):
 215    """Get an encoder function for the given encoding."""
 216    raise NotImplementedError
 217
 218@cpython_api([rffi.CCHARP], PyObject)
 219def PyCodec_Decoder(space, encoding):
 220    """Get a decoder function for the given encoding."""
 221    raise NotImplementedError
 222
 223@cpython_api([rffi.CCHARP, PyObject, rffi.CCHARP], PyObject)
 224def PyCodec_StreamReader(space, encoding, stream, errors):
 225    """Get a StreamReader factory function for the given encoding."""
 226    raise NotImplementedError
 227
 228@cpython_api([rffi.CCHARP, PyObject, rffi.CCHARP], PyObject)
 229def PyCodec_StreamWriter(space, encoding, stream, errors):
 230    """Get a StreamWriter factory function for the given encoding."""
 231    raise NotImplementedError
 232
 233@cpython_api([rffi.CCHARP, PyObject], rffi.INT_real, error=-1)
 234def PyCodec_RegisterError(space, name, error):
 235    """Register the error handling callback function error under the given name.
 236    This callback function will be called by a codec when it encounters
 237    unencodable characters/undecodable bytes and name is specified as the error
 238    parameter in the call to the encode/decode function.
 239
 240    The callback gets a single argument, an instance of
 241    UnicodeEncodeError, UnicodeDecodeError or
 242    UnicodeTranslateError that holds information about the problematic
 243    sequence of characters or bytes and their offset in the original string (see
 244    unicodeexceptions for functions to extract this information).  The
 245    callback must either raise the given exception, or return a two-item tuple
 246    containing the replacement for the problematic sequence, and an integer
 247    giving the offset in the original string at which encoding/decoding should be
 248    resumed.
 249
 250    Return 0 on success, -1 on error."""
 251    raise NotImplementedError
 252
 253@cpython_api([rffi.CCHARP], PyObject)
 254def PyCodec_LookupError(space, name):
 255    """Lookup the error handling callback function registered under name.  As a
 256    special case NULL can be passed, in which case the error handling callback
 257    for "strict" will be returned."""
 258    raise NotImplementedError
 259
 260@cpython_api([PyObject], PyObject)
 261def PyCodec_StrictErrors(space, exc):
 262    """Raise exc as an exception."""
 263    raise NotImplementedError
 264
 265@cpython_api([PyObject], PyObject)
 266def PyCodec_IgnoreErrors(space, exc):
 267    """Ignore the unicode error, skipping the faulty input."""
 268    raise NotImplementedError
 269
 270@cpython_api([PyObject], PyObject)
 271def PyCodec_ReplaceErrors(space, exc):
 272    """Replace the unicode encode error with ? or U+FFFD."""
 273    raise NotImplementedError
 274
 275@cpython_api([PyObject], PyObject)
 276def PyCodec_XMLCharRefReplaceErrors(space, exc):
 277    """Replace the unicode encode error with XML character references."""
 278    raise NotImplementedError
 279
 280@cpython_api([PyObject], PyObject)
 281def PyCodec_BackslashReplaceErrors(space, exc):
 282    r"""Replace the unicode encode error with backslash escapes (\x, \u and
 283    \U)."""
 284    raise NotImplementedError
 285
 286@cpython_api([Py_complex, Py_complex], Py_complex)
 287def _Py_c_sum(space, left, right):
 288    """Return the sum of two complex numbers, using the C Py_complex
 289    representation."""
 290    raise NotImplementedError
 291
 292@cpython_api([Py_complex, Py_complex], Py_complex)
 293def _Py_c_diff(space, left, right):
 294    """Return the difference between two complex numbers, using the C
 295    Py_complex representation."""
 296    raise NotImplementedError
 297
 298@cpython_api([Py_complex], Py_complex)
 299def _Py_c_neg(space, complex):
 300    """Return the negation of the complex number complex, using the C
 301    Py_complex representation."""
 302    raise NotImplementedError
 303
 304@cpython_api([Py_complex, Py_complex], Py_complex)
 305def _Py_c_prod(space, left, right):
 306    """Return the product of two complex numbers, using the C Py_complex
 307    representation."""
 308    raise NotImplementedError
 309
 310@cpython_api([Py_complex, Py_complex], Py_complex)
 311def _Py_c_quot(space, dividend, divisor):
 312    """Return the quotient of two complex numbers, using the C Py_complex
 313    representation."""
 314    raise NotImplementedError
 315
 316@cpython_api([Py_complex, Py_complex], Py_complex)
 317def _Py_c_pow(space, num, exp):
 318    """Return the exponentiation of num by exp, using the C Py_complex
 319    representation."""
 320    raise NotImplementedError
 321
 322@cpython_api([Py_complex], PyObject)
 323def PyComplex_FromCComplex(space, v):
 324    """Create a new Python complex number object from a C Py_complex value."""
 325    raise NotImplementedError
 326
 327@cpython_api([rffi.CCHARP, rffi.CCHARPP], rffi.DOUBLE, error=CANNOT_FAIL)
 328def PyOS_ascii_strtod(space, nptr, endptr):
 329    """Convert a string to a double. This function behaves like the Standard C
 330    function strtod() does in the C locale. It does this without changing the
 331    current locale, since that would not be thread-safe.
 332
 333    PyOS_ascii_strtod() should typically be used for reading configuration
 334    files or other non-user input that should be locale independent.
 335
 336    See the Unix man page strtod(2) for details.
 337
 338    Use PyOS_string_to_double() instead."""
 339    raise NotImplementedError
 340
 341@cpython_api([rffi.CCHARP, rffi.SIZE_T, rffi.CCHARP, rffi.DOUBLE], rffi.CCHARP)
 342def PyOS_ascii_formatd(space, buffer, buf_len, format, d):
 343    """Convert a double to a string using the '.' as the decimal
 344    separator. format is a printf()-style format string specifying the
 345    number format. Allowed conversion characters are 'e', 'E', 'f',
 346    'F', 'g' and 'G'.
 347
 348    The return value is a pointer to buffer with the converted string or NULL if
 349    the conversion failed.
 350
 351    This function is removed in Python 2.7 and 3.1.  Use PyOS_double_to_string()
 352    instead."""
 353    raise NotImplementedError
 354
 355@cpython_api([rffi.DOUBLE, lltype.Char, rffi.INT_real, rffi.INT_real, rffi.INTP], rffi.CCHARP)
 356def PyOS_double_to_string(space, val, format_code, precision, flags, ptype):
 357    """Convert a double val to a string using supplied
 358    format_code, precision, and flags.
 359
 360    format_code must be one of 'e', 'E', 'f', 'F',
 361    'g', 'G' or 'r'.  For 'r', the supplied precision
 362    must be 0 and is ignored.  The 'r' format code specifies the
 363    standard repr() format.
 364
 365    flags can be zero or more of the values Py_DTSF_SIGN,
 366    Py_DTSF_ADD_DOT_0, or Py_DTSF_ALT, or-ed together:
 367
 368    Py_DTSF_SIGN means to always precede the returned string with a sign
 369    character, even if val is non-negative.
 370
 371    Py_DTSF_ADD_DOT_0 means to ensure that the returned string will not look
 372    like an integer.
 373
 374    Py_DTSF_ALT means to apply "alternate" formatting rules.  See the
 375    documentation for the PyOS_snprintf() '#' specifier for
 376    details.
 377
 378    If ptype is non-NULL, then the value it points to will be set to one of
 379    Py_DTST_FINITE, Py_DTST_INFINITE, or Py_DTST_NAN, signifying that
 380    val is a finite number, an infinite number, or not a number, respectively.
 381
 382    The return value is a pointer to buffer with the converted string or
 383    NULL if the conversion failed. The caller is responsible for freeing the
 384    returned string by calling PyMem_Free().
 385    """
 386    raise NotImplementedError
 387
 388@cpython_api([rffi.CCHARP], rffi.DOUBLE, error=CANNOT_FAIL)
 389def PyOS_ascii_atof(space, nptr):
 390    """Convert a string to a double in a locale-independent way.
 391
 392    See the Unix man page atof(2) for details.
 393
 394    Use PyOS_string_to_double() instead."""
 395    raise NotImplementedError
 396
 397@cpython_api([rffi.CCHARP, rffi.CCHARP], rffi.CCHARP)
 398def PyOS_stricmp(space, s1, s2):
 399    """Case insensitive comparison of strings. The function works almost
 400    identically to strcmp() except that it ignores the case.
 401    """
 402    raise NotImplementedError
 403
 404@cpython_api([rffi.CCHARP, rffi.CCHARP, Py_ssize_t], rffi.CCHARP)
 405def PyOS_strnicmp(space, s1, s2, size):
 406    """Case insensitive comparison of strings. The function works almost
 407    identically to strncmp() except that it ignores the case.
 408    """
 409    raise NotImplementedError
 410
 411@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
 412def PyTZInfo_Check(space, ob):
 413    """Return true if ob is of type PyDateTime_TZInfoType or a subtype of
 414    PyDateTime_TZInfoType.  ob must not be NULL.
 415    """
 416    raise NotImplementedError
 417
 418@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
 419def PyTZInfo_CheckExact(space, ob):
 420    """Return true if ob is of type PyDateTime_TZInfoType. ob must not be
 421    NULL.
 422    """
 423    raise NotImplementedError
 424
 425@cpython_api([PyTypeObjectPtr, PyGetSetDef], PyObject)
 426def PyDescr_NewGetSet(space, type, getset):
 427    raise NotImplementedError
 428
 429@cpython_api([PyTypeObjectPtr, PyMemberDef], PyObject)
 430def PyDescr_NewMember(space, type, meth):
 431    raise NotImplementedError
 432
 433@cpython_api([PyTypeObjectPtr, wrapperbase, rffi.VOIDP], PyObject)
 434def PyDescr_NewWrapper(space, type, wrapper, wrapped):
 435    raise NotImplementedError
 436
 437@cpython_api([PyTypeObjectPtr, PyMethodDef], PyObject)
 438def PyDescr_NewClassMethod(space, type, method):
 439    raise NotImplementedError
 440
 441@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
 442def PyDescr_IsData(space, descr):
 443    """Return true if the descriptor objects descr describes a data attribute, or
 444    false if it describes a method.  descr must be a descriptor object; there is
 445    no error checking.
 446    """
 447    raise NotImplementedError
 448
 449@cpython_api([PyObject, PyObject], PyObject)
 450def PyWrapper_New(space, w_d, w_self):
 451    raise NotImplementedError
 452
 453@cpython_api([PyObject, PyObject, rffi.INT_real], rffi.INT_real, error=-1)
 454def PyDict_Merge(space, a, b, override):
 455    """Iterate over mapping object b adding key-value pairs to dictionary a.
 456    b may be a dictionary, or any object supporting PyMapping_Keys()
 457    and PyObject_GetItem(). If override is true, existing pairs in a
 458    will be replaced if a matching key is found in b, otherwise pairs will
 459    only be added if there is not a matching key in a. Return 0 on
 460    success or -1 if an exception was raised.
 461    """
 462    raise NotImplementedError
 463
 464@cpython_api([PyObject, PyObject, rffi.INT_real], rffi.INT_real, error=-1)
 465def PyDict_MergeFromSeq2(space, a, seq2, override):
 466    """Update or merge into dictionary a, from the key-value pairs in seq2.
 467    seq2 must be an iterable object producing iterable objects of length 2,
 468    viewed as key-value pairs.  In case of duplicate keys, the last wins if
 469    override is true, else the first wins. Return 0 on success or -1
 470    if an exception was raised. Equivalent Python (except for the return
 471    value):
 472
 473    def PyDict_MergeFromSeq2(a, seq2, override):
 474        for key, value in seq2:
 475            if override or key not in a:
 476                a[key] = value
 477    """
 478    raise NotImplementedError
 479
 480@cpython_api([rffi.INT_real], PyObject)
 481def PyErr_SetFromWindowsErr(space, ierr):
 482    """This is a convenience function to raise WindowsError. If called with
 483    ierr of 0, the error code returned by a call to GetLastError()
 484    is used instead.  It calls the Win32 function FormatMessage() to retrieve
 485    the Windows description of error code given by ierr or GetLastError(),
 486    then it constructs a tuple object whose first item is the ierr value and whose
 487    second item is the corresponding error message (gotten from
 488    FormatMessage()), and then calls PyErr_SetObject(PyExc_WindowsError,
 489    object). This function always returns NULL. Availability: Windows.
 490    Return value: always NULL."""
 491    raise NotImplementedError
 492
 493@cpython_api([PyObject, rffi.INT_real], PyObject)
 494def PyErr_SetExcFromWindowsErr(space, type, ierr):
 495    """Similar to PyErr_SetFromWindowsErr(), with an additional parameter
 496    specifying the exception type to be raised. Availability: Windows.
 497
 498    Return value: always NULL."""
 499    raise NotImplementedError
 500
 501@cpython_api([rffi.INT_real, rffi.CCHARP], PyObject)
 502def PyErr_SetFromWindowsErrWithFilename(space, ierr, filename):
 503    """Similar to PyErr_SetFromWindowsErr(), with the additional behavior that
 504    if filename is not NULL, it is passed to the constructor of
 505    WindowsError as a third parameter. Availability: Windows.
 506    Return value: always NULL."""
 507    raise NotImplementedError
 508
 509@cpython_api([PyObject, rffi.INT_real, rffi.CCHARP], PyObject)
 510def PyErr_SetExcFromWindowsErrWithFilename(space, type, ierr, filename):
 511    """Similar to PyErr_SetFromWindowsErrWithFilename(), with an additional
 512    parameter specifying the exception type to be raised. Availability: Windows.
 513
 514    Return value: always NULL."""
 515    raise NotImplementedError
 516
 517@cpython_api([PyObject, rffi.CCHARP, rffi.CCHARP, rffi.INT_real, rffi.CCHARP, PyObject], rffi.INT_real, error=-1)
 518def PyErr_WarnExplicit(space, category, message, filename, lineno, module, registry):
 519    """Issue a warning message with explicit control over all warning attributes.  This
 520    is a straightforward wrapper around the Python function
 521    warnings.warn_explicit(), see there for more information.  The module
 522    and registry arguments may be set to NULL to get the default effect
 523    described there."""
 524    raise NotImplementedError
 525
 526@cpython_api([rffi.INT_real], rffi.INT_real, error=CANNOT_FAIL)
 527def PySignal_SetWakeupFd(space, fd):
 528    """This utility function specifies a file descriptor to which a '\0' byte will
 529    be written whenever a signal is received.  It returns the previous such file
 530    descriptor.  The value -1 disables the feature; this is the initial state.
 531    This is equivalent to signal.set_wakeup_fd() in Python, but without any
 532    error checking.  fd should be a valid file descriptor.  The function should
 533    only be called from the main thread."""
 534    raise NotImplementedError
 535
 536@cpython_api([rffi.CCHARP, rffi.CCHARP, Py_ssize_t, Py_ssize_t, Py_ssize_t, rffi.CCHARP], PyObject)
 537def PyUnicodeDecodeError_Create(space, encoding, object, length, start, end, reason):
 538    """Create a UnicodeDecodeError object with the attributes encoding,
 539    object, length, start, end and reason."""
 540    raise NotImplementedError
 541
 542@cpython_api([rffi.CCHARP, rffi.CWCHARP, Py_ssize_t, Py_ssize_t, Py_ssize_t, rffi.CCHARP], PyObject)
 543def PyUnicodeEncodeError_Create(space, encoding, object, length, start, end, reason):
 544    """Create a UnicodeEncodeError object with the attributes encoding,
 545    object, length, start, end and reason."""
 546    raise NotImplementedError
 547
 548@cpython_api([rffi.CWCHARP, Py_ssize_t, Py_ssize_t, Py_ssize_t, rffi.CCHARP], PyObject)
 549def PyUnicodeTranslateError_Create(space, object, length, start, end, reason):
 550    """Create a UnicodeTranslateError object with the attributes object,
 551    length, start, end and reason."""
 552    raise NotImplementedError
 553
 554@cpython_api([PyObject], PyObject)
 555def PyUnicodeDecodeError_GetEncoding(space, exc):
 556    """Return the encoding attribute of the given exception object."""
 557    raise NotImplementedError
 558
 559@cpython_api([PyObject], PyObject)
 560def PyUnicodeDecodeError_GetObject(space, exc):
 561    """Return the object attribute of the given exception object."""
 562    raise NotImplementedError
 563
 564@cpython_api([PyObject, Py_ssize_t], rffi.INT_real, error=-1)
 565def PyUnicodeDecodeError_GetStart(space, exc, start):
 566    """Get the start attribute of the given exception object and place it into
 567    *start.  start must not be NULL.  Return 0 on success, -1 on
 568    failure."""
 569    raise NotImplementedError
 570
 571@cpython_api([PyObject, Py_ssize_t], rffi.INT_real, error=-1)
 572def PyUnicodeDecodeError_SetStart(space, exc, start):
 573    """Set the start attribute of the given exception object to start.  Return
 574    0 on success, -1 on failure."""
 575    raise NotImplementedError
 576
 577@cpython_api([PyObject, Py_ssize_t], rffi.INT_real, error=-1)
 578def PyUnicodeDecodeError_GetEnd(space, exc, end):
 579    """Get the end attribute of the given exception object and place it into
 580    *end.  end must not be NULL.  Return 0 on success, -1 on
 581    failure."""
 582    raise NotImplementedError
 583
 584@cpython_api([PyObject, Py_ssize_t], rffi.INT_real, error=-1)
 585def PyUnicodeDecodeError_SetEnd(space, exc, end):
 586    """Set the end attribute of the given exception object to end.  Return 0
 587    on success, -1 on failure."""
 588    raise NotImplementedError
 589
 590@cpython_api([PyObject], PyObject)
 591def PyUnicodeDecodeError_GetReason(space, exc):
 592    """Return the reason attribute of the given exception object."""
 593    raise NotImplementedError
 594
 595@cpython_api([PyObject, rffi.CCHARP], rffi.INT_real, error=-1)
 596def PyUnicodeDecodeError_SetReason(space, exc, reason):
 597    """Set the reason attribute of the given exception object to reason.  Return
 598    0 on success, -1 on failure."""
 599    raise NotImplementedError
 600
 601@cpython_api([rffi.CCHARP], rffi.INT_real, error=1)
 602def Py_EnterRecursiveCall(space, where):
 603    """Marks a point where a recursive C-level call is about to be performed.
 604
 605    If USE_STACKCHECK is defined, this function checks if the the OS
 606    stack overflowed using PyOS_CheckStack().  In this is the case, it
 607    sets a MemoryError and returns a nonzero value.
 608
 609    The function then checks if the recursion limit is reached.  If this is the
 610    case, a RuntimeError is set and a nonzero value is returned.
 611    Otherwise, zero is returned.
 612
 613    where should be a string such as " in instance check" to be
 614    concatenated to the RuntimeError message caused by the recursion depth
 615    limit."""
 616    raise NotImplementedError
 617
 618@cpython_api([], lltype.Void)
 619def Py_LeaveRecursiveCall(space):
 620    """Ends a Py_EnterRecursiveCall().  Must be called once for each
 621    successful invocation of Py_EnterRecursiveCall()."""
 622    raise NotImplementedError
 623
 624@cpython_api([PyFileObject], lltype.Void)
 625def PyFile_IncUseCount(space, p):
 626    """Increments the PyFileObject's internal use count to indicate
 627    that the underlying FILE* is being used.
 628    This prevents Python from calling f_close() on it from another thread.
 629    Callers of this must call PyFile_DecUseCount() when they are
 630    finished with the FILE*.  Otherwise the file object will
 631    never be closed by Python.
 632
 633    The GIL must be held while calling this function.
 634
 635    The suggested use is to call this after PyFile_AsFile() and before
 636    you release the GIL:
 637
 638    FILE *fp = PyFile_AsFile(p);
 639    PyFile_IncUseCount(p);
 640    /* ... */
 641    Py_BEGIN_ALLOW_THREADS
 642    do_something(fp);
 643    Py_END_ALLOW_THREADS
 644    /* ... */
 645    PyFile_DecUseCount(p);
 646    """
 647    raise NotImplementedError
 648
 649@cpython_api([PyFileObject], lltype.Void)
 650def PyFile_DecUseCount(space, p):
 651    """Decrements the PyFileObject's internal unlocked_count member to
 652    indicate that the caller is done with its own use of the FILE*.
 653    This may only be called to undo a prior call to PyFile_IncUseCount().
 654
 655    The GIL must be held while calling this function (see the example
 656    above).
 657    """
 658    raise NotImplementedError
 659
 660@cpython_api([PyFileObject, rffi.CCHARP], rffi.INT_real, error=0)
 661def PyFile_SetEncoding(space, p, enc):
 662    """Set the file's encoding for Unicode output to enc. Return 1 on success and 0
 663    on failure.
 664    """
 665    raise NotImplementedError
 666
 667@cpython_api([PyFileObject, rffi.CCHARP, rffi.CCHARP], rffi.INT_real, error=0)
 668def PyFile_SetEncodingAndErrors(space, p, enc, errors):
 669    """Set the file's encoding for Unicode output to enc, and its error
 670    mode to err. Return 1 on success and 0 on failure.
 671    """
 672    raise NotImplementedError
 673
 674@cpython_api([], PyObject)
 675def PyFloat_GetInfo(space):
 676    """Return a structseq instance which contains information about the
 677    precision, minimum and maximum values of a float. It's a thin wrapper
 678    around the header file float.h.
 679    """
 680    raise NotImplementedError
 681
 682@cpython_api([], rffi.DOUBLE, error=CANNOT_FAIL)
 683def PyFloat_GetMax(space):
 684    """Return the maximum representable finite float DBL_MAX as C double.
 685    """
 686    raise NotImplementedError
 687
 688@cpython_api([], rffi.DOUBLE, error=CANNOT_FAIL)
 689def PyFloat_GetMin(space):
 690    """Return the minimum normalized positive float DBL_MIN as C double.
 691    """
 692    raise NotImplementedError
 693
 694@cpython_api([], rffi.INT_real, error=CANNOT_FAIL)
 695def PyFloat_ClearFreeList(space):
 696    """Clear the float free list. Return the number of items that could not
 697    be freed.
 698    """
 699    raise NotImplementedError
 700
 701@cpython_api([rffi.CCHARP, PyFloatObject], lltype.Void)
 702def PyFloat_AsString(space, buf, v):
 703    """Convert the argument v to a string, using the same rules as
 704    str(). The length of buf should be at least 100.
 705
 706    This function is unsafe to call because it writes to a buffer whose
 707    length it does not know.
 708
 709    Use PyObject_Str() or PyOS_double_to_string() instead."""
 710    raise NotImplementedError
 711
 712@cpython_api([rffi.CCHARP, PyFloatObject], lltype.Void)
 713def PyFloat_AsReprString(space, buf, v):
 714    """Same as PyFloat_AsString, except uses the same rules as
 715    repr().  The length of buf should be at least 100.
 716
 717    This function is unsafe to call because it writes to a buffer whose
 718    length it does not know.
 719
 720    Use PyObject_Repr() or PyOS_double_to_string() instead."""
 721    raise NotImplementedError
 722
 723@cpython_api([PyObject, PyObject], PyObject)
 724def PyFunction_New(space, code, globals):
 725    """Return a new function object associated with the code object code. globals
 726    must be a dictionary with the global variables accessible to the function.
 727
 728    The function's docstring, name and __module__ are retrieved from the code
 729    object, the argument defaults and closure are set to NULL."""
 730    raise NotImplementedError
 731
 732@cpython_api([PyObject], PyObject)
 733def PyFunction_GetGlobals(space, op):
 734    """Return the globals dictionary associated with the function object op."""
 735    borrow_from()
 736    raise NotImplementedError
 737
 738@cpython_api([PyObject], PyObject)
 739def PyFunction_GetModule(space, op):
 740    """Return the __module__ attribute of the function object op. This is normally
 741    a string containing the module name, but can be set to any other object by
 742    Python code."""
 743    borrow_from()
 744    raise NotImplementedError
 745
 746@cpython_api([PyObject], PyObject)
 747def PyFunction_GetDefaults(space, op):
 748    """Return the argument default values of the function object op. This can be a
 749    tuple of arguments or NULL."""
 750    borrow_from()
 751    raise NotImplementedError
 752
 753@cpython_api([PyObject, PyObject], rffi.INT_real, error=-1)
 754def PyFunction_SetDefaults(space, op, defaults):
 755    """Set the argument default values for the function object op. defaults must be
 756    Py_None or a tuple.
 757
 758    Raises SystemError and returns -1 on failure."""
 759    raise NotImplementedError
 760
 761@cpython_api([PyObject], PyObject)
 762def PyFunction_GetClosure(space, op):
 763    """Return the closure associated with the function object op. This can be NULL
 764    or a tuple of cell objects."""
 765    borrow_from()
 766    raise NotImplementedError
 767
 768@cpython_api([PyObject, PyObject], rffi.INT_real, error=-1)
 769def PyFunction_SetClosure(space, op, closure):
 770    """Set the closure associated with the function object op. closure must be
 771    Py_None or a tuple of cell objects.
 772
 773    Raises SystemError and returns -1 on failure."""
 774    raise NotImplementedError
 775
 776@cpython_api([PyTypeObjectPtr, Py_ssize_t], PyObject)
 777def PyObject_GC_NewVar(space, type, size):
 778    """Analogous to PyObject_NewVar() but for container objects with the
 779    Py_TPFLAGS_HAVE_GC flag set.
 780
 781    This function used an int type for size. This might require
 782    changes in your code for properly supporting 64-bit systems."""
 783    raise NotImplementedError
 784
 785@cpython_api([PyObject, Py_ssize_t], PyObject)
 786def PyObject_GC_Resize(space, op, newsize):
 787    """Resize an object allocated by PyObject_NewVar().  Returns the
 788    resized object or NULL on failure.
 789
 790    This function used an int type for newsize. This might
 791    require changes in your code for properly supporting 64-bit systems."""
 792    raise NotImplementedError
 793
 794@cpython_api([PyObject], lltype.Void)
 795def _PyObject_GC_TRACK(space, op):
 796    """A macro version of PyObject_GC_Track().  It should not be used for
 797    extension modules."""
 798    raise NotImplementedError
 799
 800@cpython_api([PyObject], lltype.Void)
 801def _PyObject_GC_UNTRACK(space, op):
 802    """A macro version of PyObject_GC_UnTrack().  It should not be used for
 803    extension modules."""
 804    raise NotImplementedError
 805
 806@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
 807def PyGen_Check(space, ob):
 808    """Return true if ob is a generator object; ob must not be NULL."""
 809    raise NotImplementedError
 810
 811@cpython_api([PyObject], rffi.INT_real, error=CANNOT_FAIL)
 812def PyGen_CheckExact(space, ob):
 813    """Return true if ob's type is PyGen_Type is a generator object; ob must not
 814    be NULL."""
 815    raise NotImplementedError
 816
 817@cpython_api([PyFrameObject], PyObject)
 818def PyGen_New(space, frame):
 819    """Create and return a new generator object based on the frame object. A
 820    reference to frame is stolen by this function. The parameter must not be
 821    NULL."""
 822    raise NotImplementedError
 823
 824@cpython_api([rffi.CCHARP, PyObject, PyObject, PyObject], PyObject)
 825def PyImport_ImportModuleEx(space, name, globals, locals, fromlist):
 826    """Import a module.  This is best described by referring to the built-in
 827    Python function __import__(), as the standard __import__() function calls
 828    this function directly.
 829
 830    The return value is a new reference to the imported module or top-level package,
 831    or NULL with an exception set on failure (before Python 2.4, the module may
 832    still be created in this case).  Like for __import__(), the return value
 833    when a submodule of a package was requested is normally the top-level package,
 834    unless a non-empty fromlist was given.
 835
 836    Failing imports remove incomplete module objects.
 837
 838    The function is an alias for PyImport_ImportModuleLevel() with
 839    -1 as level, meaning relative import."""
 840    raise NotImplementedError
 841
 842@cpython_api([rffi.CCHARP, PyObject, PyObject, PyObject, rffi.INT_real], PyObject)
 843def PyImport_ImportModuleLevel(space, name, globals, locals, fromlist, level):
 844    """Import a module.  This is best described by referring to the built-in Python
 845    function __import__(), as the standard __import__() function calls
 846    this function directly.
 847
 848    The return value is a new reference to the imported module or top-level package,
 849    or NULL with an exception set on failure.  Like for __import__(),
 850    the return value when a submodule of a package was requested is normally the
 851    top-level package, unless a non-empty fromlist was given.
 852    """
 853    raise NotImplementedError
 854
 855@cpython_api([], lltype.Signed, error=CANNOT_FAIL)
 856def PyImport_GetMagicNumber(space):
 857    """Return the magic number for Python bytecode files (a.k.a. .pyc and
 858    .pyo files).  The magic number should be present in the first four bytes
 859    of the bytecode file, in little-endian byte order."""
 860    raise NotImplementedError
 861
 862@cpython_api([PyObject], PyObject)
 863def PyImport_GetImporter(space, path):
 864    """Return an importer object for a sys.path/pkg.__path__ item
 865    path, possibly by fetching it from the sys.path_importer_cache
 866    dict.  If it wasn't yet cached, traverse sys.path_hooks until a hook
 867    is found that can handle the path item.  Return None if no hook could;
 868    this tells our caller it should fall back to the built-in import mechanism.
 869    Cache the result in sys.path_importer_cache.  Return a new reference
 870    to the importer object.
 871    """
 872    raise NotImplementedError
 873
 874@cpython_api([], lltype.Void)
 875def _PyImport_Init(space):
 876    """Initialize the import mechanism.  For internal use only."""
 877    raise NotImplementedError
 878
 879@cpython_api([], lltype.Void)
 880def PyImport_Cleanup(space):
 881    """Empty the module table.  For internal use only."""
 882    raise NotImplementedError
 883
 884@cpython_api([], lltype.Void)
 885def _PyImport_Fini(space):
 886    """Finalize the import mechanism.  For internal use only."""
 887    raise NotImplementedError
 888
 889@cpython_api([rffi.CCHARP, rffi.CCHARP], PyObject)
 890def _PyImport_FindExtension(space, name, filename):
 891    """For internal use only."""
 892    raise NotImplementedError
 893
 894@cpython_api([rffi.CCHARP, rffi.CCHARP], PyObject)
 895def _PyImport_FixupExtension(space, name, filename):
 896    """For internal use only."""
 897    raise NotImplementedError
 898
 899@cpython_api([rffi.CCHARP], rffi.INT_real, error=-1)
 900def PyImport_ImportFrozenModule(space, name):
 901    """Load a frozen module named name.  Return 1 for success, 0 if the
 902    module is not found, and -1 with an exception set if the initialization
 903    failed.  To access the imported module on a successful load, use
 904    PyImport_ImportModule().  (Note the misnomer --- this function would
 905    reload the module if it was already imported.)"""
 906    raise NotImplementedError
 907
 908@cpython_api([rffi.CCHARP, rffi.VOIDP], rffi.INT_real, error=-1)
 909def PyImport_AppendInittab(space, name, initfunc):
 910    """Add a single module to the existing table of built-in modules.  This is a
 911    convenience wrapper around PyImport_ExtendInittab(), returning -1 if
 912    the table could not be extended.  The new module can be imported by the name
 913    name, and uses the function initfunc as the initialization function called
 914    on the first attempted import.  This should be called before
 915    Py_Initialize()."""
 916    raise NotImplementedError
 917
 918@cpython_api([_inittab], rffi.INT_real, error=-1)
 919def PyImport_ExtendInittab(space, newtab):
 920    """Add a collection of modules to the table of built-in modules.  The newtab
 921    array must end with a sentinel entry which contains NULL for the name
 922    field; failure to provide the sentinel value can result in a memory fault.
 923    Returns 0 on success or -1 if insufficient memory could be allocated to
 924    extend the internal table.  In the event of failure, no modules are added to the
 925    internal table.  This should be called before Py_Initialize()."""
 926    raise NotImplementedError
 927
 928@cpython_api([], lltype.Void)
 929def Py_Initialize(space):
 930    """Initialize the Python interpreter.  In an application embedding Python,
 931    this should be called before using any other Python/C API functions; with
 932    the exception of Py_SetProgramName(), PyEval_InitThreads(),
 933    PyEval_ReleaseLock(), and PyEval_AcquireLock(). This initializes the table
 934    of loaded modules (sys.modules), and creates the fundamental modules
 935    __builtin__, __main__ and sys.  It also initializes the module search path
 936    (sys.path). It does not set sys.argv; use PySys_SetArgvEx() for that.  This
 937    is a no-op when called for a second time (without calling Py_Finalize()
 938    first).  There is no return value; it is a fatal error if the initialization
 939    fails."""
 940    raise NotImplementedError
 941
 942@cpython_api([rffi.INT_real], lltype.Void)
 943def Py_InitializeEx(space, initsigs):
 944    """This function works like Py_Initialize() if initsigs is 1. If
 945    initsigs is 0, it skips initialization registration of signal handlers, which
 946    might be useful when Python is embedded.
 947    """
 948    raise NotImplementedError
 949
 950@cpython_api([], lltype.Void)
 951def Py_Finalize(space):
 952    """Undo all initializations made by Py_Initialize() and subsequent use of
 953    Python/C API functions, and destroy all sub-interpreters (see
 954    Py_NewInterpreter() below) that were created and not yet destroyed since
 955    the last call to Py_Initialize().  Ideally, this frees all memory
 956    allocated by the Python interpreter.  This is a no-op when called for a second
 957    time (without calling Py_Initialize() again first).  There is no return
 958    value; errors during finalization are ignored.
 959
 960    This function is provided for a number of reasons.  An embedding application
 961    might want to restart Python without having to restart the application itself.
 962    An application that has loaded the Python interpreter from a dynamically
 963    loadable library (or DLL) might want to free all memory allocated by Python
 964    before unloading the DLL. During a hunt for memory leaks in an application a
 965    developer might want to free all memory allocated by Python before exiting from
 966    the application.
 967
 968    Bugs and caveats: The destruction of modules and objects in modules is done
 969    in random order; this may cause destructors (__del__() methods) to fail
 970    when they depend on other objects (even functions) or modules.  Dynamically
 971    loaded extension modules loaded by Python are not unloaded.  Small amounts of
 972    memory allocated by the Python interpreter may not be freed (if you find a leak,
 973    please report it).  Memory tied up in circular references between objects is not
 974    freed.  Some memory allocated by extension modules may not be freed.  Some
 975    extensions may not work properly if their initialization routine is called more
 976    than once; this can happen if an application calls Py_Initialize() and
 977    Py_Finalize() more than once."""
 978    raise NotImplementedError
 979
 980@cpython_api([rffi.CCHARP], lltype.Void)
 981def Py_SetProgramName(space, name):
 982    """This function should be called before Py_Initialize() is called for the
 983    first time, if it is called at all.  It tells the interpreter the value of
 984    the argv[0] argument to the main() function of the program.  This is used by
 985    Py_GetPath() and some other functions below to find the Python run-time
 986    libraries relative to the interpreter executable.  The default value is
 987    'python'.  The argument should point to a zero-terminated character string
 988    in static storage whose contents will not change for the duration of the
 989    program's execution.  No code in the Python interpreter will change the
 990    contents of this storage."""
 991    raise NotImplementedError
 992
 993@cpython_api([], rffi.CCHARP)
 994def Py_GetPrefix(space):
 995    """Return the prefix for installed platform-independent files. This is derived
 996    through a number of complicated rules from the program name set with
 997    Py_SetProgramName() and some environment variables; for example, if the
 998    program name is '/usr/local/bin/python', the prefix is '/usr/local'. The
 999    returned string points into static storage; the caller should not modify its
1000    value.  This corresponds to the prefix variable in the top-level
1001    Makefile and the --prefix argument to the configure
1002    script at build time.  The value is available to Python code as sys.prefix.
1003    It is only useful on Unix.  See also the next function."""
1004    raise NotImplementedError
1005
1006@cpython_api([], rffi.CCHARP)
1007def Py_GetExecPrefix(space):
1008    """Return the exec-prefix for installed platform-dependent files.  This is
1009    derived through a number of complicated rules from the program name set with
1010    Py_SetProgramName() and some environment variables; for example, if the
1011    program name is '/usr/local/bin/python', the exec-prefix is
1012    '/usr/local'.  The returned string points into static storage; the caller
1013    should not modify its value.  This corresponds to the exec_prefix
1014    variable in the top-level Makefile and the --exec-prefix
1015    argument to the configure script at build  time.  The value is
1016    available to Python code as sys.exec_prefix.  It is only useful on Unix.
1017
1018    Background: The exec-prefix differs from the prefix when platform dependent
1019    files (such as executables and shared libraries) are installed in a different
1020    directory tree.  In a typical installation, platform dependent files may be
1021    installed in the /usr/local/plat subtree while platform independent may
1022    be installed in /usr/local.
1023
1024    Generally speaking, a platform is a combination of hardware and software
1025    families, e.g.  Sparc machines running the Solaris 2.x operating system are
1026    considered the same platform, but Intel machines running Solaris 2.x are another
1027    platform, and Intel machines running Linux are yet another platform.  Different
1028    major revisions of the same operating system generally also form different
1029    platforms.  Non-Unix operating systems are a different story; the installation
1030    strategies on those systems are so different that the prefix and exec-prefix are
1031    meaningless, and set to the empty string. Note that compiled Python bytecode
1032    files are platform independent (but not independent from the Python version by
1033    which they were compiled!).
1034
1035    System administrators will know how to configure the mount or
1036    automount programs to share /usr/local between platforms
1037    while having /usr/local/plat be a different filesystem for each
1038    platform."""
1039    raise NotImplementedError
1040
1041@cpython_api([], rffi.CCHARP)
1042def Py_GetProgramFullPath(space):
1043    """Return the full program name of the Python executable; this is computed
1044    as a side-effect of deriving the default module search path from the program
1045    name (set by Py_SetProgramName() above). The returned string points into
1046    static storage; the caller should not modify its value.  The value is
1047    available to Python code as sys.executable."""
1048    raise NotImplementedError
1049
1050@cpython_api([], rffi.CCHARP)
1051def Py_GetPath(space):
1052    """Return the default module search path; this is computed from the program
1053    name (set by Py_SetProgramName() above) and some environment variables.  The
1054    returned string consists of a series of directory names separated by a
1055    platform dependent delimiter character.  The delimiter character is ':' on
1056    Unix and Mac OS X, ';' on Windows.  The returned string points into static
1057    storage; the caller should not modify its value.  The list sys.path is
1058    initialized with this value on interpreter startup; it can be (and usually
1059    is) modified later to change the search path for loading modules.
1060
1061    XXX should give the exact rules"""
1062    raise NotImplementedError
1063
1064@cpython_api([], rffi.CCHARP)
1065def Py_GetPlatform(space):
1066    """Return the platform identifier for the current platform.  On Unix, this
1067    is formed from the"official" name of the operating system, converted to lower
1068    case, followed by the major revision number; e.g., for Solaris 2.x, which is
1069    also known as SunOS 5.x, the value is 'sunos5'.  On Mac OS X, it is
1070    'darwin'.  On Windows, it is 'win'.  The returned string points into
1071    static storage; the caller should not modify its value.  The value is available
1072    to Python code as sys.platform."""
1073    raise NotImplementedError
1074
1075@cpython_api([], rffi.CCHARP)
1076def Py_GetCopyright(space):
1077    """Return the official copyright string for the current Python version, for example
1078
1079    'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'
1080
1081    The returned string points into static storage; the caller should not modify its
1082    value.  The value is available to Python code as sys.copyright."""
1083    raise NotImplementedError
1084
1085@cpython_api([], rffi.CCHARP)
1086def Py_GetCompiler(space):
1087    """Return an indication of the compiler used to build the current Python version,
1088    in square brackets, for example:
1089
1090    "[GCC 2.7.2.2]"
1091
1092    The returned string points into static storage; the caller should not modify its
1093    value.  The value is available to Python code as part of the variable
1094    sys.version."""
1095    raise NotImplementedError
1096
1097@cpython_api([], rffi.CCHARP)
1098def Py_GetBuildInfo(space):
1099    """Return information about the sequence number and build date and time  of the
1100    current Python interpreter instance, for example
1101
1102    "\#67, Aug  1 1997, 22:34:28"
1103
1104    The returned string points into static storage; the caller should not modify its
1105    value.  The value is available to Python code as part of the variable
1106    sys.version."""
1107    raise NotImplementedError
1108
1109@cpython_api([rffi.INT_real, rffi.CCHARPP, rffi.INT_real], lltype.Void)
1110def PySys_SetArgvEx(space, argc, argv, updatepath):
1111    """Set sys.argv based on argc and argv.  These parameters are similar to
1112    those passed to the program's main() function with the difference that the
1113    first entry should refer to the script file to be executed rather than the
1114    executable hosting the Python interpreter.  If there isn't a script that
1115    will be run, the first entry in argv can be an empty string.  If this
1116    function fails to initialize sys.argv, a fatal condition is signalled using
1117    Py_FatalError().
1118
1119    If updatepath is zero, this is all the function does.  If updatepath
1120    is non-zero, the function also modifies sys.path according to the
1121    following algorithm:
1122
1123    If the name of an existing script is passed in argv[0], the absolute
1124    path of the directory where the script is located is prepended to
1125    sys.path.
1126
1127    Otherwise (that is, if argc is 0 or argv[0] doesn't point
1128    to an existing file name), an empty string is prepended to
1129    sys.path, which is the same as prepending the current working
1130    directory (".").
1131
1132    It is recommended that applications embedding the Python interpreter
1133    for purposes other than executing a single script pass 0 as updatepath,
1134    and update sys.path themselves if desired.
1135    See CVE-2008-5983.
1136
1137    On versions before 2.6.6, you can achieve the same effect by manually
1138    popping the first sys.path element after having called
1139    PySys_SetArgv(), for example using:
1140
1141    PyRun_SimpleString("import sys; sys.path.pop(0)\n");
1142
1143    XXX impl. doesn't seem consistent in allowing 0/NULL for the params;
1144    check w/ Guido."""
1145    raise NotImplementedError
1146
1147@cpython_api([rffi.INT_real, rffi.CCHARPP], lltype.Void)
1148def PySys_SetArgv(space, argc, argv):
1149    """This function works like PySys_SetArgvEx() with updatepath set to 1."""
1150    raise NotImplementedError
1151
1152@cpython_api([rffi.CCHARP], lltype.Void)
1153def Py_SetPythonHome(space, home):
1154    """Set the default "home" directory, that is, the location of the standard
1155    Python libraries.  See PYTHONHOME for the meaning of the
1156    argument string.
1157
1158    The argument should point to a zero-terminated character string in static
1159    storage whose contents will not change for the duration of the program's
1160    execution.  No code in the Python interpreter will change the contents of
1161    this storage."""
1162    raise NotImplementedError
1163
1164@cpython_api([], rffi.CCHARP)
1165def Py_GetPythonHome(space):
1166    "

Large files files are truncated, but you can click here to view the full file