Changeset 4841:448f805d5e88
- Timestamp:
- 05/24/07 23:13:05 (6 years ago)
- Branch:
- default
- Location:
- sage/ext
- Files:
-
- 21 edited
-
python_bool.pxi (modified) (1 diff)
-
python_complex.pxi (modified) (1 diff)
-
python_dict.pxi (modified) (8 diffs)
-
python_exc.pxi (modified) (22 diffs)
-
python_function.pxi (modified) (3 diffs)
-
python_instance.pxi (modified) (2 diffs)
-
python_int.pxi (modified) (3 diffs)
-
python_list.pxi (modified) (6 diffs)
-
python_long.pxi (modified) (5 diffs)
-
python_mapping.pxi (modified) (5 diffs)
-
python_mem.pxi (modified) (4 diffs)
-
python_method.pxi (modified) (3 diffs)
-
python_module.pxi (modified) (12 diffs)
-
python_number.pxi (modified) (29 diffs)
-
python_object.pxi (modified) (24 diffs)
-
python_parse.pxi (modified) (1 diff)
-
python_ref.pxi (modified) (3 diffs)
-
python_sequence.pxi (modified) (10 diffs)
-
python_set.pxi (modified) (7 diffs)
-
python_string.pxi (modified) (13 diffs)
-
python_type.pxi (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sage/ext/python_bool.pxi
r1765 r4841 30 30 # Return Py_True from a function, properly incrementing its reference count. 31 31 32 object PyBool_FromLong( long v)32 object PyBool_FromLong(long v) 33 33 # Return value: New reference. 34 34 # Return a new reference to Py_True or Py_False depending on the truth value of v. -
sage/ext/python_complex.pxi
r1765 r4841 15 15 # types.ComplexType. 16 16 17 int PyComplex_Check( object p)17 int PyComplex_Check(object p) 18 18 # Return true if its argument is a PyComplexObject or a subtype of 19 19 # PyComplexObject. 20 20 21 int PyComplex_CheckExact( object p)21 int PyComplex_CheckExact(object p) 22 22 # Return true if its argument is a PyComplexObject, but not a subtype of PyComplexObject. 23 23 24 object PyComplex_FromCComplex( Py_complex v)24 object PyComplex_FromCComplex(Py_complex v) 25 25 # Return value: New reference. 26 26 # Create a new Python complex number object from a C Py_complex value. 27 27 28 object PyComplex_FromDoubles( double real, double imag)28 object PyComplex_FromDoubles(double real, double imag) 29 29 # Return value: New reference. 30 30 # Return a new PyComplexObject object from real and imag. 31 31 32 double PyComplex_RealAsDouble( object op)32 double PyComplex_RealAsDouble(object op) 33 33 # Return the real part of op as a C double. 34 34 35 double PyComplex_ImagAsDouble( object op)35 double PyComplex_ImagAsDouble(object op) 36 36 # Return the imaginary part of op as a C double. 37 37 38 Py_complex PyComplex_AsCComplex( object op)38 Py_complex PyComplex_AsCComplex(object op) 39 39 # Return the Py_complex value of the complex number op. -
sage/ext/python_dict.pxi
r1765 r4841 9 9 # This instance of PyTypeObject represents the Python dictionary type. This is exposed to Python programs as dict and types.DictType. 10 10 11 int PyDict_Check( object p)11 int PyDict_Check(object p) 12 12 # Return true if p is a dict object or an instance of a subtype of 13 13 # the dict type. 14 14 15 int PyDict_CheckExact( object p)15 int PyDict_CheckExact(object p) 16 16 # Return true if p is a dict object, but not an instance of a 17 17 # subtype of the dict type. 18 18 19 object PyDict_New( )19 object PyDict_New() 20 20 # Return value: New reference. 21 21 # Return a new empty dictionary, or NULL on failure. 22 22 23 object PyDictProxy_New( object dict)23 object PyDictProxy_New(object dict) 24 24 # Return value: New reference. 25 25 # Return a proxy object for a mapping which enforces read-only … … 27 27 # modification of the dictionary for non-dynamic class types. 28 28 29 void PyDict_Clear( object p)29 void PyDict_Clear(object p) 30 30 # Empty an existing dictionary of all key-value pairs. 31 31 32 int PyDict_Contains( object p, object key)32 int PyDict_Contains(object p, object key) 33 33 # Determine if dictionary p contains key. If an item in p is 34 34 # matches key, return 1, otherwise return 0. On error, return 35 35 # -1. This is equivalent to the Python expression "key in p". 36 36 37 object PyDict_Copy( object p)37 object PyDict_Copy(object p) 38 38 # Return value: New reference. 39 39 # Return a new dictionary that contains the same key-value pairs as p. 40 40 41 int PyDict_SetItem( object p, object key, object val)41 int PyDict_SetItem(object p, object key, object val) 42 42 # Insert value into the dictionary p with a key of key. key must 43 43 # be hashable; if it isn't, TypeError will be raised. Return 0 on 44 44 # success or -1 on failure. 45 45 46 int PyDict_SetItemString( object p,char *key, object val)46 int PyDict_SetItemString(object p, char *key, object val) 47 47 # Insert value into the dictionary p using key as a key. key 48 48 # should be a char*. The key object is created using 49 49 # PyString_FromString(key). Return 0 on success or -1 on failure. 50 50 51 int PyDict_DelItem( object p, object key)51 int PyDict_DelItem(object p, object key) 52 52 # Remove the entry in dictionary p with key key. key must be 53 53 # hashable; if it isn't, TypeError is raised. Return 0 on success 54 54 # or -1 on failure. 55 55 56 int PyDict_DelItemString( object p, char *key)56 int PyDict_DelItemString(object p, char *key) 57 57 # Remove the entry in dictionary p which has a key specified by 58 58 # the string key. Return 0 on success or -1 on failure. 59 59 60 PyObject* PyDict_GetItem( object p, object key)60 PyObject* PyDict_GetItem(object p, object key) 61 61 # Return value: Borrowed reference. 62 62 # Return the object from dictionary p which has a key key. Return … … 64 64 # exception. 65 65 66 PyObject* PyDict_GetItemString( object p,char *key)66 PyObject* PyDict_GetItemString(object p, char *key) 67 67 # Return value: Borrowed reference. 68 68 # This is the same as PyDict_GetItem(), but key is specified as a 69 69 # char*, rather than a PyObject*. 70 70 71 object PyDict_Items( object p)71 object PyDict_Items(object p) 72 72 # Return value: New reference. 73 73 # Return a PyListObject containing all the items from the … … 75 75 # Library Reference). 76 76 77 object PyDict_Keys( object p)77 object PyDict_Keys(object p) 78 78 # Return value: New reference. 79 79 # Return a PyListObject containing all the keys from the … … 81 81 # Library Reference). 82 82 83 object PyDict_Values( object p)83 object PyDict_Values(object p) 84 84 # Return value: New reference. 85 85 # Return a PyListObject containing all the values from the … … 87 87 # Python Library Reference). 88 88 89 Py_ssize_t PyDict_Size( object p)89 Py_ssize_t PyDict_Size(object p) 90 90 # Return the number of items in the dictionary. This is equivalent to "len(p)" on a dictionary. 91 91 92 int PyDict_Next( object p, Py_ssize_t *ppos, PyObject* *pkey, PyObject* *pvalue)92 int PyDict_Next(object p, Py_ssize_t *ppos, PyObject* *pkey, PyObject* *pvalue) 93 93 # Iterate over all key-value pairs in the dictionary p. The int 94 94 # referred to by ppos must be initialized to 0 prior to the first … … 129 129 # } 130 130 131 int PyDict_Merge( object a, object b, int override)131 int PyDict_Merge(object a, object b, int override) 132 132 # Iterate over mapping object b adding key-value pairs to 133 133 # dictionary a. b may be a dictionary, or any object supporting … … 138 138 # raised. 139 139 140 int PyDict_Update( object a, object b)140 int PyDict_Update(object a, object b) 141 141 # This is the same as PyDict_Merge(a, b, 1) in C, or a.update(b) 142 142 # in Python. Return 0 on success or -1 if an exception was raised. 143 143 144 int PyDict_MergeFromSeq2( object a, object seq2, int override)144 int PyDict_MergeFromSeq2(object a, object seq2, int override) 145 145 # Update or merge into dictionary a, from the key-value pairs in 146 146 # seq2. seq2 must be an iterable object producing iterable objects -
sage/ext/python_exc.pxi
r1765 r4841 40 40 # set. (Otherwise it will cause a fatal error!) 41 41 42 PyObject* PyErr_Occurred( )42 PyObject* PyErr_Occurred() 43 43 # Return value: Borrowed reference. 44 44 # Test whether the error indicator is set. If set, return the … … 53 53 # subclass of the expected exception.) 54 54 55 int PyErr_ExceptionMatches( object exc)55 int PyErr_ExceptionMatches(object exc) 56 56 # Equivalent to "PyErr_GivenExceptionMatches(PyErr_Occurred(), 57 57 # exc)". This should only be called when an exception is actually … … 59 59 # been raised. 60 60 61 int PyErr_GivenExceptionMatches( object given, object exc)61 int PyErr_GivenExceptionMatches(object given, object exc) 62 62 # Return true if the given exception matches the exception in 63 63 # exc. If exc is a class object, this also returns true when given … … 66 66 # match. If given is NULL, a memory access violation will occur. 67 67 68 void PyErr_NormalizeException( PyObject** exc, PyObject** val, PyObject** tb)68 void PyErr_NormalizeException(PyObject** exc, PyObject** val, PyObject** tb) 69 69 # Under certain circumstances, the values returned by 70 70 # PyErr_Fetch() below can be ``unnormalized'', meaning that *exc … … 75 75 # performance. 76 76 77 void PyErr_Clear( )77 void PyErr_Clear() 78 78 # Clear the error indicator. If the error indicator is not set, there is no effect. 79 79 80 void PyErr_Fetch( PyObject** ptype, PyObject** pvalue, PyObject** ptraceback)80 void PyErr_Fetch(PyObject** ptype, PyObject** pvalue, PyObject** ptraceback) 81 81 # Retrieve the error indicator into three variables whose 82 82 # addresses are passed. If the error indicator is not set, set all … … 88 88 # restore the error indicator temporarily. 89 89 90 void PyErr_Restore( object type, object value, object traceback)90 void PyErr_Restore(object type, object value, object traceback) 91 91 # Set the error indicator from the three objects. If the error 92 92 # indicator is already set, it is cleared first. If the objects … … 103 103 # current exception state. 104 104 105 void PyErr_SetString( object type, char *message)105 void PyErr_SetString(object type, char *message) 106 106 # This is the most common way to set the error indicator. The 107 107 # first argument specifies the exception type; it is normally one … … 110 110 # error message; it is converted to a string object. 111 111 112 void PyErr_SetObject( object type, object value)112 void PyErr_SetObject(object type, object value) 113 113 # This function is similar to PyErr_SetString() but lets you 114 114 # specify an arbitrary Python object for the ``value'' of the 115 115 # exception. 116 116 117 PyObject* PyErr_Format( object exception, char *format, ...)117 PyObject* PyErr_Format(object exception, char *format, ...) 118 118 # Return value: Always NULL. 119 119 # This function sets the error indicator and returns … … 123 123 # parsed, but the width part is ignored. 124 124 125 void PyErr_SetNone( object type)125 void PyErr_SetNone(object type) 126 126 # This is a shorthand for "PyErr_SetObject(type, Py_None)". 127 127 128 int PyErr_BadArgument( )128 int PyErr_BadArgument() 129 129 130 130 # This is a shorthand for "PyErr_SetString(PyExc_TypeError, … … 132 132 # invoked with an illegal argument. It is mostly for internal use. 133 133 134 PyObject* PyErr_NoMemory( )134 PyObject* PyErr_NoMemory() 135 135 # Return value: Always NULL. 136 136 # This is a shorthand for "PyErr_SetNone(PyExc_MemoryError)"; it … … 138 138 # PyErr_NoMemory();" when it runs out of memory. 139 139 140 PyObject* PyErr_SetFromErrno( object type)140 PyObject* PyErr_SetFromErrno(object type) 141 141 # Return value: Always NULL. 142 142 # This is a convenience function to raise an exception when a C … … 153 153 # error. 154 154 155 PyObject* PyErr_SetFromErrnoWithFilename( object type, char *filename)155 PyObject* PyErr_SetFromErrnoWithFilename(object type, char *filename) 156 156 # Return value: Always NULL. Similar to PyErr_SetFromErrno(), 157 157 # with the additional behavior that if filename is not NULL, it is … … 160 160 # define the filename attribute of the exception instance. 161 161 162 PyObject* PyErr_SetFromWindowsErr( int ierr)162 PyObject* PyErr_SetFromWindowsErr(int ierr) 163 163 # Return value: Always NULL. This is a convenience function to 164 164 # raise WindowsError. If called with ierr of 0, the error code … … 172 172 # always returns NULL. Availability: Windows. 173 173 174 PyObject* PyErr_SetExcFromWindowsErr( object type, int ierr)174 PyObject* PyErr_SetExcFromWindowsErr(object type, int ierr) 175 175 # Return value: Always NULL. Similar to 176 176 # PyErr_SetFromWindowsErr(), with an additional parameter … … 178 178 # Windows. New in version 2.3. 179 179 180 PyObject* PyErr_SetFromWindowsErrWithFilename( int ierr, char *filename)180 PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, char *filename) 181 181 # Return value: Always NULL. Similar to 182 182 # PyErr_SetFromWindowsErr(), with the additional behavior that if … … 184 184 # WindowsError as a third parameter. Availability: Windows. 185 185 186 PyObject* PyErr_SetExcFromWindowsErrWithFilename( object type, int ierr, char *filename)186 PyObject* PyErr_SetExcFromWindowsErrWithFilename(object type, int ierr, char *filename) 187 187 # Return value: Always NULL. 188 188 # Similar to PyErr_SetFromWindowsErrWithFilename(), with an … … 190 190 # raised. Availability: Windows. 191 191 192 void PyErr_BadInternalCall( )192 void PyErr_BadInternalCall() 193 193 # This is a shorthand for "PyErr_SetString(PyExc_TypeError, 194 194 # message)", where message indicates that an internal operation … … 196 196 # argument. It is mostly for internal use. 197 197 198 int PyErr_WarnEx( object category, char *message, int stacklevel)198 int PyErr_WarnEx(object category, char *message, int stacklevel) 199 199 # Issue a warning message. The category argument is a warning 200 200 # category (see below) or NULL; the message argument is a message … … 205 205 # and so forth. 206 206 207 int PyErr_WarnExplicit( object category, char *message, char *filename, int lineno, char *module, object registry)207 int PyErr_WarnExplicit(object category, char *message, char *filename, int lineno, char *module, object registry) 208 208 # Issue a warning message with explicit control over all warning 209 209 # attributes. This is a straightforward wrapper around the Python … … 212 212 # NULL to get the default effect described there. 213 213 214 int PyErr_CheckSignals( )214 int PyErr_CheckSignals() 215 215 # This function interacts with Python's signal handling. It checks 216 216 # whether a signal has been sent to the processes and if so, … … 229 229 # holding the interpreter lock. 230 230 231 PyObject* PyErr_NewException( char *name, object base, object dict)231 PyObject* PyErr_NewException(char *name, object base, object dict) 232 232 # Return value: New reference. 233 233 # This utility function creates and returns a new exception … … 237 237 # Exception (accessible in C as PyExc_Exception). 238 238 239 void PyErr_WriteUnraisable( object obj)239 void PyErr_WriteUnraisable(object obj) 240 240 # This utility function prints a warning message to sys.stderr 241 241 # when an exception has been set but it is impossible for the -
sage/ext/python_function.pxi
r1765 r4841 12 12 # types.FunctionType. 13 13 14 int PyFunction_Check( object o)14 int PyFunction_Check(object o) 15 15 # Return true if o is a function object (has type 16 16 # PyFunction_Type). The parameter must not be NULL. 17 17 18 object PyFunction_New( object code, object globals)18 object PyFunction_New(object code, object globals) 19 19 # Return value: New reference. 20 20 # Return a new function object associated with the code object … … 25 25 # NULL. 26 26 27 PyObject* PyFunction_GetCode( object op)27 PyObject* PyFunction_GetCode(object op) 28 28 # Return value: Borrowed reference. 29 29 # Return the code object associated with the function object op. 30 30 31 PyObject* PyFunction_GetGlobals( object op)31 PyObject* PyFunction_GetGlobals(object op) 32 32 # Return value: Borrowed reference. 33 33 # Return the globals dictionary associated with the function object op. 34 34 35 PyObject* PyFunction_GetModule( object op)35 PyObject* PyFunction_GetModule(object op) 36 36 # Return value: Borrowed reference. 37 37 # Return the __module__ attribute of the function object op. This … … 39 39 # to any other object by Python code. 40 40 41 PyObject* PyFunction_GetDefaults( object op)41 PyObject* PyFunction_GetDefaults(object op) 42 42 # Return value: Borrowed reference. 43 43 # Return the argument default values of the function object 44 44 # op. This can be a tuple of arguments or NULL. 45 45 46 int PyFunction_SetDefaults( object op, object defaults)46 int PyFunction_SetDefaults(object op, object defaults) 47 47 # Set the argument default values for the function object 48 48 # op. defaults must be Py_None or a tuple. 49 49 # Raises SystemError and returns -1 on failure. 50 50 51 PyObject* PyFunction_GetClosure( object op)51 PyObject* PyFunction_GetClosure(object op) 52 52 # Return value: Borrowed reference. 53 53 # Return the closure associated with the function object op. This 54 54 # can be NULL or a tuple of cell objects. 55 55 56 int PyFunction_SetClosure( object op, object closure)56 int PyFunction_SetClosure(object op, object closure) 57 57 # Set the closure associated with the function object op. closure 58 58 # must be Py_None or a tuple of cell objects. -
sage/ext/python_instance.pxi
r1765 r4841 7 7 # PyTypeObject PyInstance_Type 8 8 # Type object for class instances. 9 # int PyInstance_Check( PyObject *obj)9 # int PyInstance_Check(PyObject *obj) 10 10 # Return true if obj is an instance. 11 11 … … 16 16 # object's constructor. 17 17 18 object PyInstance_NewRaw( object cls, object dict)18 object PyInstance_NewRaw(object cls, object dict) 19 19 # Return value: New reference. 20 20 # Create a new instance of a specific class without calling its -
sage/ext/python_int.pxi
r1765 r4841 49 49 # exceeds LONG_MAX, a long integer object is returned. 50 50 51 long PyInt_AsLong(object io)51 long PyInt_AsLong(object io) 52 52 # Will first attempt to cast the object to a PyIntObject, if it is 53 53 # not already one, and then return its value. If there is an … … 56 56 # whether the value just happened to be -1. 57 57 58 long PyInt_AS_LONG(object io)58 long PyInt_AS_LONG(object io) 59 59 # Return the value of the object io. No error checking is performed. 60 60 61 unsigned long PyInt_AsUnsignedLongMask(object io)61 unsigned long PyInt_AsUnsignedLongMask(object io) 62 62 # Will first attempt to cast the object to a PyIntObject or 63 63 # PyLongObject, if it is not already one, and then return its … … 66 66 67 67 ctypedef unsigned long long PY_LONG_LONG 68 PY_LONG_LONG PyInt_AsUnsignedLongLongMask(object io)68 PY_LONG_LONG PyInt_AsUnsignedLongLongMask(object io) 69 69 # Will first attempt to cast the object to a PyIntObject or 70 70 # PyLongObject, if it is not already one, and then return its 71 71 # value as unsigned long long, without checking for overflow. 72 72 73 Py_ssize_t PyInt_AsSsize_t(object io)73 Py_ssize_t PyInt_AsSsize_t(object io) 74 74 # Will first attempt to cast the object to a PyIntObject or 75 75 # PyLongObject, if it is not already one, and then return its -
sage/ext/python_list.pxi
r1765 r4841 13 13 # PyList_SetItem(). 14 14 15 int PyList_Check(object p)15 int PyList_Check(object p) 16 16 # Return true if p is a list object or an instance of a subtype of the list type. 17 17 18 int PyList_CheckExact(object p)18 int PyList_CheckExact(object p) 19 19 # Return true if p is a list object, but not an instance of a subtype of the list type. 20 20 21 Py_ssize_t PyList_Size( objectlist)21 Py_ssize_t PyList_Size(object list) 22 22 # Return the length of the list object in list; this is equivalent to "len(list)" on a list object. 23 23 24 Py_ssize_t PyList_GET_SIZE( objectlist)24 Py_ssize_t PyList_GET_SIZE(object list) 25 25 # Macro form of PyList_Size() without error checking. 26 26 27 PyObject* PyList_GetItem(object list, Py_ssize_t index)27 PyObject* PyList_GetItem(object list, Py_ssize_t index) 28 28 # Return value: Borrowed reference. 29 29 # Return the object at position pos in the list pointed to by … … 32 32 # set an IndexError exception. 33 33 34 PyObject* PyList_GET_ITEM(object list, Py_ssize_t i)34 PyObject* PyList_GET_ITEM(object list, Py_ssize_t i) 35 35 # Return value: Borrowed reference. 36 36 # Macro form of PyList_GetItem() without error checking. 37 37 38 int PyList_SetItem(object list, Py_ssize_t index, objectitem)38 int PyList_SetItem(object list, Py_ssize_t index, object item) 39 39 # Set the item at index index in list to item. Return 0 on success 40 40 # or -1 on failure. Note: This function ``steals'' a reference to … … 42 42 # the affected position. 43 43 44 void PyList_SET_ITEM(object list, Py_ssize_t i, objecto)44 void PyList_SET_ITEM(object list, Py_ssize_t i, object o) 45 45 # Macro form of PyList_SetItem() without error checking. This is 46 46 # normally only used to fill in new lists where there is no … … 50 50 # position i will be *leaked*. 51 51 52 int PyList_Insert(object list, Py_ssize_t index, objectitem)52 int PyList_Insert(object list, Py_ssize_t index, object item) 53 53 # Insert the item item into list list in front of index 54 54 # index. Return 0 if successful; return -1 and set an exception if 55 55 # unsuccessful. Analogous to list.insert(index, item). 56 56 57 int PyList_Append(object list, objectitem)57 int PyList_Append(object list, object item) 58 58 # Append the object item at the end of list list. Return 0 if 59 59 # successful; return -1 and set an exception if 60 60 # unsuccessful. Analogous to list.append(item). 61 61 62 object PyList_GetSlice(object list, Py_ssize_t low, Py_ssize_t high)62 object PyList_GetSlice(object list, Py_ssize_t low, Py_ssize_t high) 63 63 # Return value: New reference. 64 64 # Return a list of the objects in list containing the objects … … 66 66 # unsuccessful. Analogous to list[low:high]. 67 67 68 int PyList_SetSlice(object list, Py_ssize_t low, Py_ssize_t high, objectitemlist)68 int PyList_SetSlice(object list, Py_ssize_t low, Py_ssize_t high, object itemlist) 69 69 # Set the slice of list between low and high to the contents of 70 70 # itemlist. Analogous to list[low:high] = itemlist. The itemlist … … 72 72 # deletion). Return 0 on success, -1 on failure. 73 73 74 int PyList_Sort(object list)74 int PyList_Sort(object list) 75 75 # Sort the items of list in place. Return 0 on success, -1 on 76 76 # failure. This is equivalent to "list.sort()". 77 77 78 int PyList_Reverse(object list)78 int PyList_Reverse(object list) 79 79 # Reverse the items of list in place. Return 0 on success, -1 on 80 80 # failure. This is the equivalent of "list.reverse()". 81 81 82 object PyList_AsTuple(object list)82 object PyList_AsTuple(object list) 83 83 # Return value: New reference. 84 84 # Return a new tuple object containing the contents of list; -
sage/ext/python_long.pxi
r1765 r4841 12 12 # type. This is the same object as long and types.LongType. 13 13 14 int PyLong_Check( object p)14 int PyLong_Check(object p) 15 15 # Return true if its argument is a PyLongObject or a subtype of PyLongObject. 16 16 17 int PyLong_CheckExact( object p)17 int PyLong_CheckExact(object p) 18 18 # Return true if its argument is a PyLongObject, but not a subtype of PyLongObject. 19 19 20 object PyLong_FromLong( long v)20 object PyLong_FromLong(long v) 21 21 # Return value: New reference. 22 22 # Return a new PyLongObject object from v, or NULL on failure. 23 23 24 object PyLong_FromUnsignedLong( unsigned long v)24 object PyLong_FromUnsignedLong(unsigned long v) 25 25 # Return value: New reference. 26 26 # Return a new PyLongObject object from a C unsigned long, or NULL on failure. 27 27 28 object PyLong_FromLongLong( PY_LONG_LONG v)28 object PyLong_FromLongLong(PY_LONG_LONG v) 29 29 # Return value: New reference. 30 30 # Return a new PyLongObject object from a C long long, or NULL on failure. 31 31 32 32 object PyLong_FromUnsignedLongLong(PY_LONG_LONG v) 33 #PyObject* PyLong_FromUnsignedLongLong( unsigned PY_LONG_LONG v)33 #PyObject* PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG v) 34 34 # Return value: New reference. 35 35 # Return a new PyLongObject object from a C unsigned long long, or NULL on failure. 36 36 37 object PyLong_FromDouble( double v)37 object PyLong_FromDouble(double v) 38 38 # Return value: New reference. 39 39 # Return a new PyLongObject object from the integer part of v, or NULL on failure. 40 40 41 object PyLong_FromString( char *str, char **pend, int base)41 object PyLong_FromString(char *str, char **pend, int base) 42 42 # Return value: New reference. 43 43 # Return a new PyLongObject based on the string value in str, … … 53 53 54 54 55 # object PyLong_FromUnicode( Py_UNICODE *u, Py_ssize_t length, int base)55 # object PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) 56 56 # Return value: New reference. 57 57 # Convert a sequence of Unicode digits to a Python long integer … … 62 62 # raised. 63 63 64 object PyLong_FromVoidPtr( void *p)64 object PyLong_FromVoidPtr(void *p) 65 65 # Return value: New reference. 66 66 # Create a Python integer or long integer from the pointer p. The … … 69 69 # positive long integer is returned. 70 70 71 long PyLong_AsLong( object pylong)71 long PyLong_AsLong(object pylong) 72 72 # Return a C long representation of the contents of pylong. If 73 73 # pylong is greater than LONG_MAX, an OverflowError is raised. 74 74 75 unsigned long PyLong_AsUnsignedLong( object pylong)75 unsigned long PyLong_AsUnsignedLong(object pylong) 76 76 # Return a C unsigned long representation of the contents of 77 77 # pylong. If pylong is greater than ULONG_MAX, an OverflowError is 78 78 # raised. 79 79 80 PY_LONG_LONG PyLong_AsLongLong( object pylong)80 PY_LONG_LONG PyLong_AsLongLong(object pylong) 81 81 # Return a C long long from a Python long integer. If pylong 82 82 # cannot be represented as a long long, an OverflowError will be 83 83 # raised. 84 84 85 PY_LONG_LONG PyLong_AsUnsignedLongLong( object pylong)86 #unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong( object pylong)85 PY_LONG_LONG PyLong_AsUnsignedLongLong(object pylong) 86 #unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(object pylong) 87 87 # Return a C unsigned long long from a Python long integer. If 88 88 # pylong cannot be represented as an unsigned long long, an … … 90 90 # TypeError will be raised if the value is negative. 91 91 92 unsigned long PyLong_AsUnsignedLongMask( object io)92 unsigned long PyLong_AsUnsignedLongMask(object io) 93 93 # Return a C unsigned long from a Python long integer, without 94 94 # checking for overflow. 95 95 96 PY_LONG_LONG PyLong_AsUnsignedLongLongMask( object io)97 #unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask( object io)96 PY_LONG_LONG PyLong_AsUnsignedLongLongMask(object io) 97 #unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(object io) 98 98 # Return a C unsigned long long from a Python long integer, 99 99 # without checking for overflow. 100 100 101 101 102 double PyLong_AsDouble( object pylong)102 double PyLong_AsDouble(object pylong) 103 103 # Return a C double representation of the contents of pylong. If 104 104 # pylong cannot be approximately represented as a double, an 105 105 # OverflowError exception is raised and -1.0 will be returned. 106 106 107 void* PyLong_AsVoidPtr( object pylong)107 void* PyLong_AsVoidPtr(object pylong) 108 108 # Convert a Python integer or long integer pylong to a C void 109 109 # pointer. If pylong cannot be converted, an OverflowError will be -
sage/ext/python_mapping.pxi
r1765 r4841 6 6 ############################################################################ 7 7 8 int PyMapping_Check( object o)8 int PyMapping_Check(object o) 9 9 # Return 1 if the object provides mapping protocol, and 0 10 10 # otherwise. This function always succeeds. 11 11 12 Py_ssize_t PyMapping_Length( object o)12 Py_ssize_t PyMapping_Length(object o) 13 13 # Returns the number of keys in object o on success, and -1 on 14 14 # failure. For objects that do not provide mapping protocol, this 15 15 # is equivalent to the Python expression "len(o)". 16 16 17 int PyMapping_DelItemString( object o, char *key)17 int PyMapping_DelItemString(object o, char *key) 18 18 # Remove the mapping for object key from the object o. Return -1 19 19 # on failure. This is equivalent to the Python statement "del 20 20 # o[key]". 21 21 22 int PyMapping_DelItem( object o, object key)22 int PyMapping_DelItem(object o, object key) 23 23 # Remove the mapping for object key from the object o. Return -1 24 24 # on failure. This is equivalent to the Python statement "del 25 25 # o[key]". 26 26 27 int PyMapping_HasKeyString( object o, char *key)27 int PyMapping_HasKeyString(object o, char *key) 28 28 # On success, return 1 if the mapping object has the key key and 0 29 29 # otherwise. This is equivalent to the Python expression 30 30 # "o.has_key(key)". This function always succeeds. 31 31 32 int PyMapping_HasKey( object o, object key)32 int PyMapping_HasKey(object o, object key) 33 33 # Return 1 if the mapping object has the key key and 0 34 34 # otherwise. This is equivalent to the Python expression 35 35 # "o.has_key(key)". This function always succeeds. 36 36 37 object PyMapping_Keys( object o)37 object PyMapping_Keys(object o) 38 38 # Return value: New reference. 39 39 # On success, return a list of the keys in object o. On failure, … … 41 41 # "o.keys()". 42 42 43 object PyMapping_Values( object o)43 object PyMapping_Values(object o) 44 44 # Return value: New reference. 45 45 # On success, return a list of the values in object o. On failure, … … 47 47 # "o.values()". 48 48 49 object PyMapping_Items( object o)49 object PyMapping_Items(object o) 50 50 # Return value: New reference. 51 51 # On success, return a list of the items in object o, where each … … 53 53 # NULL. This is equivalent to the Python expression "o.items()". 54 54 55 object PyMapping_GetItemString( object o, char *key)55 object PyMapping_GetItemString(object o, char *key) 56 56 # Return value: New reference. 57 57 # Return element of o corresponding to the object key or NULL on … … 59 59 # "o[key]". 60 60 61 int PyMapping_SetItemString( object o, char *key, object v)61 int PyMapping_SetItemString(object o, char *key, object v) 62 62 # Map the object key to the value v in object o. Returns -1 on 63 63 # failure. This is the equivalent of the Python statement "o[key] -
sage/ext/python_mem.pxi
r1765 r4841 29 29 # heap: 30 30 31 void* PyMem_Malloc( size_t n)31 void* PyMem_Malloc(size_t n) 32 32 # Allocates n bytes and returns a pointer of type void* to the 33 33 # allocated memory, or NULL if the request fails. Requesting zero … … 36 36 # have been initialized in any way. 37 37 38 void* PyMem_Realloc( void *p, size_t n)38 void* PyMem_Realloc(void *p, size_t n) 39 39 # Resizes the memory block pointed to by p to n bytes. The 40 40 # contents will be unchanged to the minimum of the old and the new … … 45 45 # PyMem_Malloc() or PyMem_Realloc(). 46 46 47 void PyMem_Free( void *p)47 void PyMem_Free(void *p) 48 48 # Frees the memory block pointed to by p, which must have been 49 49 # returned by a previous call to PyMem_Malloc() or … … 55 55 # convenience. Note that TYPE refers to any C type. 56 56 57 # TYPE* PyMem_New( TYPE, size_t n)57 # TYPE* PyMem_New(TYPE, size_t n) 58 58 # Same as PyMem_Malloc(), but allocates (n * sizeof(TYPE)) bytes 59 59 # of memory. Returns a pointer cast to TYPE*. The memory will not 60 60 # have been initialized in any way. 61 61 62 # TYPE* PyMem_Resize( void *p, TYPE, size_t n)62 # TYPE* PyMem_Resize(void *p, TYPE, size_t n) 63 63 # Same as PyMem_Realloc(), but the memory block is resized to (n * 64 64 # sizeof(TYPE)) bytes. Returns a pointer cast to TYPE*. 65 65 66 void PyMem_Del( void *p)66 void PyMem_Del(void *p) 67 67 # Same as PyMem_Free(). 68 68 -
sage/ext/python_method.pxi
r1765 r4841 9 9 # This instance of PyTypeObject represents the Python method type. This is exposed to Python programs as types.MethodType. 10 10 11 int PyMethod_Check( object o)11 int PyMethod_Check(object o) 12 12 # Return true if o is a method object (has type 13 13 # PyMethod_Type). The parameter must not be NULL. 14 14 15 object PyMethod_New( object func, object self, object cls)15 object PyMethod_New(object func, object self, object cls) 16 16 # Return value: New reference. 17 17 # Return a new method object, with func being any callable object; … … 22 22 # which provides the unbound method.. 23 23 24 PyObject* PyMethod_Class( object meth)24 PyObject* PyMethod_Class(object meth) 25 25 # Return value: Borrowed reference. 26 26 # Return the class object from which the method meth was created; … … 28 28 # the instance. 29 29 30 PyObject* PyMethod_GET_CLASS( object meth)30 PyObject* PyMethod_GET_CLASS(object meth) 31 31 # Return value: Borrowed reference. 32 32 # Macro version of PyMethod_Class() which avoids error checking. 33 33 34 PyObject* PyMethod_Function( object meth)34 PyObject* PyMethod_Function(object meth) 35 35 # Return value: Borrowed reference. 36 36 # Return the function object associated with the method meth. 37 37 38 PyObject* PyMethod_GET_FUNCTION( object meth)38 PyObject* PyMethod_GET_FUNCTION(object meth) 39 39 # Return value: Borrowed reference. 40 40 # Macro version of PyMethod_Function() which avoids error checking. 41 41 42 PyObject* PyMethod_Self( object meth)42 PyObject* PyMethod_Self(object meth) 43 43 # Return value: Borrowed reference. 44 44 # Return the instance associated with the method meth if it is bound, otherwise return NULL. 45 45 46 PyObject* PyMethod_GET_SELF( object meth)46 PyObject* PyMethod_GET_SELF(object meth) 47 47 # Return value: Borrowed reference. 48 48 # Macro version of PyMethod_Self() which avoids error checking. -
sage/ext/python_module.pxi
r1765 r4841 6 6 # 5.3 Importing Modules 7 7 ##################################################################### 8 object PyImport_ImportModule( char *name)8 object PyImport_ImportModule(char *name) 9 9 # Return value: New reference. 10 10 # This is a simplified interface to PyImport_ImportModuleEx() … … 20 20 # with an exception set on failure. 21 21 22 object PyImport_ImportModuleEx( char *name, object globals, object locals, object fromlist)22 object PyImport_ImportModuleEx(char *name, object globals, object locals, object fromlist) 23 23 # Return value: New reference. 24 24 … … 35 35 # failing imports remove incomplete module objects. 36 36 37 object PyImport_Import( object name)37 object PyImport_Import(object name) 38 38 # Return value: New reference. 39 39 # This is a higher-level interface that calls the current ``import … … 43 43 # environment, e.g. by rexec or ihooks. 44 44 45 object PyImport_ReloadModule( object m)45 object PyImport_ReloadModule(object m) 46 46 # Return value: New reference. 47 47 # Reload a module. This is best described by referring to the … … 51 51 # (the module still exists in this case). 52 52 53 PyObject* PyImport_AddModule( char *name)53 PyObject* PyImport_AddModule(char *name) 54 54 # Return value: Borrowed reference. 55 55 # Return the module object corresponding to a module name. The … … 64 64 # present. 65 65 66 object PyImport_ExecCodeModule( char *name, object co)66 object PyImport_ExecCodeModule(char *name, object co) 67 67 # Return value: New reference. 68 68 # Given a module name (possibly of the form package.module) and a … … 85 85 86 86 87 long PyImport_GetMagicNumber( )87 long PyImport_GetMagicNumber() 88 88 # Return the magic number for Python bytecode files (a.k.a. .pyc 89 89 # and .pyo files). The magic number should be present in the first 90 90 # four bytes of the bytecode file, in little-endian byte order. 91 91 92 PyObject* PyImport_GetModuleDict( )92 PyObject* PyImport_GetModuleDict() 93 93 # Return value: Borrowed reference. 94 94 # Return the dictionary used for the module administration … … 97 97 98 98 99 int PyImport_ImportFrozenModule( char *name)99 int PyImport_ImportFrozenModule(char *name) 100 100 # Load a frozen module named name. Return 1 for success, 0 if the 101 101 # module is not found, and -1 with an exception set if the … … 123 123 # type. This is exposed to Python programs as types.ModuleType. 124 124 125 int PyModule_Check( object p)125 int PyModule_Check(object p) 126 126 # Return true if p is a module object, or a subtype of a module 127 127 # object. 128 128 129 int PyModule_CheckExact( object p)129 int PyModule_CheckExact(object p) 130 130 # Return true if p is a module object, but not a subtype of PyModule_Type. 131 131 132 object PyModule_New( char *name)132 object PyModule_New( char *name) 133 133 # Return value: New reference. 134 134 # Return a new module object with the __name__ attribute set to … … 137 137 # attribute. 138 138 139 PyObject* PyModule_GetDict( object module)139 PyObject* PyModule_GetDict(object module) 140 140 # Return value: Borrowed reference. 141 141 # Return the dictionary object that implements module's namespace; … … 145 145 # directly manipulate a module's __dict__. 146 146 147 char* PyModule_GetName( object module)147 char* PyModule_GetName(object module) 148 148 # Return module's __name__ value. If the module does not provide 149 149 # one, or if it is not a string, SystemError is raised and NULL is 150 150 # returned. 151 151 152 char* PyModule_GetFilename( object module)152 char* PyModule_GetFilename(object module) 153 153 # Return the name of the file from which module was loaded using 154 154 # module's __file__ attribute. If this is not defined, or if it is 155 155 # not a string, raise SystemError and return NULL. 156 156 157 int PyModule_AddObject( object module, char *name, object value)157 int PyModule_AddObject(object module, char *name, object value) 158 158 # Add an object to module as name. This is a convenience function 159 159 # which can be used from the module's initialization … … 161 161 # 0 on success. 162 162 163 int PyModule_AddIntant( object module, char *name, long value)163 int PyModule_AddIntant(object module, char *name, long value) 164 164 # Add an integer ant to module as name. This convenience 165 165 # function can be used from the module's initialization 166 166 # function. Return -1 on error, 0 on success. 167 167 168 int PyModule_AddStringant( object module, char *name, char *value)168 int PyModule_AddStringant(object module, char *name, char *value) 169 169 # Add a string constant to module as name. This convenience 170 170 # function can be used from the module's initialization -
sage/ext/python_number.pxi
r1766 r4841 9 9 ##################################################################### 10 10 11 int PyNumber_Check( object o)11 int PyNumber_Check(object o) 12 12 # Returns 1 if the object o provides numeric protocols, and false 13 13 # otherwise. This function always succeeds. 14 14 15 object PyNumber_Add( object o1, object o2)15 object PyNumber_Add(object o1, object o2) 16 16 # Return value: New reference. 17 17 # Returns the result of adding o1 and o2, or NULL on failure. This 18 18 # is the equivalent of the Python expression "o1 + o2". 19 19 20 object PyNumber_Subtract( object o1, object o2)20 object PyNumber_Subtract(object o1, object o2) 21 21 # Return value: New reference. 22 22 # Returns the result of subtracting o2 from o1, or NULL on … … 24 24 # o2". 25 25 26 object PyNumber_Multiply( object o1, object o2)26 object PyNumber_Multiply(object o1, object o2) 27 27 # Return value: New reference. 28 28 # Returns the result of multiplying o1 and o2, or NULL on … … 30 30 # o2". 31 31 32 object PyNumber_Divide( object o1, object o2)32 object PyNumber_Divide(object o1, object o2) 33 33 # Return value: New reference. 34 34 # Returns the result of dividing o1 by o2, or NULL on … … 36 36 # o2". 37 37 38 object PyNumber_FloorDivide( object o1, object o2)38 object PyNumber_FloorDivide(object o1, object o2) 39 39 # Return value: New reference. 40 40 # Return the floor of o1 divided by o2, or NULL on failure. This 41 41 # is equivalent to the ``classic'' division of integers. 42 42 43 object PyNumber_TrueDivide( object o1, object o2)43 object PyNumber_TrueDivide(object o1, object o2) 44 44 # Return value: New reference. 45 45 # Return a reasonable approximation for the mathematical value of … … 50 50 # passed two integers. 51 51 52 object PyNumber_Remainder( object o1, object o2)52 object PyNumber_Remainder(object o1, object o2) 53 53 # Return value: New reference. 54 54 # Returns the remainder of dividing o1 by o2, or NULL on … … 56 56 # o2". 57 57 58 object PyNumber_Divmod( object o1, object o2)58 object PyNumber_Divmod(object o1, object o2) 59 59 # Return value: New reference. 60 60 # See the built-in function divmod(). Returns NULL on … … 62 62 # "divmod(o1, o2)". 63 63 64 object PyNumber_Power( object o1, object o2, object o3)64 object PyNumber_Power(object o1, object o2, object o3) 65 65 # Return value: New reference. 66 66 # See the built-in function pow(). Returns NULL on failure. This … … 70 70 # access). 71 71 72 object PyNumber_Negative( object o)72 object PyNumber_Negative(object o) 73 73 # Return value: New reference. 74 74 # Returns the negation of o on success, or NULL on failure. This 75 75 # is the equivalent of the Python expression "-o". 76 76 77 object PyNumber_Positive( object o)77 object PyNumber_Positive(object o) 78 78 # Return value: New reference. 79 79 # Returns o on success, or NULL on failure. This is the equivalent 80 80 # of the Python expression "+o". 81 81 82 object PyNumber_Absolute( object o)82 object PyNumber_Absolute(object o) 83 83 # Return value: New reference. 84 84 # Returns the absolute value of o, or NULL on failure. This is the 85 85 # equivalent of the Python expression "abs(o)". 86 86 87 object PyNumber_Invert( object o)87 object PyNumber_Invert(object o) 88 88 # Return value: New reference. 89 89 # Returns the bitwise negation of o on success, or NULL on 90 90 # failure. This is the equivalent of the Python expression "~o". 91 91 92 object PyNumber_Lshift( object o1, object o2)92 object PyNumber_Lshift(object o1, object o2) 93 93 # Return value: New reference. 94 94 # Returns the result of left shifting o1 by o2 on success, or NULL … … 96 96 # << o2". 97 97 98 object PyNumber_Rshift( object o1, object o2)98 object PyNumber_Rshift(object o1, object o2) 99 99 # Return value: New reference. 100 100 # Returns the result of right shifting o1 by o2 on success, or … … 102 102 # "o1 >> o2". 103 103 104 object PyNumber_And( object o1, object o2)104 object PyNumber_And(object o1, object o2) 105 105 # Return value: New reference. 106 106 # Returns the ``bitwise and'' of o1 and o2 on success and NULL on … … 108 108 # o2". 109 109 110 object PyNumber_Xor( object o1, object o2)110 object PyNumber_Xor(object o1, object o2) 111 111 # Return value: New reference. 112 112 # Returns the ``bitwise exclusive or'' of o1 by o2 on success, or … … 114 114 # "o1 ^ o2". 115 115 116 object PyNumber_Or( object o1, object o2)116 object PyNumber_Or(object o1, object o2) 117 117 # Return value: New reference. 118 118 # Returns the ``bitwise or'' of o1 and o2 on success, or NULL on failure. This is the equivalent of the Python expression "o1 | o2". 119 119 120 object PyNumber_InPlaceAdd( object o1, object o2)120 object PyNumber_InPlaceAdd(object o1, object o2) 121 121 # Return value: New reference. 122 122 # Returns the result of adding o1 and o2, or NULL on failure. The … … 124 124 # equivalent of the Python statement "o1 += o2". 125 125 126 object PyNumber_InPlaceSubtract( object o1, object o2)126 object PyNumber_InPlaceSubtract(object o1, object o2) 127 127 # Return value: New reference. 128 128 # Returns the result of subtracting o2 from o1, or NULL on … … 130 130 # it. This is the equivalent of the Python statement "o1 -= o2". 131 131 132 object PyNumber_InPlaceMultiply( object o1, object o2)132 object PyNumber_InPlaceMultiply(object o1, object o2) 133 133 # Return value: New reference. 134 134 # Returns the result of multiplying o1 and o2, or NULL on … … 136 136 # it. This is the equivalent of the Python statement "o1 *= o2". 137 137 138 object PyNumber_InPlaceDivide( object o1, object o2)138 object PyNumber_InPlaceDivide(object o1, object o2) 139 139 # Return value: New reference. 140 140 # Returns the result of dividing o1 by o2, or NULL on failure. The … … 142 142 # equivalent of the Python statement "o1 /= o2". 143 143 144 object PyNumber_InPlaceFloorDivide( object o1, object o2)144 object PyNumber_InPlaceFloorDivide(object o1, object o2) 145 145 # Return value: New reference. 146 146 # Returns the mathematical floor of dividing o1 by o2, or NULL on … … 149 149 # o2". 150 150 151 object PyNumber_InPlaceTrueDivide( object o1, object o2)151 object PyNumber_InPlaceTrueDivide(object o1, object o2) 152 152 # Return value: New reference. 153 153 # Return a reasonable approximation for the mathematical value of … … 159 159 # supports it. 160 160 161 object PyNumber_InPlaceRemainder( object o1, object o2)161 object PyNumber_InPlaceRemainder(object o1, object o2) 162 162 # Return value: New reference. 163 163 # Returns the remainder of dividing o1 by o2, or NULL on … … 165 165 # it. This is the equivalent of the Python statement "o1 %= o2". 166 166 167 object PyNumber_InPlacePower( object o1, object o2, object o3)167 object PyNumber_InPlacePower(object o1, object o2, object o3) 168 168 # Return value: New reference. 169 169 # See the built-in function pow(). Returns NULL on failure. The … … 174 174 # (passing NULL for o3 would cause an illegal memory access). 175 175 176 object PyNumber_InPlaceLshift( object o1, object o2)176 object PyNumber_InPlaceLshift(object o1, object o2) 177 177 # Return value: New reference. 178 178 # Returns the result of left shifting o1 by o2 on success, or NULL … … 180 180 # it. This is the equivalent of the Python statement "o1 <<= o2". 181 181 182 object PyNumber_InPlaceRshift( object o1, object o2)182 object PyNumber_InPlaceRshift(object o1, object o2) 183 183 # Return value: New reference. 184 184 # Returns the result of right shifting o1 by o2 on success, or … … 186 186 # it. This is the equivalent of the Python statement "o1 >>= o2". 187 187 188 object PyNumber_InPlaceAnd( object o1, object o2)188 object PyNumber_InPlaceAnd(object o1, object o2) 189 189 # Return value: New reference. 190 190 # Returns the ``bitwise and'' of o1 and o2 on success and NULL on … … 192 192 # it. This is the equivalent of the Python statement "o1 &= o2". 193 193 194 object PyNumber_InPlaceXor( object o1, object o2)194 object PyNumber_InPlaceXor(object o1, object o2) 195 195 # Return value: New reference. 196 196 # Returns the ``bitwise exclusive or'' of o1 by o2 on success, or … … 198 198 # it. This is the equivalent of the Python statement "o1 ^= o2". 199 199 200 object PyNumber_InPlaceOr( object o1, object o2)200 object PyNumber_InPlaceOr(object o1, object o2) 201 201 # Return value: New reference. 202 202 # Returns the ``bitwise or'' of o1 and o2 on success, or NULL on … … 216 216 # o2)". 217 217 218 object PyNumber_Int( object o)218 object PyNumber_Int(object o) 219 219 # Return value: New reference. 220 220 # Returns the o converted to an integer object on success, or NULL … … 223 223 # Python expression "int(o)". 224 224 225 object PyNumber_Long( object o)225 object PyNumber_Long(object o) 226 226 # Return value: New reference. 227 227 # Returns the o converted to a long integer object on success, or … … 229 229 # "long(o)". 230 230 231 object PyNumber_Float( object o)231 object PyNumber_Float(object o) 232 232 # Return value: New reference. 233 233 # Returns the o converted to a float object on success, or NULL on … … 235 235 # "float(o)". 236 236 237 object PyNumber_Index( object o)237 object PyNumber_Index(object o) 238 238 # Returns the o converted to a Python int or long on success or 239 239 # NULL with a TypeError exception raised on failure. 240 240 241 Py_ssize_t PyNumber_AsSsize_t( object o, object exc)241 Py_ssize_t PyNumber_AsSsize_t(object o, object exc) 242 242 # Returns o converted to a Py_ssize_t value if o can be 243 243 # interpreted as an integer. If o can be converted to a Python int … … 249 249 # integer or PY_SSIZE_T_MAX for a positive integer. 250 250 251 int PyIndex_Check( object o)251 int PyIndex_Check(object o) 252 252 # Returns True if o is an index integer (has the nb_index slot of the tp_as_number structure filled in). -
sage/ext/python_object.pxi
r1818 r4841 7 7 # 6.1 Object Protocol 8 8 ##################################################################### 9 int PyObject_Print( object o, FILE *fp, int flags)9 int PyObject_Print(object o, FILE *fp, int flags) 10 10 # Print an object o, on file fp. Returns -1 on error. The flags 11 11 # argument is used to enable certain printing options. The only … … 13 13 # of the object is written instead of the repr(). 14 14 15 int PyObject_HasAttrString( object o, char *attr_name)15 int PyObject_HasAttrString(object o, char *attr_name) 16 16 # Returns 1 if o has the attribute attr_name, and 0 17 17 # otherwise. This is equivalent to the Python expression 18 18 # "hasattr(o, attr_name)". This function always succeeds. 19 19 20 object PyObject_GetAttrString( object o, char *attr_name)20 object PyObject_GetAttrString(object o, char *attr_name) 21 21 # Return value: New reference. Retrieve an attribute named 22 22 # attr_name from object o. Returns the attribute value on success, … … 24 24 # expression "o.attr_name". 25 25 26 int PyObject_HasAttr( object o, object attr_name)26 int PyObject_HasAttr(object o, object attr_name) 27 27 # Returns 1 if o has the attribute attr_name, and 0 28 28 # otherwise. This is equivalent to the Python expression 29 29 # "hasattr(o, attr_name)". This function always succeeds. 30 30 31 object PyObject_GetAttr( object o, object attr_name)31 object PyObject_GetAttr(object o, object attr_name) 32 32 # Return value: New reference. Retrieve an attribute named 33 33 # attr_name from object o. Returns the attribute value on success, … … 35 35 # expression "o.attr_name". 36 36 37 int PyObject_SetAttrString( object o, char *attr_name, object v)37 int PyObject_SetAttrString(object o, char *attr_name, object v) 38 38 # Set the value of the attribute named attr_name, for object o, to 39 39 # the value v. Returns -1 on failure. This is the equivalent of 40 40 # the Python statement "o.attr_name = v". 41 41 42 int PyObject_SetAttr( object o, object attr_name, object v)42 int PyObject_SetAttr(object o, object attr_name, object v) 43 43 # Set the value of the attribute named attr_name, for object o, to 44 44 # the value v. Returns -1 on failure. This is the equivalent of 45 45 # the Python statement "o.attr_name = v". 46 46 47 int PyObject_DelAttrString( object o, char *attr_name)47 int PyObject_DelAttrString(object o, char *attr_name) 48 48 # Delete attribute named attr_name, for object o. Returns -1 on 49 49 # failure. This is the equivalent of the Python statement: "del 50 50 # o.attr_name". 51 51 52 int PyObject_DelAttr( object o, object attr_name)52 int PyObject_DelAttr(object o, object attr_name) 53 53 # Delete attribute named attr_name, for object o. Returns -1 on 54 54 # failure. This is the equivalent of the Python statement "del 55 55 # o.attr_name". 56 56 57 object PyObject_RichCompare( object o1, object o2, int opid)57 object PyObject_RichCompare(object o1, object o2, int opid) 58 58 # Return value: New reference. 59 59 # Compare the values of o1 and o2 using the operation specified by … … 65 65 # failure. 66 66 67 int PyObject_RichCompareBool( object o1, object o2, int opid)67 int PyObject_RichCompareBool(object o1, object o2, int opid) 68 68 # Compare the values of o1 and o2 using the operation specified by 69 69 # opid, which must be one of Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, or … … 73 73 # op o2", where op is the operator corresponding to opid. 74 74 75 int PyObject_Cmp( object o1, object o2, int *result)75 int PyObject_Cmp(object o1, object o2, int *result) 76 76 # Compare the values of o1 and o2 using a routine provided by o1, 77 77 # if one exists, otherwise with a routine provided by o2. The … … 80 80 # = cmp(o1, o2)". 81 81 82 int PyObject_Compare( object o1, object o2)82 int PyObject_Compare(object o1, object o2) 83 83 # Compare the values of o1 and o2 using a routine provided by o1, 84 84 # if one exists, otherwise with a routine provided by o2. Returns … … 88 88 # o2)". 89 89 90 object PyObject_Repr( object o)90 object PyObject_Repr(object o) 91 91 # Return value: New reference. 92 92 # Compute a string representation of object o. Returns the string … … 95 95 # repr() built-in function and by reverse quotes. 96 96 97 object PyObject_Str( object o)97 object PyObject_Str(object o) 98 98 # Return value: New reference. 99 99 # Compute a string representation of object o. Returns the string … … 102 102 # str() built-in function and by the print statement. 103 103 104 object PyObject_Unicode( object o)104 object PyObject_Unicode(object o) 105 105 # Return value: New reference. 106 106 # Compute a Unicode string representation of object o. Returns the … … 109 109 # by the unicode() built-in function. 110 110 111 int PyObject_IsInstance( object inst, object cls)111 int PyObject_IsInstance(object inst, object cls) 112 112 # Returns 1 if inst is an instance of the class cls or a subclass 113 113 # of cls, or 0 if not. On error, returns -1 and sets an … … 134 134 # considered sufficient for this determination. 135 135 136 int PyObject_IsSubclass( object derived, object cls)136 int PyObject_IsSubclass(object derived, object cls) 137 137 # Returns 1 if the class derived is identical to or derived from 138 138 # the class cls, otherwise returns 0. In case of an error, returns … … 145 145 # support a tuple as the second argument. 146 146 147 int PyCallable_Check( object o)147 int PyCallable_Check(object o) 148 148 # Determine if the object o is callable. Return 1 if the object is 149 149 # callable and 0 otherwise. This function always succeeds. 150 150 151 object PyObject_Call( object callable_object, object args, object kw)151 object PyObject_Call(object callable_object, object args, object kw) 152 152 # Return value: New reference. 153 153 # Call a callable Python object callable_object, with arguments … … 160 160 # **kw)". 161 161 162 object PyObject_CallObject( object callable_object, object args)162 object PyObject_CallObject(object callable_object, object args) 163 163 # Return value: New reference. 164 164 # Call a callable Python object callable_object, with arguments … … 168 168 # "apply(callable_object, args)" or "callable_object(*args)". 169 169 170 object PyObject_CallFunction( object callable, char *format, ...)170 object PyObject_CallFunction(object callable, char *format, ...) 171 171 # Return value: New reference. 172 172 # Call a callable Python object callable, with a variable number … … 179 179 # PyObject_CallFunctionObjArgs is a faster alternative. 180 180 181 object PyObject_CallMethod( object o, char *method, char *format, ...)181 object PyObject_CallMethod(object o, char *method, char *format, ...) 182 182 # Return value: New reference. 183 183 # Call the method named method of object o with a variable number … … 190 190 # PyObject_CallMethodObjArgs is a faster alternative. 191 191 192 #object PyObject_CallFunctionObjArgs( object callable, ..., NULL)193 object PyObject_CallFunctionObjArgs( object callable, ...)192 #object PyObject_CallFunctionObjArgs(object callable, ..., NULL) 193 object PyObject_CallFunctionObjArgs(object callable, ...) 194 194 # Return value: New reference. 195 195 # Call a callable Python object callable, with a variable number … … 198 198 # call on success, or NULL on failure. 199 199 200 #PyObject* PyObject_CallMethodObjArgs( object o, object name, ..., NULL)201 object PyObject_CallMethodObjArgs( object o, object name, ...)200 #PyObject* PyObject_CallMethodObjArgs(object o, object name, ..., NULL) 201 object PyObject_CallMethodObjArgs(object o, object name, ...) 202 202 # Return value: New reference. 203 203 # Calls a method of the object o, where the name of the method is … … 208 208 # failure. 209 209 210 long PyObject_Hash( object o)210 long PyObject_Hash(object o) 211 211 # Compute and return the hash value of an object o. On failure, 212 212 # return -1. This is the equivalent of the Python expression 213 213 # "hash(o)". 214 214 215 int PyObject_IsTrue( object o)215 int PyObject_IsTrue(object o) 216 216 # Returns 1 if the object o is considered to be true, and 0 217 217 # otherwise. This is equivalent to the Python expression "not not 218 218 # o". On failure, return -1. 219 219 220 int PyObject_Not( object o)220 int PyObject_Not(object o) 221 221 # Returns 0 if the object o is considered to be true, and 1 222 222 # otherwise. This is equivalent to the Python expression "not 223 223 # o". On failure, return -1. 224 224 225 object PyObject_Type( object o)225 object PyObject_Type(object o) 226 226 # Return value: New reference. 227 227 # When o is non-NULL, returns a type object corresponding to the … … 238 238 # type. Both parameters must be non-NULL. 239 239 240 Py_ssize_t PyObject_Length( object o)241 Py_ssize_t PyObject_Size( object o)240 Py_ssize_t PyObject_Length(object o) 241 Py_ssize_t PyObject_Size(object o) 242 242 # Return the length of object o. If the object o provides either 243 243 # the sequence and mapping protocols, the sequence length is … … 245 245 # the Python expression "len(o)". 246 246 247 object PyObject_GetItem( object o, object key)247 object PyObject_GetItem(object o, object key) 248 248 # Return value: New reference. 249 249 # Return element of o corresponding to the object key or NULL on … … 251 251 # "o[key]". 252 252 253 int PyObject_SetItem( object o, object key, object v)253 int PyObject_SetItem(object o, object key, object v) 254 254 # Map the object key to the value v. Returns -1 on failure. This 255 255 # is the equivalent of the Python statement "o[key] = v". 256 256 257 int PyObject_DelItem( object o, object key)257 int PyObject_DelItem(object o, object key) 258 258 # Delete the mapping for key from o. Returns -1 on failure. This 259 259 # is the equivalent of the Python statement "del o[key]". 260 260 261 int PyObject_AsFileDescriptor( object o)261 int PyObject_AsFileDescriptor(object o) 262 262 # Derives a file-descriptor from a Python object. If the object is 263 263 # an integer or long integer, its value is returned. If not, the … … 266 266 # descriptor value. Returns -1 on failure. 267 267 268 object PyObject_Dir( object o)268 object PyObject_Dir(object o) 269 269 # Return value: New reference. 270 270 # This is equivalent to the Python expression "dir(o)", returning … … 276 276 # false. 277 277 278 object PyObject_GetIter( object o)278 object PyObject_GetIter(object o) 279 279 # Return value: New reference. 280 280 # This is equivalent to the Python expression "iter(o)". It -
sage/ext/python_parse.pxi
r1765 r4841 5 5 ##################################################################### 6 6 ctypedef struct va_list 7 int PyArg_ParseTuple( PyObject *args, char *format, ...)8 int PyArg_VaParse( PyObject *args, char *format, va_list vargs)9 int PyArg_ParseTupleAndKeywords( PyObject *args, PyObject *kw, char *format, char *keywords[], ...)10 int PyArg_VaParseTupleAndKeywords( PyObject *args, PyObject *kw, char *format, char *keywords[], va_list vargs)11 int PyArg_Parse( PyObject *args, char *format, ...)12 int PyArg_UnpackTuple( PyObject *args, char *name, Py_ssize_t min, Py_ssize_t max, ...)7 int PyArg_ParseTuple(PyObject *args, char *format, ...) 8 int PyArg_VaParse(PyObject *args, char *format, va_list vargs) 9 int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, char *format, char *keywords[], ...) 10 int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, char *format, char *keywords[], va_list vargs) 11 int PyArg_Parse(PyObject *args, char *format, ...) 12 int PyArg_UnpackTuple(PyObject *args, char *name, Py_ssize_t min, Py_ssize_t max, ...) 13 13 -
sage/ext/python_ref.pxi
r1765 r4841 9 9 ##################################################################### 10 10 # The macros in this section are used for managing reference counts of Python objects. 11 void Py_INCREF( object o)11 void Py_INCREF(object o) 12 12 # Increment the reference count for object o. The object must not 13 13 # be NULL; if you aren't sure that it isn't NULL, use 14 14 # Py_XINCREF(). 15 15 16 void Py_XINCREF( object o)16 void Py_XINCREF(object o) 17 17 # Increment the reference count for object o. The object may be NULL, in which case the macro has no effect. 18 18 19 void Py_DECREF( object o)19 void Py_DECREF(object o) 20 20 # Decrement the reference count for object o. The object must not 21 21 # be NULL; if you aren't sure that it isn't NULL, use … … 35 35 # call Py_DECREF() for the temporary variable. 36 36 37 void Py_XDECREF( object o)37 void Py_XDECREF(object o) 38 38 # Decrement the reference count for object o. The object may be 39 39 # NULL, in which case the macro has no effect; otherwise the … … 41 41 # applies. 42 42 43 void Py_CLEAR( object o)43 void Py_CLEAR(object o) 44 44 # Decrement the reference count for object o. The object may be 45 45 # NULL, in which case the macro has no effect; otherwise the -
sage/ext/python_sequence.pxi
r1765 r4841 7 7 8 8 9 int PySequence_Check( object o)9 int PySequence_Check(object o) 10 10 # Return 1 if the object provides sequence protocol, and 0 11 11 # otherwise. This function always succeeds. 12 12 13 Py_ssize_t PySequence_Size( object o)13 Py_ssize_t PySequence_Size(object o) 14 14 # Returns the number of objects in sequence o on success, and -1 15 15 # on failure. For objects that do not provide sequence protocol, 16 16 # this is equivalent to the Python expression "len(o)". 17 17 18 Py_ssize_t PySequence_Length( object o)18 Py_ssize_t PySequence_Length(object o) 19 19 # Alternate name for PySequence_Size(). 20 20 21 object PySequence_Concat( object o1, object o2)21 object PySequence_Concat(object o1, object o2) 22 22 # Return value: New reference. 23 23 # Return the concatenation of o1 and o2 on success, and NULL on … … 25 25 # o2". 26 26 27 object PySequence_Repeat( object o, Py_ssize_t count)27 object PySequence_Repeat(object o, Py_ssize_t count) 28 28 # Return value: New reference. 29 29 # Return the result of repeating sequence object o count times, or … … 31 31 # "o * count". 32 32 33 object PySequence_InPlaceConcat( object o1, object o2)33 object PySequence_InPlaceConcat(object o1, object o2) 34 34 # Return value: New reference. 35 35 # Return the concatenation of o1 and o2 on success, and NULL on … … 37 37 # it. This is the equivalent of the Python expression "o1 += o2". 38 38 39 object PySequence_InPlaceRepeat( object o, Py_ssize_t count)39 object PySequence_InPlaceRepeat(object o, Py_ssize_t count) 40 40 # Return value: New reference. 41 41 # Return the result of repeating sequence object o count times, or … … 44 44 # count". 45 45 46 object PySequence_GetItem( object o, Py_ssize_t i)46 object PySequence_GetItem(object o, Py_ssize_t i) 47 47 # Return value: New reference. 48 48 # Return the ith element of o, or NULL on failure. This is the 49 49 # equivalent of the Python expression "o[i]". 50 50 51 object PySequence_GetSlice( object o, Py_ssize_t i1, Py_ssize_t i2)51 object PySequence_GetSlice(object o, Py_ssize_t i1, Py_ssize_t i2) 52 52 # Return value: New reference. 53 53 # Return the slice of sequence object o between i1 and i2, or NULL … … 55 55 # "o[i1:i2]". 56 56 57 int PySequence_SetItem( object o, Py_ssize_t i, object v)57 int PySequence_SetItem(object o, Py_ssize_t i, object v) 58 58 # Assign object v to the ith element of o. Returns -1 on 59 59 # failure. This is the equivalent of the Python statement "o[i] = 60 60 # v". This function does not steal a reference to v. 61 61 62 int PySequence_DelItem( object o, Py_ssize_t i)62 int PySequence_DelItem(object o, Py_ssize_t i) 63 63 # Delete the ith element of object o. Returns -1 on failure. This 64 64 # is the equivalent of the Python statement "del o[i]". 65 65 66 int PySequence_SetSlice( object o, Py_ssize_t i1, Py_ssize_t i2, object v)66 int PySequence_SetSlice(object o, Py_ssize_t i1, Py_ssize_t i2, object v) 67 67 # Assign the sequence object v to the slice in sequence object o 68 68 # from i1 to i2. This is the equivalent of the Python statement 69 69 # "o[i1:i2] = v". 70 70 71 int PySequence_DelSlice( object o, Py_ssize_t i1, Py_ssize_t i2)71 int PySequence_DelSlice(object o, Py_ssize_t i1, Py_ssize_t i2) 72 72 # Delete the slice in sequence object o from i1 to i2. Returns -1 73 73 # on failure. This is the equivalent of the Python statement "del 74 74 # o[i1:i2]". 75 75 76 int PySequence_Count( object o, object value)76 int PySequence_Count(object o, object value) 77 77 # Return the number of occurrences of value in o, that is, return 78 78 # the number of keys for which o[key] == value. On failure, return … … 80 80 # "o.count(value)". 81 81 82 int PySequence_Contains( object o, object value)82 int PySequence_Contains(object o, object value) 83 83 # Determine if o contains value. If an item in o is equal to 84 84 # value, return 1, otherwise return 0. On error, return -1. This 85 85 # is equivalent to the Python expression "value in o". 86 86 87 int PySequence_Index( object o, object value)87 int PySequence_Index(object o, object value) 88 88 # Return the first index i for which o[i] == value. On error, 89 89 # return -1. This is equivalent to the Python expression 90 90 # "o.index(value)". 91 91 92 object PySequence_List( object o)92 object PySequence_List(object o) 93 93 # Return value: New reference. 94 94 # Return a list object with the same contents as the arbitrary 95 95 # sequence o. The returned list is guaranteed to be new. 96 96 97 object PySequence_Tuple( object o)97 object PySequence_Tuple(object o) 98 98 # Return value: New reference. 99 99 # Return a tuple object with the same contents as the arbitrary … … 103 103 # expression "tuple(o)". 104 104 105 object PySequence_Fast( object o, char *m)105 object PySequence_Fast(object o, char *m) 106 106 # Return value: New reference. 107 107 # Returns the sequence o as a tuple, unless it is already a tuple … … 111 111 # sequence, raises TypeError with m as the message text. 112 112 113 PyObject* PySequence_Fast_GET_ITEM( object o, Py_ssize_t i)113 PyObject* PySequence_Fast_GET_ITEM(object o, Py_ssize_t i) 114 114 # Return value: Borrowed reference. 115 115 # Return the ith element of o, assuming that o was returned by 116 116 # PySequence_Fast(), o is not NULL, and that i is within bounds. 117 117 118 PyObject** PySequence_Fast_ITEMS( object o)118 PyObject** PySequence_Fast_ITEMS(object o) 119 119 # Return the underlying array of PyObject pointers. Assumes that o 120 120 # was returned by PySequence_Fast() and o is not NULL. 121 121 122 object PySequence_ITEM( object o, Py_ssize_t i)122 object PySequence_ITEM(object o, Py_ssize_t i) 123 123 # Return value: New reference. 124 124 # Return the ith element of o or NULL on failure. Macro form of … … 127 127 # indices. 128 128 129 int PySequence_Fast_GET_SIZE( object o)129 int PySequence_Fast_GET_SIZE(object o) 130 130 # Returns the length of o, assuming that o was returned by 131 131 # PySequence_Fast() and that o is not NULL. The size can also be -
sage/ext/python_set.pxi
r1765 r4841 38 38 # iterable Python object. 39 39 40 int PyAnySet_Check( object p)40 int PyAnySet_Check(object p) 41 41 # Return true if p is a set object, a frozenset object, or an 42 42 # instance of a subtype. 43 43 44 int PyAnySet_CheckExact( object p)44 int PyAnySet_CheckExact(object p) 45 45 # Return true if p is a set object or a frozenset object but not 46 46 # an instance of a subtype. 47 47 48 int PyFrozenSet_CheckExact( object p)48 int PyFrozenSet_CheckExact(object p) 49 49 # Return true if p is a frozenset object but not an instance of a subtype. 50 50 51 PySet_New( object iterable)51 PySet_New(object iterable) 52 52 # Return value: New reference. 53 53 # Return a new set containing objects returned by the … … 57 57 # is also useful for copying a set (c=set(s)). 58 58 59 PyFrozenSet_New( object iterable)59 PyFrozenSet_New(object iterable) 60 60 # Return value: New reference. 61 61 # Return a new frozenset containing objects returned by the … … 66 66 # The following functions and macros are available for instances of set or frozenset or instances of their subtypes. 67 67 68 int PySet_Size( object anyset)68 int PySet_Size(object anyset) 69 69 # Return the length of a set or frozenset object. Equivalent to 70 70 # "len(anyset)". Raises a PyExc_SystemError if anyset is not a 71 71 # set, frozenset, or an instance of a subtype. 72 72 73 int PySet_GET_SIZE( object anyset)73 int PySet_GET_SIZE(object anyset) 74 74 # Macro form of PySet_Size() without error checking. 75 75 76 int PySet_Contains( object anyset, object key)76 int PySet_Contains(object anyset, object key) 77 77 # Return 1 if found, 0 if not found, and -1 if an error is 78 78 # encountered. Unlike the Python __contains__() method, this … … 85 85 # its subtypes but not for instances of frozenset or its subtypes. 86 86 87 int PySet_Add( object set, object key)87 int PySet_Add(object set, object key) 88 88 # Add key to a set instance. Does not apply to frozenset 89 89 # instances. Return 0 on success or -1 on failure. Raise a … … 92 92 # instance of set or its subtype. 93 93 94 int PySet_Discard( object set, object key)94 int PySet_Discard(object set, object key) 95 95 # Return 1 if found and removed, 0 if not found (no action taken), 96 96 # and -1 if an error is encountered. Does not raise KeyError for … … 101 101 # of set or its subtype. 102 102 103 PySet_Pop( object set)103 PySet_Pop(object set) 104 104 # Return value: New reference. 105 105 # Return a new reference to an arbitrary object in the set, and … … 108 108 # not an instance of set or its subtype. 109 109 110 int PySet_Clear( object set)110 int PySet_Clear(object set) 111 111 # Empty an existing set of all elements. 112 112 -
sage/ext/python_string.pxi
r1765 r4841 15 15 # layer. 16 16 17 int PyString_Check( object o)17 int PyString_Check(object o) 18 18 # Return true if the object o is a string object or an instance of 19 19 # a subtype of the string type. 20 20 21 int PyString_CheckExact( object o)21 int PyString_CheckExact(object o) 22 22 # Return true if the object o is a string object, but not an instance of a subtype of the string type. 23 23 24 object PyString_FromString( char *v)24 object PyString_FromString(char *v) 25 25 # Return value: New reference. 26 26 # Return a new string object with the value v on success, and NULL … … 28 28 # checked. 29 29 30 object PyString_FromStringAndSize( char *v, Py_ssize_t len)30 object PyString_FromStringAndSize(char *v, Py_ssize_t len) 31 31 # Return value: New reference. 32 32 # Return a new string object with the value v and length len on … … 34 34 # string are uninitialized. 35 35 36 object PyString_FromFormat( char *format, ...)36 object PyString_FromFormat(char *format, ...) 37 37 # Return value: New reference. 38 38 # Take a C printf()-style format string and a variable number of … … 63 63 # extra arguments discarded. 64 64 65 object PyString_FromFormatV( char *format, va_list vargs)65 object PyString_FromFormatV(char *format, va_list vargs) 66 66 # Return value: New reference. 67 67 # Identical to PyString_FromFormat() except that it takes exactly two arguments. 68 68 69 Py_ssize_t PyString_Size( object string)69 Py_ssize_t PyString_Size(object string) 70 70 # Return the length of the string in string object string. 71 71 72 Py_ssize_t PyString_GET_SIZE( object string)72 Py_ssize_t PyString_GET_SIZE(object string) 73 73 # Macro form of PyString_Size() but without error checking. 74 74 75 char* PyString_AsString( object string)75 char* PyString_AsString(object string) 76 76 # Return a NUL-terminated representation of the contents of 77 77 # string. The pointer refers to the internal buffer of string, not … … 83 83 # PyString_AsString() returns NULL and raises TypeError. 84 84 85 char* PyString_AS_STRING( object string)85 char* PyString_AS_STRING(object string) 86 86 # Macro form of PyString_AsString() but without error 87 87 # checking. Only string objects are supported; no Unicode objects 88 88 # should be passed. 89 89 90 int PyString_AsStringAndSize( object obj, char **buffer, Py_ssize_t *length)90 int PyString_AsStringAndSize(object obj, char **buffer, Py_ssize_t *length) 91 91 # Return a NULL-terminated representation of the contents of the 92 92 # object obj through the output variables buffer and length. … … 106 106 # PyString_AsStringAndSize() returns -1 and raises TypeError. 107 107 108 void PyString_Concat( PyObject**string, object newpart)108 void PyString_Concat(PyObject **string, object newpart) 109 109 # Create a new string object in *string containing the contents of 110 110 # newpart appended to string; the caller will own the new … … 114 114 # be set to NULL; the appropriate exception will be set. 115 115 116 void PyString_ConcatAndDel( PyObject**string, object newpart)116 void PyString_ConcatAndDel(PyObject **string, object newpart) 117 117 # Create a new string object in *string containing the contents of 118 118 # newpart appended to string. This version decrements the 119 119 # reference count of newpart. 120 120 121 int _PyString_Resize( PyObject **string, Py_ssize_t newsize)121 int _PyString_Resize(PyObject **string, Py_ssize_t newsize) 122 122 # A way to resize a string object even though it is 123 123 # ``immutable''. Only use this to build up a brand new string … … 133 133 # returned. 134 134 135 object PyString_Format( object format, object args)135 object PyString_Format(object format, object args) 136 136 # Return value: New reference. Return a new string object from 137 137 # format and args. Analogous to format % args. The args argument 138 138 # must be a tuple. 139 139 140 void PyString_InternInPlace( PyObject**string)140 void PyString_InternInPlace(PyObject **string) 141 141 # Intern the argument *string in place. The argument must be the 142 142 # address of a pointer variable pointing to a Python string … … 151 151 # and only if you owned it before the call.) 152 152 153 object PyString_InternFromString( char *v)153 object PyString_InternFromString(char *v) 154 154 # Return value: New reference. 155 155 # A combination of PyString_FromString() and … … 158 158 # earlier interned string object with the same value. 159 159 160 object PyString_Decode( char *s, Py_ssize_t size, char *encoding, char *errors)160 object PyString_Decode(char *s, Py_ssize_t size, char *encoding, char *errors) 161 161 # Return value: New reference. 162 162 # Create an object by decoding size bytes of the encoded buffer s … … 167 167 # raised by the codec. 168 168 169 object PyString_AsDecodedObject( object str, char *encoding, char *errors)169 object PyString_AsDecodedObject(object str, char *encoding, char *errors) 170 170 # Return value: New reference. 171 171 # Decode a string object by passing it to the codec registered for … … 176 176 # raised by the codec. 177 177 178 object PyString_Encode( char *s, Py_ssize_t size, char *encoding, char *errors)178 object PyString_Encode(char *s, Py_ssize_t size, char *encoding, char *errors) 179 179 # Return value: New reference. 180 180 # Encode the char buffer of the given size by passing it to the … … 185 185 # registry. Return NULL if an exception was raised by the codec. 186 186 187 object PyString_AsEncodedObject( object str, char *encoding, char *errors)187 object PyString_AsEncodedObject(object str, char *encoding, char *errors) 188 188 # Return value: New reference. 189 189 # Encode a string object using the codec registered for encoding -
sage/ext/python_type.pxi
r1765 r4841 12 12 # as type and types.TypeType in the Python layer. 13 13 14 int PyType_Check( object o)14 int PyType_Check(object o) 15 15 # Return true if the object o is a type object, including 16 16 # instances of types derived from the standard type object. Return 17 17 # false in all other cases. 18 18 19 int PyType_CheckExact( object o)19 int PyType_CheckExact(object o) 20 20 # Return true if the object o is a type object, but not a subtype 21 21 # of the standard type object. Return false in all other 22 22 # cases. 23 23 24 int PyType_HasFeature( object o, int feature)24 int PyType_HasFeature(object o, int feature) 25 25 # Return true if the type object o sets the feature feature. Type 26 26 # features are denoted by single bit flags. 27 27 28 int PyType_IS_GC( object o)28 int PyType_IS_GC(object o) 29 29 # Return true if the type object includes support for the cycle 30 30 # detector; this tests the type flag Py_TPFLAGS_HAVE_GC. 31 31 32 int PyType_IsSubtype( object a, object b)32 int PyType_IsSubtype(object a, object b) 33 33 # Return true if a is a subtype of b. 34 34 35 object PyType_GenericAlloc( object type, Py_ssize_t nitems)35 object PyType_GenericAlloc(object type, Py_ssize_t nitems) 36 36 # Return value: New reference. 37 37 38 object PyType_GenericNew( object type, object args, object kwds)38 object PyType_GenericNew(object type, object args, object kwds) 39 39 # Return value: New reference. 40 40 41 int PyType_Ready( object type)41 int PyType_Ready(object type) 42 42 # Finalize a type object. This should be called on all type 43 43 # objects to finish their initialization. This function is
Note: See TracChangeset
for help on using the changeset viewer.
