File: Python.pxi

package info (click to toggle)
python-numpy 1%3A1.12.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,732 kB
  • ctags: 19,262
  • sloc: ansic: 146,995; python: 98,088; cpp: 1,112; makefile: 425; f90: 307; sh: 173; fortran: 169; perl: 58
file content (43 lines) | stat: -rw-r--r-- 1,119 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# :Author:    Robert Kern
# :Copyright: 2004, Enthought, Inc.
# :License:   BSD Style


cdef extern from "Python.h":
    # Not part of the Python API, but we might as well define it here.
    # Note that the exact type doesn't actually matter for Pyrex.
    ctypedef int size_t

    # String API
    char* PyString_AsString(object string)
    char* PyString_AS_STRING(object string)
    object PyString_FromString(char* c_string)
    object PyString_FromStringAndSize(char* c_string, int length)

    # Float API
    double PyFloat_AsDouble(object ob)
    long PyInt_AsLong(object ob)

    # Memory API
    void* PyMem_Malloc(size_t n)
    void* PyMem_Realloc(void* buf, size_t n)
    void PyMem_Free(void* buf)

    void Py_DECREF(object obj)
    void Py_XDECREF(object obj)
    void Py_INCREF(object obj)
    void Py_XINCREF(object obj)

    # TypeCheck API
    int PyFloat_Check(object obj)
    int PyInt_Check(object obj)

    # Error API
    int PyErr_Occurred()
    void PyErr_Clear()

cdef extern from "string.h":
    void *memcpy(void *s1, void *s2, int n)

cdef extern from "math.h":
    double fabs(double x)