Commit 91321622 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add "noexcept" specifications to all C API endpoints

Add a PYSTON_NOEXCEPT define that gets defined to "noexcept" in C++ mode,
and to the empty string in C mode.

I don't think 'extern "C"' implies noexcept.

This is partly for better performance when we know that a function cannot throw
an exception, but also as an annotation for us since the exception model is
the main difference between C land and Pyston land.

Vim substitution: %s/\(\<PyAPI_FUNC\>(.*).*(\([^)]\|\n\)*)\);/\1 PYSTON_NOEXCEPT;/gc
- This will catch almost all cases, except for functions not marked with PyAPI_FUNC
  and function definitions that have extra paretheses (in comments, usually)
parent 97b5b389
......@@ -100,16 +100,7 @@
extern "C" {
#endif
PyObject* Py_BuildValue(const char*, ...);
PyObject* PyString_FromString(const char*);
PyObject* PyInt_FromLong(long);
int PyDict_SetItem(PyObject* mp, PyObject* key, PyObject* item);
int PyDict_SetItemString(PyObject* mp, const char* key, PyObject* item);
PyObject* PyModule_GetDict(PyObject*);
PyObject* PyDict_New(void);
PyObject* PyModule_GetDict(PyObject*) PYSTON_NOEXCEPT;
#define PyDoc_VAR(name) static char name[]
#define PyDoc_STRVAR(name, str) PyDoc_VAR(name) = PyDoc_STR(str)
......@@ -124,15 +115,6 @@ PyObject* PyDict_New(void);
#define PYTHON_API_VERSION 1013
#define PYTHON_API_STRING "1013"
PyObject* Py_InitModule4(const char *arg0, PyMethodDef *arg1, const char *arg2, PyObject *arg3, int arg4);
#define Py_InitModule(name, methods) \
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
PYTHON_API_VERSION)
#define Py_InitModule3(name, methods, doc) \
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
PYTHON_API_VERSION)
#ifdef __cplusplus
}
#endif
......
......@@ -230,7 +230,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL)
PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result);
PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) PYSTON_NOEXCEPT;
/*
Compare the values of o1 and o2 using a routine provided by
......@@ -292,7 +292,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* Declared elsewhere
PyAPI_FUNC(int) PyCallable_Check(PyObject *o);
PyAPI_FUNC(int) PyCallable_Check(PyObject *o) PYSTON_NOEXCEPT;
Determine if the object, o, is callable. Return 1 if the
object is callable and 0 otherwise.
......@@ -304,7 +304,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object,
PyObject *args, PyObject *kw);
PyObject *args, PyObject *kw) PYSTON_NOEXCEPT;
/*
Call a callable Python object, callable_object, with
......@@ -314,7 +314,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object,
PyObject *args);
PyObject *args) PYSTON_NOEXCEPT;
/*
Call a callable Python object, callable_object, with
......@@ -326,7 +326,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object,
char *format, ...);
char *format, ...) PYSTON_NOEXCEPT;
/*
Call a callable Python object, callable_object, with a
......@@ -340,7 +340,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m,
char *format, ...);
char *format, ...) PYSTON_NOEXCEPT;
/*
Call the method named m of object o with a variable number of
......@@ -352,13 +352,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
char *format, ...);
char *format, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
char *name,
char *format, ...);
char *format, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
...);
...) PYSTON_NOEXCEPT;
/*
Call a callable Python object, callable_object, with a
......@@ -370,7 +370,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o,
PyObject *m, ...);
PyObject *m, ...) PYSTON_NOEXCEPT;
/*
Call the method named m of object o with a variable number of
......@@ -412,7 +412,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o);
PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o) PYSTON_NOEXCEPT;
/*
On success, returns a type object corresponding to the object
......@@ -420,7 +420,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
equivalent to the Python expression: type(o).
*/
PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o);
PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o) PYSTON_NOEXCEPT;
/*
Return the size of object o. If the object, o, provides
......@@ -432,10 +432,10 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* For DLL compatibility */
#undef PyObject_Length
PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o);
PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o) PYSTON_NOEXCEPT;
#define PyObject_Length PyObject_Size
PyAPI_FUNC(Py_ssize_t) _PyObject_LengthHint(PyObject *o, Py_ssize_t);
PyAPI_FUNC(Py_ssize_t) _PyObject_LengthHint(PyObject *o, Py_ssize_t) PYSTON_NOEXCEPT;
/*
Guess the size of object o using len(o) or o.__length_hint__().
......@@ -443,7 +443,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
default value. If one of the calls fails, this function returns -1.
*/
PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key);
PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key) PYSTON_NOEXCEPT;
/*
Return element of o corresponding to the object, key, or NULL
......@@ -452,7 +452,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v);
PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v) PYSTON_NOEXCEPT;
/*
Map the object, key, to the value, v. Returns
......@@ -460,7 +460,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
statement: o[key]=v.
*/
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key);
PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key) PYSTON_NOEXCEPT;
/*
Remove the mapping for object, key, from the object *o.
......@@ -468,7 +468,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
the Python statement: del o[key].
*/
PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key);
PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key) PYSTON_NOEXCEPT;
/*
Delete the mapping for key from *o. Returns -1 on failure.
......@@ -477,7 +477,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj,
const char **buffer,
Py_ssize_t *buffer_len);
Py_ssize_t *buffer_len) PYSTON_NOEXCEPT;
/*
Takes an arbitrary object which must support the (character,
......@@ -491,7 +491,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj) PYSTON_NOEXCEPT;
/*
Checks whether an arbitrary object supports the (character,
......@@ -502,7 +502,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
const void **buffer,
Py_ssize_t *buffer_len);
Py_ssize_t *buffer_len) PYSTON_NOEXCEPT;
/*
Same as PyObject_AsCharBuffer() except that this API expects
......@@ -518,7 +518,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
void **buffer,
Py_ssize_t *buffer_len);
Py_ssize_t *buffer_len) PYSTON_NOEXCEPT;
/*
Takes an arbitrary object which must support the (writeable,
......@@ -542,7 +542,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
return 0 */
PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
int flags) PYSTON_NOEXCEPT;
/* This is a C-API version of the getbuffer function call. It checks
to make sure object has the required function pointer and issues the
......@@ -551,13 +551,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices);
PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices) PYSTON_NOEXCEPT;
/* Get the memory area pointed to by the indices for the buffer given.
Note that view->ndim is the assumed size of indices
*/
PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *);
PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *) PYSTON_NOEXCEPT;
/* Return the implied itemsize of the data-format area from a
struct-style description */
......@@ -565,10 +565,10 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view,
Py_ssize_t len, char fort);
Py_ssize_t len, char fort) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf,
Py_ssize_t len, char fort);
Py_ssize_t len, char fort) PYSTON_NOEXCEPT;
/* Copy len bytes of data from the contiguous chunk of memory
......@@ -587,19 +587,19 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src);
PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src) PYSTON_NOEXCEPT;
/* Copy the data from the src buffer to the buffer of destination
*/
PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort);
PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
Py_ssize_t *shape,
Py_ssize_t *strides,
int itemsize,
char fort);
char fort) PYSTON_NOEXCEPT;
/* Fill the strides array with byte-strides of a contiguous
(Fortran-style if fort is 'F' or C-style otherwise)
......@@ -609,7 +609,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf,
Py_ssize_t len, int readonly,
int flags);
int flags) PYSTON_NOEXCEPT;
/* Fills in a buffer-info structure correctly for an exporter
that can only share a contiguous chunk of memory of
......@@ -617,13 +617,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
and -1 (with raising an error) on error.
*/
PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view);
PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view) PYSTON_NOEXCEPT;
/* Releases a Py_buffer obtained from getbuffer ParseTuple's s*.
*/
PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj,
PyObject *format_spec);
PyObject *format_spec) PYSTON_NOEXCEPT;
/*
Takes an arbitrary object and returns the result of
calling obj.__format__(format_spec).
......@@ -631,7 +631,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* Iterators */
PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *) PYSTON_NOEXCEPT;
/* Takes an object and returns an iterator for it.
This is typically a new iterator but if the argument
is an iterator, this returns itself. */
......@@ -641,7 +641,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
(obj)->ob_type->tp_iternext != NULL && \
(obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *) PYSTON_NOEXCEPT;
/* Takes an iterator object and calls its tp_iternext slot,
returning the next value. If the iterator is exhausted,
this returns NULL without setting an exception.
......@@ -649,7 +649,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* Number Protocol:*/
PyAPI_FUNC(int) PyNumber_Check(PyObject *o);
PyAPI_FUNC(int) PyNumber_Check(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns 1 if the object, o, provides numeric protocols, and
......@@ -659,7 +659,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of adding o1 and o2, or null on failure.
......@@ -668,7 +668,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of subtracting o2 from o1, or null on
......@@ -677,7 +677,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of multiplying o1 and o2, or null on
......@@ -687,7 +687,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of dividing o1 by o2, or null on failure.
......@@ -696,7 +696,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of dividing o1 by o2 giving an integral result,
......@@ -706,7 +706,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of dividing o1 by o2 giving a float result,
......@@ -716,7 +716,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the remainder of dividing o1 by o2, or null on
......@@ -726,7 +726,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
See the built-in function divmod. Returns NULL on failure.
......@@ -737,7 +737,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2,
PyObject *o3);
PyObject *o3) PYSTON_NOEXCEPT;
/*
See the built-in function pow. Returns NULL on failure.
......@@ -746,7 +746,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the negation of o on success, or null on failure.
......@@ -754,7 +754,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the (what?) of o on success, or NULL on failure.
......@@ -762,7 +762,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the absolute value of o, or null on failure. This is
......@@ -770,7 +770,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the bitwise negation of o on success, or NULL on
......@@ -780,7 +780,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of left shifting o1 by o2 on success, or
......@@ -790,7 +790,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of right shifting o1 by o2 on success, or
......@@ -799,7 +799,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of bitwise and of o1 and o2 on success, or
......@@ -809,7 +809,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the bitwise exclusive or of o1 by o2 on success, or
......@@ -819,7 +819,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of bitwise or on o1 and o2 on success, or
......@@ -848,7 +848,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
// Pyston change: made this a function:
bool _PyIndex_Check(PyObject* o);
PyAPI_FUNC(bool) _PyIndex_Check(PyObject* o) PYSTON_NOEXCEPT;
#define PyIndex_Check(obj) _PyIndex_Check((PyObject*)(obj))
#if 0
#define PyIndex_Check(obj) \
......@@ -857,14 +857,14 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
(obj)->ob_type->tp_as_number->nb_index != NULL)
#endif
PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the object converted to a Python long or int
or NULL with an error raised on failure.
*/
PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc);
PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc) PYSTON_NOEXCEPT;
/*
Returns the Integral instance converted to an int. The
......@@ -877,7 +877,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt(
PyObject *integral,
const char* error_format);
const char* error_format) PYSTON_NOEXCEPT;
/*
Returns the object converted to Py_ssize_t by going through
......@@ -887,7 +887,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
is cleared and the value is clipped.
*/
PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the o converted to an integer object on success, or
......@@ -896,7 +896,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the o converted to a long integer object on success,
......@@ -905,7 +905,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o);
PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the o converted to a float object on success, or NULL
......@@ -915,7 +915,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* In-place variants of (some of) the above number protocol functions */
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of adding o2 to o1, possibly in-place, or null
......@@ -924,7 +924,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of subtracting o2 from o1, possibly in-place or
......@@ -933,7 +933,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of multiplying o1 by o2, possibly in-place, or
......@@ -942,7 +942,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of dividing o1 by o2, possibly in-place, or null
......@@ -952,7 +952,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1,
PyObject *o2);
PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of dividing o1 by o2 giving an integral result,
......@@ -963,7 +963,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1,
PyObject *o2);
PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of dividing o1 by o2 giving a float result,
......@@ -973,7 +973,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the remainder of dividing o1 by o2, possibly in-place, or
......@@ -983,7 +983,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2,
PyObject *o3);
PyObject *o3) PYSTON_NOEXCEPT;
/*
Returns the result of raising o1 to the power of o2, possibly
......@@ -992,7 +992,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of left shifting o1 by o2, possibly in-place, or
......@@ -1001,7 +1001,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of right shifting o1 by o2, possibly in-place or
......@@ -1010,7 +1010,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of bitwise and of o1 and o2, possibly in-place,
......@@ -1019,7 +1019,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
......@@ -1028,7 +1028,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Returns the result of bitwise or of o1 and o2, possibly in-place,
......@@ -1038,7 +1038,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base);
PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base) PYSTON_NOEXCEPT;
/*
Returns the integer n converted to a string with a base, with a base
......@@ -1049,7 +1049,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* Sequence protocol:*/
PyAPI_FUNC(int) PySequence_Check(PyObject *o);
PyAPI_FUNC(int) PySequence_Check(PyObject *o) PYSTON_NOEXCEPT;
/*
Return 1 if the object provides sequence protocol, and zero
......@@ -1059,7 +1059,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o);
PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o) PYSTON_NOEXCEPT;
/*
Return the size of sequence object o, or -1 on failure.
......@@ -1068,11 +1068,11 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* For DLL compatibility */
#undef PySequence_Length
PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o);
PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o) PYSTON_NOEXCEPT;
#define PySequence_Length PySequence_Size
PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Return the concatenation of o1 and o2 on success, and NULL on
......@@ -1081,7 +1081,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count);
PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count) PYSTON_NOEXCEPT;
/*
Return the result of repeating sequence object o count times,
......@@ -1090,14 +1090,14 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i);
PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i) PYSTON_NOEXCEPT;
/*
Return the ith element of o, or NULL on failure. This is the
equivalent of the Python expression: o[i].
*/
PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2);
PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) PYSTON_NOEXCEPT;
/*
Return the slice of sequence object o between i1 and i2, or
......@@ -1106,7 +1106,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v);
PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v) PYSTON_NOEXCEPT;
/*
Assign object v to the ith element of o. Returns
......@@ -1115,7 +1115,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i);
PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i) PYSTON_NOEXCEPT;
/*
Delete the ith element of object v. Returns
......@@ -1124,7 +1124,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2,
PyObject *v);
PyObject *v) PYSTON_NOEXCEPT;
/*
Assign the sequence object, v, to the slice in sequence
......@@ -1132,7 +1132,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
equivalent of the Python statement: o[i1:i2]=v.
*/
PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2);
PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) PYSTON_NOEXCEPT;
/*
Delete the slice in sequence object, o, from i1 to i2.
......@@ -1140,7 +1140,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
statement: del o[i1:i2].
*/
PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o);
PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the sequence, o, as a tuple on success, and NULL on failure.
......@@ -1148,13 +1148,13 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o);
PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the sequence, o, as a list on success, and NULL on failure.
This is equivalent to the Python expression: list(o)
*/
PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m) PYSTON_NOEXCEPT;
/*
Return the sequence, o, as a list, unless it's already a
tuple or list. Use PySequence_Fast_GET_ITEM to access the
......@@ -1190,7 +1190,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* Return a pointer to the underlying item array for
an object retured by PySequence_Fast */
PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value);
PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value) PYSTON_NOEXCEPT;
/*
Return the number of occurrences on value on o, that is,
......@@ -1199,7 +1199,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
expression: o.count(value).
*/
PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob);
PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob) PYSTON_NOEXCEPT;
/*
Return -1 if error; 1 if ob in seq; 0 if ob not in seq.
Use __contains__ if possible, else _PySequence_IterSearch().
......@@ -1209,7 +1209,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
#define PY_ITERSEARCH_INDEX 2
#define PY_ITERSEARCH_CONTAINS 3
PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq,
PyObject *obj, int operation);
PyObject *obj, int operation) PYSTON_NOEXCEPT;
/*
Iterate over seq. Result depends on the operation:
PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if
......@@ -1223,7 +1223,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* For DLL-level backwards compatibility */
#undef PySequence_In
PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value);
PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value) PYSTON_NOEXCEPT;
/* For source-level backwards compatibility */
#define PySequence_In PySequence_Contains
......@@ -1234,7 +1234,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
is equivalent to the Python expression: value in o.
*/
PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value);
PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value) PYSTON_NOEXCEPT;
/*
Return the first index for which o[i]=value. On error,
......@@ -1244,7 +1244,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* In-place versions of some of the above Sequence functions. */
PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2);
PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2) PYSTON_NOEXCEPT;
/*
Append o2 to o1, in-place when possible. Return the resulting
......@@ -1253,7 +1253,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count);
PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count) PYSTON_NOEXCEPT;
/*
Repeat o1 by count, in-place when possible. Return the resulting
......@@ -1264,7 +1264,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* Mapping protocol:*/
PyAPI_FUNC(int) PyMapping_Check(PyObject *o);
PyAPI_FUNC(int) PyMapping_Check(PyObject *o) PYSTON_NOEXCEPT;
/*
Return 1 if the object provides mapping protocol, and zero
......@@ -1273,7 +1273,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
This function always succeeds.
*/
PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o);
PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o) PYSTON_NOEXCEPT;
/*
Returns the number of keys in object o on success, and -1 on
......@@ -1283,7 +1283,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
/* For DLL compatibility */
#undef PyMapping_Length
PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o);
PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o) PYSTON_NOEXCEPT;
#define PyMapping_Length PyMapping_Size
......@@ -1307,7 +1307,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K))
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key);
PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key) PYSTON_NOEXCEPT;
/*
On success, return 1 if the mapping object has the key, key,
......@@ -1317,7 +1317,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
This function always succeeds.
*/
PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key);
PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key) PYSTON_NOEXCEPT;
/*
Return 1 if the mapping object has the key, key,
......@@ -1360,7 +1360,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
#define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL)
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key);
PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key) PYSTON_NOEXCEPT;
/*
Return element of o corresponding to the object, key, or NULL
......@@ -1369,7 +1369,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key,
PyObject *value);
PyObject *value) PYSTON_NOEXCEPT;
/*
Map the object, key, to the value, v. Returns
......@@ -1378,23 +1378,23 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass);
PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass) PYSTON_NOEXCEPT;
/* isinstance(object, typeorclass) */
PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass);
PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass) PYSTON_NOEXCEPT;
/* issubclass(object, typeorclass) */
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls) PYSTON_NOEXCEPT;
/* For internal use by buffer API functions */
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
const Py_ssize_t *shape);
const Py_ssize_t *shape) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
const Py_ssize_t *shape);
const Py_ssize_t *shape) PYSTON_NOEXCEPT;
#ifdef __cplusplus
......
......@@ -36,7 +36,7 @@ PyAPI_DATA(PyObject) *True, *False;
#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
/* Function to return a bool from a C long */
PyAPI_FUNC(PyObject *) PyBool_FromLong(long);
PyAPI_FUNC(PyObject *) PyBool_FromLong(long) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -10,42 +10,42 @@ extern "C" {
/* Interface to random parts in ceval.c */
PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
PyObject *, PyObject *, PyObject *);
PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
/* Inline this */
#define PyEval_CallObject(func,arg) \
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj,
const char *format, ...);
const char *format, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
const char *methodname,
const char *format, ...);
const char *format, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *) PYSTON_NOEXCEPT;
struct _frame; /* Avoid including frameobject.h */
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void);
PyAPI_FUNC(int) PyEval_GetRestricted(void);
PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyEval_GetRestricted(void) PYSTON_NOEXCEPT;
/* Look at the current frame's (if any) code's co_flags, and turn on
the corresponding compiler flags in cf->cf_flags. Return 1 if any
flag was set, else return 0. */
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) Py_FlushLine(void);
PyAPI_FUNC(int) Py_FlushLine(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
PyAPI_FUNC(int) Py_MakePendingCalls(void);
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) Py_MakePendingCalls(void) PYSTON_NOEXCEPT;
/* Protection against deeply nested recursive calls */
PyAPI_FUNC(void) Py_SetRecursionLimit(int);
PyAPI_FUNC(int) Py_GetRecursionLimit(void);
PyAPI_FUNC(void) Py_SetRecursionLimit(int) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) Py_GetRecursionLimit(void) PYSTON_NOEXCEPT;
#define Py_EnterRecursiveCall(where) \
(_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \
......@@ -53,7 +53,7 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void);
#define Py_LeaveRecursiveCall() \
(--PyThreadState_GET()->recursion_depth)
// Pyston change: changed this to const char*
PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where);
PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where) PYSTON_NOEXCEPT;
PyAPI_DATA(int) _Py_CheckRecursionLimit;
#ifdef USE_STACKCHECK
# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit)
......@@ -61,12 +61,12 @@ PyAPI_DATA(int) _Py_CheckRecursionLimit;
# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit)
#endif
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *);
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *);
PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc);
PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc) PYSTON_NOEXCEPT;
/* this used to be handled on a per-thread basis - now just two globals */
PyAPI_DATA(volatile int) _Py_Ticker;
......@@ -117,24 +117,24 @@ PyAPI_DATA(int) _Py_CheckInterval;
mechanism!
*/
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *) PYSTON_NOEXCEPT;
#ifdef WITH_THREAD
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
PyAPI_FUNC(void) PyEval_InitThreads(void);
PyAPI_FUNC(void) PyEval_AcquireLock(void);
PyAPI_FUNC(void) PyEval_ReleaseLock(void);
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_InitThreads(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_AcquireLock(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_ReleaseLock(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyEval_ReInitThreads(void) PYSTON_NOEXCEPT;
// Pyston change: add our internal API here that doesn't make reference to PyThreadState.
// If anyone goes out of their way to use the PyThreadState* APIs directly, we should
// fail instead of assuming that they didn't care about the PyThreadState.
PyAPI_FUNC(void) beginAllowThreads(void);
PyAPI_FUNC(void) endAllowThreads(void);
PyAPI_FUNC(void) beginAllowThreads(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) endAllowThreads(void) PYSTON_NOEXCEPT;
// Pyston change: switch these to use our internal API
#define Py_BEGIN_ALLOW_THREADS { \
......@@ -153,7 +153,7 @@ PyAPI_FUNC(void) endAllowThreads(void);
#endif /* !WITH_THREAD */
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *) PYSTON_NOEXCEPT;
#ifdef __cplusplus
......
......@@ -57,15 +57,15 @@ PyAPI_DATA(PyTypeObject*) instancemethod_cls;
#define PyInstance_Check(op) (Py_TYPE(op) == &PyInstance_Type)
#define PyMethod_Check(op) (Py_TYPE(op) == &PyMethod_Type)
PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *,
PyObject *);
PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *);
PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *);
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *);
PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *) PYSTON_NOEXCEPT;
/* Look up attribute with name (a string) on instance object pinst, using
* only the instance and base class dicts. If a descriptor is found in
......@@ -77,7 +77,7 @@ PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *);
* can't fail, never sets an exception, and NULL is not an error (it just
* means "not found").
*/
PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);
PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name) PYSTON_NOEXCEPT;
/* Macros for direct access to these values. Type checks are *not*
done, so use with care. */
......@@ -88,9 +88,9 @@ PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name);
#define PyMethod_GET_CLASS(meth) \
(((PyMethodObject *)meth) -> im_class)
PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);
PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
PyAPI_FUNC(int) PyMethod_ClearFreeList(void) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -23,13 +23,13 @@ typedef struct {
#define c_pow _Py_c_pow
#define c_abs _Py_c_abs
PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex);
PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex);
PyAPI_FUNC(Py_complex) c_neg(Py_complex);
PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex);
PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex);
PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex);
PyAPI_FUNC(double) c_abs(Py_complex);
PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_complex) c_neg(Py_complex) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) c_abs(Py_complex) PYSTON_NOEXCEPT;
/* Complex object interface */
......@@ -56,18 +56,18 @@ PyAPI_DATA(PyTypeObject*) complex_cls;
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op) PYSTON_NOEXCEPT;
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj,
char *format_spec,
Py_ssize_t format_spec_len);
Py_ssize_t format_spec_len) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -82,18 +82,18 @@ PyAPI_DATA(PyTypeObject) PyMemberDescr_Type;
#endif
// (Pyston TODO: add #defines to our names)
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *);
PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *,
struct PyMemberDef *);
struct PyMemberDef *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
struct PyGetSetDef *);
struct PyGetSetDef *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
struct wrapperbase *, void *);
struct wrapperbase *, void *) PYSTON_NOEXCEPT;
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *) PYSTON_NOEXCEPT;
// Pyston change: this is no longer a static object
......
// This file is originally from CPython 2.7, with modifications for Pyston
// PYSTON_NOEXCEPT This file is originally from CPython 2.7, with modifications for Pyston
#ifndef Py_DICTOBJECT_H
#define Py_DICTOBJECT_H
......@@ -121,7 +121,7 @@ PyAPI_DATA(PyTypeObject*) dictvalues_cls;
#define PyDictValues_Type (*dictvalues_cls)
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) PyDict_Check(PyObject*);
PyAPI_FUNC(bool) PyDict_Check(PyObject*) PYSTON_NOEXCEPT;
#if 0
#define PyDict_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
......@@ -134,27 +134,27 @@ PyAPI_FUNC(bool) PyDict_Check(PyObject*);
# define PyDictViewSet_Check(op) \
(PyDictKeys_Check(op) || PyDictItems_Check(op))
PyAPI_FUNC(PyObject *) PyDict_New(void);
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_New(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyDict_Next(
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash);
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp) PYSTON_NOEXCEPT;
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other) PYSTON_NOEXCEPT;
/* PyDict_Merge updates/merges from a mapping object (an object that
supports PyMapping_Keys() and PyObject_GetItem()). If override is true,
......@@ -163,7 +163,7 @@ PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
*/
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
PyObject *other,
int override);
int override) PYSTON_NOEXCEPT;
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
iterable objects of length 2. If override is true, the last occurrence
......@@ -172,11 +172,11 @@ PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
*/
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
PyObject *seq2,
int override);
int override) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
// This file is originally from CPython 2.7, with modifications for Pyston
// PYSTON_NOEXCEPT This file is originally from CPython 2.7, with modifications for Pyston
#ifndef PY_NO_SHORT_FLOAT_REPR
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr) PYSTON_NOEXCEPT;
PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
int *decpt, int *sign, char **rve);
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
int *decpt, int *sign, char **rve) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s) PYSTON_NOEXCEPT;
#ifdef __cplusplus
......
......@@ -44,21 +44,21 @@ PyAPI_DATA(PyTypeObject*) file_cls;
#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type)
#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type)
PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *);
PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int);
PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *);
PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors);
PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *,
int (*)(FILE *));
PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *);
PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *);
PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *);
PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *);
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int);
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
int (*)(FILE *)) PYSTON_NOEXCEPT;
PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *) PYSTON_NOEXCEPT;
/* The default encoding used by the platform file system APIs
If non-NULL, this is different than the default encoding for strings
......@@ -69,13 +69,13 @@ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
or \r\n as line terminators.
*/
#define PY_STDIOTEXTMODE "b"
char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *) PYSTON_NOEXCEPT;
size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *) PYSTON_NOEXCEPT;
/* A routine to do sanity checking on the file mode string. returns
non-zero on if an exception occurred
*/
int _PyFile_SanitizeMode(char *mode);
int _PyFile_SanitizeMode(char *mode) PYSTON_NOEXCEPT;
#if defined _MSC_VER && _MSC_VER >= 1400
/* A routine to check if a file descriptor is valid on Windows. Returns 0
......
......@@ -47,21 +47,21 @@ PyAPI_DATA(PyTypeObject*) float_cls;
return PyFloat_FromDouble(-Py_HUGE_VAL); \
} while(0)
PyAPI_FUNC(double) PyFloat_GetMax(void);
PyAPI_FUNC(double) PyFloat_GetMin(void);
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void);
PyAPI_FUNC(double) PyFloat_GetMax(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) PyFloat_GetMin(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void) PYSTON_NOEXCEPT;
/* Return Python float from string PyObject. Second argument ignored on
input, and, if non-NULL, NULL is stored into *junk (this tried to serve a
purpose once but can't be made to work as intended). */
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk);
PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk) PYSTON_NOEXCEPT;
/* Return Python float from C double. */
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double);
PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double) PYSTON_NOEXCEPT;
/* Extract C double from Python float. The macro version trades safety for
speed. */
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *) PYSTON_NOEXCEPT;
// Pyston changes: these aren't direct macros any more [they potentially could be though]
#define PyFloat_AS_DOUBLE(op) PyFloat_AsDouble((PyObject*)op)
//#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
......@@ -70,14 +70,14 @@ PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *);
buffer must be "big enough"; >= 100 is very safe.
PyFloat_AsReprString(buf, x) strives to print enough digits so that
PyFloat_FromString(buf) then reproduces x exactly. */
PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v);
PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v) PYSTON_NOEXCEPT;
/* Write str(v) into the char buffer argument, followed by null byte. The
buffer must be "big enough"; >= 100 is very safe. Note that it's
unusual to be able to get back the float you started with from
PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to
preserve precision across conversions. */
PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v);
PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v) PYSTON_NOEXCEPT;
/* _PyFloat_{Pack,Unpack}{4,8}
*
......@@ -111,12 +111,12 @@ PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v);
* 1): What this does is undefined if x is a NaN or infinity.
* 2): -0.0 and +0.0 produce the same string.
*/
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le);
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le);
PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le) PYSTON_NOEXCEPT;
/* Used to get the important decimal digits of a double */
PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum);
PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyFloat_DigitsInit(void) PYSTON_NOEXCEPT;
/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool
* argument, true if the string is in little-endian format (exponent
......@@ -126,22 +126,22 @@ PyAPI_FUNC(void) _PyFloat_DigitsInit(void);
* OverflowError). Note that on a non-IEEE platform this will refuse
* to unpack a string that represents a NaN or infinity.
*/
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le);
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le) PYSTON_NOEXCEPT;
/* free list api */
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
PyAPI_FUNC(int) PyFloat_ClearFreeList(void) PYSTON_NOEXCEPT;
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
char *format_spec,
Py_ssize_t format_spec_len);
Py_ssize_t format_spec_len) PYSTON_NOEXCEPT;
/* Round a C double x to the closest multiple of 10**-ndigits. Returns a
Python float on success, or NULL (with an appropriate exception set) on
failure. Used in builtin_round in bltinmodule.c. */
PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits);
PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits) PYSTON_NOEXCEPT;
......
......@@ -8,41 +8,41 @@
extern "C" {
#endif
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
PyAPI_FUNC(long) PyImport_GetMagicNumber(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
char *name, PyObject *co, char *pathname);
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *);
char *name, PyObject *co, char *pathname) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
PyObject *globals, PyObject *locals, PyObject *fromlist, int level);
PyObject *globals, PyObject *locals, PyObject *fromlist, int level) PYSTON_NOEXCEPT;
#define PyImport_ImportModuleEx(n, g, l, f) \
PyImport_ImportModuleLevel(n, g, l, f, -1)
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
PyAPI_FUNC(void) PyImport_Cleanup(void);
PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyImport_Cleanup(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *) PYSTON_NOEXCEPT;
#ifdef WITH_THREAD
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
PyAPI_FUNC(void) _PyImport_AcquireLock(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyImport_ReleaseLock(void) PYSTON_NOEXCEPT;
#else
#define _PyImport_AcquireLock()
#define _PyImport_ReleaseLock() 1
#endif
PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
const char *, PyObject *, char *, size_t, FILE **, PyObject **);
PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
const char *, PyObject *, char *, size_t, FILE **, PyObject **) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyImport_ReInitLock(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyImport_FindExtension(char *, char *);
PyAPI_FUNC(PyObject *) _PyImport_FixupExtension(char *, char *);
PyAPI_FUNC(PyObject *) _PyImport_FindExtension(char *, char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyImport_FixupExtension(char *, char *) PYSTON_NOEXCEPT;
struct _inittab {
char *name;
......@@ -53,8 +53,8 @@ struct _inittab {
//PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void));
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void)) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab) PYSTON_NOEXCEPT;
struct _frozen {
char *name;
......
......@@ -37,7 +37,7 @@ PyAPI_DATA(PyTypeObject*) int_cls;
#define PyInt_Type (*int_cls)
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) _PyInt_Check(PyObject*);
PyAPI_FUNC(bool) _PyInt_Check(PyObject*) PYSTON_NOEXCEPT;
#define PyInt_Check(op) _PyInt_Check((PyObject*)op)
#if 0
#define PyInt_Check(op) \
......@@ -45,22 +45,22 @@ PyAPI_FUNC(bool) _PyInt_Check(PyObject*);
#endif
#define PyInt_CheckExact(op) (Py_TYPE(op) == &PyInt_Type)
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int) PYSTON_NOEXCEPT;
#ifdef Py_USING_UNICODE
PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int) PYSTON_NOEXCEPT;
#endif
PyAPI_FUNC(PyObject *) PyInt_FromLong(long);
PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t);
PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t);
PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *);
PyAPI_FUNC(int) _PyInt_AsInt(PyObject *);
PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *);
PyAPI_FUNC(PyObject *) PyInt_FromLong(long) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(long) PyInt_AsLong(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyInt_AsInt(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *) PYSTON_NOEXCEPT;
#ifdef HAVE_LONG_LONG
PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);
PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *) PYSTON_NOEXCEPT;
#endif
PyAPI_FUNC(long) PyInt_GetMax(void);
PyAPI_FUNC(long) PyInt_GetMax(void) PYSTON_NOEXCEPT;
/* Macro, trading safety for speed */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
......@@ -73,23 +73,23 @@ PyAPI_FUNC(long) PyInt_GetMax(void);
* into the main Python shared library/DLL. Guido thinks I'm weird for
* building it this way. :-) [cjh]
*/
PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int);
PyAPI_FUNC(long) PyOS_strtol(char *, char **, int);
PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(long) PyOS_strtol(char *, char **, int) PYSTON_NOEXCEPT;
/* free list api */
PyAPI_FUNC(int) PyInt_ClearFreeList(void);
PyAPI_FUNC(int) PyInt_ClearFreeList(void) PYSTON_NOEXCEPT;
/* Convert an integer to the given base. Returns a string.
If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'.
If newstyle is zero, then use the pre-2.6 behavior of octal having
a leading "0" */
PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle);
PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle) PYSTON_NOEXCEPT;
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj,
char *format_spec,
Py_ssize_t format_spec_len);
Py_ssize_t format_spec_len) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -7,9 +7,9 @@
extern "C" {
#endif
PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
PyAPI_FUNC(void) PyOS_InitInterrupts(void);
PyAPI_FUNC(void) PyOS_AfterFork(void);
PyAPI_FUNC(int) PyOS_InterruptOccurred(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyOS_InitInterrupts(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyOS_AfterFork(void) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -12,14 +12,14 @@ extern "C" {
#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type)
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *) PYSTON_NOEXCEPT;
// Pyston change: this is no longer a static object
//PyAPI_DATA(PyTypeObject) PyCallIter_Type;
#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type)
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
#endif
......
......@@ -49,25 +49,25 @@ PyAPI_DATA(PyTypeObject*) list_cls;
#define PyList_Type (*list_cls)
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) PyList_Check(PyObject*);
PyAPI_FUNC(bool) PyList_Check(PyObject*) PYSTON_NOEXCEPT;
#if 0
#define PyList_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
#endif
#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type)
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
PyAPI_FUNC(int) PyList_Sort(PyObject *);
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyList_Sort(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyList_Reverse(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *) PYSTON_NOEXCEPT;
/* Macro, trading safety for speed */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
......
......@@ -21,25 +21,25 @@ PyAPI_DATA(PyTypeObject*) long_cls;
#define PyLong_Type (*long_cls)
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) PyLong_Check(PyObject*);
PyAPI_FUNC(bool) PyLong_Check(PyObject*) PYSTON_NOEXCEPT;
#if 0
#define PyLong_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
#endif
#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);
PyAPI_FUNC(PyObject *) PyLong_FromDouble(double);
PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t);
PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t);
PyAPI_FUNC(long) PyLong_AsLong(PyObject *);
PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *);
PyAPI_FUNC(int) _PyLong_AsInt(PyObject *);
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
PyAPI_FUNC(PyObject *) PyLong_FromLong(long) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyLong_FromDouble(double) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(long) PyLong_AsLong(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *) PYSTON_NOEXCEPT;
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyLong_AsInt(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void) PYSTON_NOEXCEPT;
/* For use by intobject.c only */
#define _PyLong_AsSsize_t PyLong_AsSsize_t
......@@ -53,31 +53,31 @@ PyAPI_DATA(int) _PyLong_DigitValue[256];
zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
possible if the number of bits doesn't fit into a Py_ssize_t, sets
OverflowError and returns -1.0 for x, 0 for e. */
PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e);
PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *);
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *);
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *);
PyAPI_FUNC(double) PyLong_AsDouble(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *) PYSTON_NOEXCEPT;
#ifdef HAVE_LONG_LONG
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG);
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *);
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG) PYSTON_NOEXCEPT;
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *) PYSTON_NOEXCEPT;
#endif /* HAVE_LONG_LONG */
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int) PYSTON_NOEXCEPT;
#ifdef Py_USING_UNICODE
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int) PYSTON_NOEXCEPT;
#endif
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
v must not be NULL, and must be a normalized long.
There are no error cases.
*/
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v) PYSTON_NOEXCEPT;
/* _PyLong_NumBits. Return the number of bits needed to represent the
......@@ -87,7 +87,7 @@ PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
(size_t)-1 is returned and OverflowError set if the true result doesn't
fit in a size_t.
*/
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v) PYSTON_NOEXCEPT;
/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in
base 256, and return a Python long with the same numeric value.
......@@ -104,7 +104,7 @@ PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
*/
PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
const unsigned char* bytes, size_t n,
int little_endian, int is_signed);
int little_endian, int is_signed) PYSTON_NOEXCEPT;
/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
v to a base-256 integer, stored in array bytes. Normally return 0,
......@@ -127,20 +127,20 @@ PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
*/
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
unsigned char* bytes, size_t n,
int little_endian, int is_signed);
int little_endian, int is_signed) PYSTON_NOEXCEPT;
/* _PyLong_Format: Convert the long to a string object with given base,
appending a base prefix of 0[box] if base is 2, 8 or 16.
Add a trailing "L" if addL is non-zero.
If newstyle is zero, then use the pre-2.6 behavior of octal having
a leading "0", instead of the prefix "0o" */
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle);
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle) PYSTON_NOEXCEPT;
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj,
char *format_spec,
Py_ssize_t format_spec_len);
Py_ssize_t format_spec_len) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -22,9 +22,9 @@ typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
PyObject *);
typedef PyObject *(*PyNoArgsFunction)(PyObject *);
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *) PYSTON_NOEXCEPT;
/* Macros for direct access to these values. Type checks are *not*
done, so use with care. */
......@@ -34,7 +34,7 @@ PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
(((PyCFunctionObject *)func) -> m_self)
#define PyCFunction_GET_FLAGS(func) \
(((PyCFunctionObject *)func) -> m_ml -> ml_flags)
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
struct PyMethodDef {
const char *ml_name; /* The name of the built-in function/method */
......@@ -45,11 +45,11 @@ struct PyMethodDef {
};
typedef struct PyMethodDef PyMethodDef;
PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *) PYSTON_NOEXCEPT;
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
PyObject *);
PyObject *) PYSTON_NOEXCEPT;
/* Flag passed to newmethodobject */
#define METH_OLDARGS 0x0000
......@@ -78,7 +78,7 @@ typedef struct PyMethodChain {
} PyMethodChain;
PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *,
const char *);
const char *) PYSTON_NOEXCEPT;
typedef struct {
PyObject_HEAD
......@@ -87,7 +87,7 @@ typedef struct {
PyObject *m_module; /* The __module__ attribute, can be anything */
} PyCFunctionObject;
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -21,26 +21,26 @@ extern "C" {
#define Py_BuildValue _Py_BuildValue_SizeT
#define Py_VaBuildValue _Py_VaBuildValue_SizeT
#else
PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list);
PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list) PYSTON_NOEXCEPT;
#endif
PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
const char *, char **, ...);
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...);
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw);
const char *, char **, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list);
PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *,
const char *, char **, va_list);
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
const char *, char **, va_list) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *);
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *);
PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *) PYSTON_NOEXCEPT;
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
......@@ -117,7 +117,7 @@ PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char
PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods,
const char *doc, PyObject *self,
int apiver);
int apiver) PYSTON_NOEXCEPT;
#define Py_InitModule(name, methods) \
Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
......
......@@ -485,7 +485,7 @@ typedef struct _heaptypeobject {
/* Generic type check */
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);
PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *) PYSTON_NOEXCEPT;
#define PyObject_TypeCheck(ob, tp) \
(Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))
......@@ -499,57 +499,57 @@ PyAPI_DATA(PyTypeObject*) type_cls;
//PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) PyType_Check(PyObject*);
PyAPI_FUNC(bool) PyType_Check(PyObject*) PYSTON_NOEXCEPT;
#if 0
#define PyType_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS)
#endif
#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type)
PyAPI_FUNC(int) PyType_Ready(PyTypeObject *);
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t);
PyAPI_FUNC(int) PyType_Ready(PyTypeObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *,
PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *) PYSTON_NOEXCEPT;
// Pyston change: modified this to take a const char*
PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, const char *, PyObject **);
PyAPI_FUNC(unsigned int) PyType_ClearCache(void);
PyAPI_FUNC(void) PyType_Modified(PyTypeObject *);
PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, const char *, PyObject **) PYSTON_NOEXCEPT;
PyAPI_FUNC(unsigned int) PyType_ClearCache(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyType_Modified(PyTypeObject *) PYSTON_NOEXCEPT;
/* Generic operations on objects */
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyObject_Dump(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *) PYSTON_NOEXCEPT;
#define PyObject_Bytes PyObject_Str
#ifdef Py_USING_UNICODE
PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *) PYSTON_NOEXCEPT;
#endif
PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int);
PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int);
PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *);
PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *);
PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *);
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *);
PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *,
PyObject *, PyObject *);
PyAPI_FUNC(long) PyObject_Hash(PyObject *);
PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *);
PyAPI_FUNC(int) PyObject_IsTrue(PyObject *);
PyAPI_FUNC(int) PyObject_Not(PyObject *);
PyAPI_FUNC(int) PyCallable_Check(PyObject *);
PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **);
PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **);
PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(long) PyObject_Hash(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_IsTrue(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_Not(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyCallable_Check(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *);
PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *) PYSTON_NOEXCEPT;
/* A slot function whose address we need to compare */
extern int _PyObject_SlotCompare(PyObject *, PyObject *);
......@@ -567,16 +567,16 @@ _PyObject_GenericSetAttrWithDict(PyObject *, PyObject *,
returning the names of the current locals. In this case, if there are
no current locals, NULL is returned, and PyErr_Occurred() is false.
*/
PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *) PYSTON_NOEXCEPT;
/* Helpers for printing recursive container types */
PyAPI_FUNC(int) Py_ReprEnter(PyObject *);
PyAPI_FUNC(void) Py_ReprLeave(PyObject *);
PyAPI_FUNC(int) Py_ReprEnter(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_ReprLeave(PyObject *) PYSTON_NOEXCEPT;
/* Helpers for hash functions */
PyAPI_FUNC(long) _Py_HashDouble(double);
PyAPI_FUNC(long) _Py_HashPointer(void*);
PyAPI_FUNC(long) _Py_HashDouble(double) PYSTON_NOEXCEPT;
PyAPI_FUNC(long) _Py_HashPointer(void*) PYSTON_NOEXCEPT;
typedef struct {
long prefix;
......@@ -768,10 +768,10 @@ environment the global variable trick is not safe.)
#ifdef Py_REF_DEBUG
PyAPI_DATA(Py_ssize_t) _Py_RefTotal;
PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname,
int lineno, PyObject *op);
PyAPI_FUNC(PyObject *) _PyDict_Dummy(void);
PyAPI_FUNC(PyObject *) _PySet_Dummy(void);
PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
int lineno, PyObject *op) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyDict_Dummy(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PySet_Dummy(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void) PYSTON_NOEXCEPT;
#define _Py_INC_REFTOTAL _Py_RefTotal++
#define _Py_DEC_REFTOTAL _Py_RefTotal--
#define _Py_REF_DEBUG_COMMA ,
......@@ -788,8 +788,8 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void);
#endif /* Py_REF_DEBUG */
#ifdef COUNT_ALLOCS
PyAPI_FUNC(void) inc_count(PyTypeObject *);
PyAPI_FUNC(void) dec_count(PyTypeObject *);
PyAPI_FUNC(void) inc_count(PyTypeObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) dec_count(PyTypeObject *) PYSTON_NOEXCEPT;
#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP))
#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP))
#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees--
......@@ -803,12 +803,12 @@ PyAPI_FUNC(void) dec_count(PyTypeObject *);
#ifdef Py_TRACE_REFS
/* Py_TRACE_REFS is such major surgery that we call external routines. */
PyAPI_FUNC(void) _Py_NewReference(PyObject *);
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
PyAPI_FUNC(void) _Py_PrintReferences(FILE *);
PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *);
PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
PyAPI_FUNC(void) _Py_NewReference(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_Dealloc(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_PrintReferences(FILE *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force) PYSTON_NOEXCEPT;
#else
/* Without Py_TRACE_REFS, there's little enough to do that we expand code
......@@ -882,8 +882,8 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
These are provided as conveniences to Python runtime embedders, so that
they can have object code that is not dependent on Python compilation flags.
*/
PyAPI_FUNC(void) Py_IncRef(PyObject *);
PyAPI_FUNC(void) Py_DecRef(PyObject *);
PyAPI_FUNC(void) Py_IncRef(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_DecRef(PyObject *) PYSTON_NOEXCEPT;
/*
_Py_NoneStruct is an object of undefined type which can be used in contexts
......@@ -1035,14 +1035,14 @@ with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL.
/* This is the old private API, invoked by the macros before 2.7.4.
Kept for binary compatibility of extensions. */
PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*);
PyAPI_FUNC(void) _PyTrash_destroy_chain(void);
PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyTrash_destroy_chain(void) PYSTON_NOEXCEPT;
PyAPI_DATA(int) _PyTrash_delete_nesting;
PyAPI_DATA(PyObject *) _PyTrash_delete_later;
/* The new thread-safe private API, invoked by the macros below. */
PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*);
PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void);
PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void) PYSTON_NOEXCEPT;
#define PyTrash_UNWIND_LEVEL 50
......
......@@ -96,27 +96,27 @@ PyObject_{New, NewVar, Del}.
the object gets initialized via PyObject_{Init, InitVar} after obtaining
the raw memory.
*/
PyAPI_FUNC(void *) PyObject_Malloc(size_t);
PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t);
PyAPI_FUNC(void) PyObject_Free(void *);
PyAPI_FUNC(void *) PyObject_Malloc(size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyObject_Free(void *) PYSTON_NOEXCEPT;
/* Macros */
#ifdef WITH_PYMALLOC
#ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */
PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes);
PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes);
PyAPI_FUNC(void) _PyObject_DebugFree(void *p);
PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p);
PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p);
PyAPI_FUNC(void) _PyObject_DebugMallocStats(void);
PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes);
PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes);
PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p);
PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p);
PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes);
PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes);
PyAPI_FUNC(void) _PyMem_DebugFree(void *p);
PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyObject_DebugFree(void *p) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyObject_DebugMallocStats(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyMem_DebugFree(void *p) PYSTON_NOEXCEPT;
#define PyObject_MALLOC _PyObject_DebugMalloc
#define PyObject_Malloc _PyObject_DebugMalloc
#define PyObject_REALLOC _PyObject_DebugRealloc
......@@ -149,11 +149,11 @@ PyAPI_FUNC(void) _PyMem_DebugFree(void *p);
*/
/* Functions */
PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *,
PyTypeObject *, Py_ssize_t);
PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
PyTypeObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t) PYSTON_NOEXCEPT;
#define PyObject_New(type, typeobj) \
( (type *) _PyObject_New(typeobj) )
......@@ -234,7 +234,7 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);
*/
/* C equivalent of gc.collect(). */
PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);
PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void) PYSTON_NOEXCEPT;
/* Test if a type has a GC head */
#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
......@@ -243,7 +243,7 @@ PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void);
#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \
(Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o)))
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t);
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t) PYSTON_NOEXCEPT;
#define PyObject_GC_Resize(type, op, n) \
( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) )
......@@ -305,12 +305,12 @@ extern PyGC_Head *_PyGC_generation0;
(!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))
PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t);
PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *);
PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t);
PyAPI_FUNC(void) PyObject_GC_Track(void *);
PyAPI_FUNC(void) PyObject_GC_UnTrack(void *);
PyAPI_FUNC(void) PyObject_GC_Del(void *);
PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyObject_GC_Track(void *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyObject_GC_UnTrack(void *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyObject_GC_Del(void *) PYSTON_NOEXCEPT;
#define PyObject_GC_New(type, typeobj) \
( (type *) _PyObject_GC_New(typeobj) )
......
......@@ -34,8 +34,8 @@ extern "C" {
XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but
XXX an exception is not set in that case).
*/
PyAPI_FUNC(PyArena *) PyArena_New(void);
PyAPI_FUNC(void) PyArena_Free(PyArena *);
PyAPI_FUNC(PyArena *) PyArena_New(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyArena_Free(PyArena *) PYSTON_NOEXCEPT;
/* Mostly like malloc(), return the address of a block of memory spanning
* `size` bytes, or return NULL (without setting an exception) if enough
......@@ -49,13 +49,13 @@ extern "C" {
* until PyArena_Free(ar) is called, at which point all pointers obtained
* from the arena `ar` become invalid simultaneously.
*/
PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size);
PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size) PYSTON_NOEXCEPT;
/* This routine isn't a proper arena allocation routine. It takes
* a PyObject* and records it so that it can be DECREFed when the
* arena is freed.
*/
PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *);
PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -29,27 +29,27 @@ typedef void (*PyCapsule_Destructor)(PyObject *);
PyAPI_FUNC(PyObject *) PyCapsule_New(
void *pointer,
const char *name,
PyCapsule_Destructor destructor);
PyCapsule_Destructor destructor) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name);
PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule);
PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule);
PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule);
PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name);
PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer);
PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor);
PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name);
PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context);
PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block);
PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -35,7 +35,7 @@ PyAPI_DATA(int) Py_HashRandomizationFlag;
#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
// Pyston change: make Py_FatalError a macro so that it can access linenumber info, similar to assert:
//PyAPI_FUNC(void) Py_FatalError(const char *message) __attribute__((__noreturn__));
//PyAPI_FUNC(void) Py_FatalError(const char *message) __attribute__((__noreturn__)) PYSTON_NOEXCEPT;
#define _PYSTON_STRINGIFY(N) #N
#define PYSTON_STRINGIFY(N) _PYSTON_STRINGIFY(N)
#define Py_FatalError(message) \
......
......@@ -79,13 +79,13 @@ typedef struct {
/* Error handling definitions */
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *);
PyAPI_FUNC(PyObject *) PyErr_Occurred(void);
PyAPI_FUNC(void) PyErr_Clear(void);
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(void) PyErr_SetNone(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_Occurred(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_Clear(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
#ifdef Py_DEBUG
#define _PyErr_OCCURRED() PyErr_Occurred()
......@@ -94,9 +94,9 @@ PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
#endif
/* Error testing and normalization */
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**) PYSTON_NOEXCEPT;
/* */
......@@ -121,10 +121,10 @@ PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
: (PyObject*)((x)->ob_type)))
#endif
// (We might have to make these wrapper macros that do appropriate casting to PyObject)
PyAPI_FUNC(int) PyExceptionClass_Check(PyObject*);
PyAPI_FUNC(int) PyExceptionInstance_Check(PyObject*);
PyAPI_FUNC(const char*) PyExceptionClass_Name(PyObject*);
PyAPI_FUNC(PyObject*) PyExceptionInstance_Class(PyObject*);
PyAPI_FUNC(int) PyExceptionClass_Check(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyExceptionInstance_Check(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char*) PyExceptionClass_Name(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyExceptionInstance_Class(PyObject*) PYSTON_NOEXCEPT;
/* Predefined exceptions */
......@@ -248,63 +248,63 @@ PyAPI_DATA(PyTypeObject *) BytesWarning;
/* Convenience functions */
PyAPI_FUNC(int) PyErr_BadArgument(void);
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
PyAPI_FUNC(int) PyErr_BadArgument(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_NoMemory(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
PyObject *, PyObject *);
PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(
PyObject *, const char *);
PyObject *, const char *) PYSTON_NOEXCEPT;
#ifdef MS_WINDOWS
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
PyObject *, const Py_UNICODE *);
PyObject *, const Py_UNICODE *) PYSTON_NOEXCEPT;
#endif /* MS_WINDOWS */
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
PYSTON_NOEXCEPT Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
#ifdef MS_WINDOWS
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
int, const char *);
int, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
int, const char *);
int, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
int, const Py_UNICODE *);
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
int, const Py_UNICODE *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
PyObject *,int, PyObject *);
PyObject *,int, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
PyObject *,int, const char *);
PyObject *,int, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
PyObject *,int, const Py_UNICODE *);
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
PyObject *,int, const Py_UNICODE *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int) PYSTON_NOEXCEPT;
#endif /* MS_WINDOWS */
/* Export the old function so that the existing API remains available: */
PyAPI_FUNC(void) PyErr_BadInternalCall(void);
PyAPI_FUNC(void) PyErr_BadInternalCall(void) PYSTON_NOEXCEPT;
// Pyston change: changed this from char* to const char*
PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);
PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno) PYSTON_NOEXCEPT;
/* Mask the old API with a call to the new API for code compiled under
Python 2.0: */
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
/* Function to create a new exception */
PyAPI_FUNC(PyObject *) PyErr_NewException(
char *name, PyObject *base, PyObject *dict);
char *name, PyObject *base, PyObject *dict) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(
char *name, char *doc, PyObject *base, PyObject *dict);
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);
char *name, char *doc, PyObject *base, PyObject *dict) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *) PYSTON_NOEXCEPT;
/* In sigcheck.c or signalmodule.c */
PyAPI_FUNC(int) PyErr_CheckSignals(void);
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
PyAPI_FUNC(int) PyErr_CheckSignals(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_SetInterrupt(void) PYSTON_NOEXCEPT;
/* In signalmodule.c */
int PySignal_SetWakeupFd(int fd);
/* Support for adding program text to SyntaxErrors */
PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int) PYSTON_NOEXCEPT;
#ifdef Py_USING_UNICODE
/* The following functions are used to create and modify unicode
......@@ -312,62 +312,62 @@ PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
/* create a UnicodeDecodeError object */
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(
const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *) PYSTON_NOEXCEPT;
/* create a UnicodeEncodeError object */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(
const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *) PYSTON_NOEXCEPT;
/* create a UnicodeTranslateError object */
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *);
const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *) PYSTON_NOEXCEPT;
/* get the encoding attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *) PYSTON_NOEXCEPT;
/* get the object attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *) PYSTON_NOEXCEPT;
/* get the value of the start attribute (the int * may not be NULL)
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *) PYSTON_NOEXCEPT;
/* assign a new value to the start attribute
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
/* get the value of the end attribute (the int *may not be NULL)
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);
PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *) PYSTON_NOEXCEPT;
/* assign a new value to the end attribute
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
/* get the value of the reason attribute */
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);
PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *) PYSTON_NOEXCEPT;
/* assign a new value to the reason attribute
return 0 on success, -1 on failure */
PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(
PyObject *, const char *);
PyObject *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(
PyObject *, const char *);
PyObject *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
PyObject *, const char *);
PyObject *, const char *) PYSTON_NOEXCEPT;
#endif
......@@ -387,9 +387,9 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
#include <stdarg.h>
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
PYSTON_NOEXCEPT Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
PYSTON_NOEXCEPT Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
#ifdef __cplusplus
}
......
......@@ -71,7 +71,7 @@ extern double copysign(double, double);
/* we take double rounding as evidence of x87 usage */
#ifndef Py_FORCE_DOUBLE
# ifdef X87_DOUBLE_ROUNDING
PyAPI_FUNC(double) _Py_force_double(double);
PyAPI_FUNC(double) _Py_force_double(double) PYSTON_NOEXCEPT;
# define Py_FORCE_DOUBLE(X) (_Py_force_double(X))
# else
# define Py_FORCE_DOUBLE(X) (X)
......@@ -79,8 +79,8 @@ PyAPI_FUNC(double) _Py_force_double(double);
#endif
#ifdef HAVE_GCC_ASM_FOR_X87
PyAPI_FUNC(unsigned short) _Py_get_387controlword(void);
PyAPI_FUNC(void) _Py_set_387controlword(unsigned short);
PyAPI_FUNC(unsigned short) _Py_get_387controlword(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_set_387controlword(unsigned short) PYSTON_NOEXCEPT;
#endif
/* Py_IS_NAN(X)
......
......@@ -51,13 +51,13 @@ extern "C" {
performed on failure (no exception is set, no warning is printed, etc).
*/
PyAPI_FUNC(void *) gc_compat_malloc(size_t);
PyAPI_FUNC(void *) gc_compat_realloc(void *, size_t);
PyAPI_FUNC(void) gc_compat_free(void *);
PyAPI_FUNC(void *) gc_compat_malloc(size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) gc_compat_realloc(void *, size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) gc_compat_free(void *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) PyMem_Malloc(size_t);
PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t);
PyAPI_FUNC(void) PyMem_Free(void *);
PyAPI_FUNC(void *) PyMem_Malloc(size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyMem_Free(void *) PYSTON_NOEXCEPT;
/* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are
no longer supported. They used to call PyErr_NoMemory() on failure. */
......
......@@ -6,6 +6,12 @@
#include <stdint.h>
#ifdef __cplusplus
#define PYSTON_NOEXCEPT noexcept
#else
#define PYSTON_NOEXCEPT
#endif
// Pyston change: these are just hard-coded for now:
typedef ssize_t Py_ssize_t;
#define Py_FORMAT_PARSETUPLE(func,p1,p2)
......
......@@ -119,23 +119,23 @@ typedef struct _ts {
} PyThreadState;
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void);
PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *);
PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *);
PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *);
PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *);
PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *);
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *) PYSTON_NOEXCEPT;
#ifdef WITH_THREAD
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void) PYSTON_NOEXCEPT;
#endif
PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void);
PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *);
PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void);
PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *);
PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *) PYSTON_NOEXCEPT;
/* Variable and macro for in-line access to current thread state */
......@@ -176,7 +176,7 @@ typedef
Failure is a fatal error.
*/
PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void) PYSTON_NOEXCEPT;
/* Release any resources previously acquired. After this call, Python's
state will be the same as it was prior to the corresponding
......@@ -186,7 +186,7 @@ PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void);
Every call to PyGILState_Ensure must be matched by a call to
PyGILState_Release on the same thread.
*/
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE) PYSTON_NOEXCEPT;
/* Helper/diagnostic function - get the current thread state for
this thread. May return NULL if no GILState API has been used
......@@ -194,19 +194,19 @@ PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE);
thread-state, even if no auto-thread-state call has been made
on the main thread.
*/
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void) PYSTON_NOEXCEPT;
/* The implementation of sys._current_frames() Returns a dict mapping
thread id to that thread's current frame.
*/
PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void);
PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void) PYSTON_NOEXCEPT;
/* Routines for advanced debuggers, requested by David Beazley.
Don't use unless you know what you are doing! */
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void);
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *);
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *);
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *) PYSTON_NOEXCEPT;
typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_);
......
......@@ -8,15 +8,15 @@ extern "C" {
#endif
PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr);
PyAPI_FUNC(double) PyOS_ascii_atof(const char *str);
PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) PyOS_ascii_atof(const char *str) PYSTON_NOEXCEPT;
/* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */
PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len,
const char *format, double d);
const char *format, double d) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) PyOS_string_to_double(const char *str,
char **endptr,
PyObject *overflow_exception);
PyObject *overflow_exception) PYSTON_NOEXCEPT;
/* The caller is responsible for calling PyMem_Free to free the buffer
that's is returned. */
......@@ -24,9 +24,9 @@ PyAPI_FUNC(char *) PyOS_double_to_string(double val,
char format_code,
int precision,
int flags,
int *type);
int *type) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr);
PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr) PYSTON_NOEXCEPT;
/* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */
......
......@@ -20,66 +20,66 @@ typedef struct {
int cf_flags; /* bitmask of CO_xxx flags relevant to future */
} PyCompilerFlags;
PyAPI_FUNC(void) Py_SetProgramName(char *);
PyAPI_FUNC(char *) Py_GetProgramName(void);
PyAPI_FUNC(void) Py_SetPythonHome(char *);
PyAPI_FUNC(char *) Py_GetPythonHome(void);
PyAPI_FUNC(void) Py_Initialize(void);
PyAPI_FUNC(void) Py_InitializeEx(int);
PyAPI_FUNC(void) Py_Finalize(void);
PyAPI_FUNC(int) Py_IsInitialized(void);
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
PyAPI_FUNC(void) Py_SetProgramName(char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(char *) Py_GetProgramName(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_SetPythonHome(char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(char *) Py_GetPythonHome(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_Initialize(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_InitializeEx(int) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_Finalize(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) Py_IsInitialized(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *,
int, PyCompilerFlags *flags,
PyArena *);
PyArena *) PYSTON_NOEXCEPT;
PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int,
char *, char *,
PyCompilerFlags *, int *,
PyArena *);
PyArena *) PYSTON_NOEXCEPT;
#define PyParser_SimpleParseString(S, B) \
PyParser_SimpleParseStringFlags(S, B, 0)
#define PyParser_SimpleParseFile(FP, S, B) \
PyParser_SimpleParseFileFlags(FP, S, B, 0)
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
int);
int) PYSTON_NOEXCEPT;
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
int, int);
int, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
PyObject *, PyCompilerFlags *);
PyObject *, PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int,
PyObject *, PyObject *, int,
PyCompilerFlags *);
PyCompilerFlags *) PYSTON_NOEXCEPT;
#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
PyCompilerFlags *);
PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
PyCompilerFlags *) PYSTON_NOEXCEPT;
PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_Print(void);
PyAPI_FUNC(void) PyErr_PrintEx(int);
PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(void) PyErr_Print(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_PrintEx(int) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
PyAPI_FUNC(int) Py_AtExit(void (*func)(void)) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) Py_Exit(int);
PyAPI_FUNC(void) Py_Exit(int) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *) PYSTON_NOEXCEPT;
/* Bootstrap */
PyAPI_FUNC(int) Py_Main(int argc, char **argv);
PyAPI_FUNC(int) Py_Main(int argc, char **argv) PYSTON_NOEXCEPT;
/* Use macros for a bunch of old variants */
#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
......@@ -101,54 +101,54 @@ PyAPI_FUNC(int) Py_Main(int argc, char **argv);
PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
/* In getpath.c */
PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
PyAPI_FUNC(char *) Py_GetPrefix(void);
PyAPI_FUNC(char *) Py_GetExecPrefix(void);
PyAPI_FUNC(char *) Py_GetPath(void);
PyAPI_FUNC(char *) Py_GetProgramFullPath(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(char *) Py_GetPrefix(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(char *) Py_GetExecPrefix(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(char *) Py_GetPath(void) PYSTON_NOEXCEPT;
/* In their own files */
PyAPI_FUNC(const char *) Py_GetVersion(void);
PyAPI_FUNC(const char *) Py_GetPlatform(void);
PyAPI_FUNC(const char *) Py_GetCopyright(void);
PyAPI_FUNC(const char *) Py_GetCompiler(void);
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
PyAPI_FUNC(const char *) _Py_svnversion(void);
PyAPI_FUNC(const char *) Py_SubversionRevision(void);
PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
PyAPI_FUNC(const char *) _Py_hgidentifier(void);
PyAPI_FUNC(const char *) _Py_hgversion(void);
PyAPI_FUNC(const char *) Py_GetVersion(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) Py_GetPlatform(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) Py_GetCopyright(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) Py_GetCompiler(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) Py_GetBuildInfo(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) _Py_svnversion(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) Py_SubversionRevision(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) Py_SubversionShortBranch(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) _Py_hgidentifier(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) _Py_hgversion(void) PYSTON_NOEXCEPT;
/* Internal -- various one-time initializations */
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
PyAPI_FUNC(PyObject *) _PySys_Init(void);
PyAPI_FUNC(void) _PyImport_Init(void);
PyAPI_FUNC(void) _PyExc_Init(void);
PyAPI_FUNC(void) _PyImportHooks_Init(void);
PyAPI_FUNC(int) _PyFrame_Init(void);
PyAPI_FUNC(int) _PyInt_Init(void);
PyAPI_FUNC(int) _PyLong_Init(void);
PyAPI_FUNC(void) _PyFloat_Init(void);
PyAPI_FUNC(int) PyByteArray_Init(void);
PyAPI_FUNC(void) _PyRandom_Init(void);
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PySys_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyImport_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyExc_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyImportHooks_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyFrame_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyInt_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyLong_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyFloat_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyByteArray_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyRandom_Init(void) PYSTON_NOEXCEPT;
/* Various internal finalizers */
PyAPI_FUNC(void) _PyExc_Fini(void);
PyAPI_FUNC(void) _PyImport_Fini(void);
PyAPI_FUNC(void) PyMethod_Fini(void);
PyAPI_FUNC(void) PyFrame_Fini(void);
PyAPI_FUNC(void) PyCFunction_Fini(void);
PyAPI_FUNC(void) PyDict_Fini(void);
PyAPI_FUNC(void) PyTuple_Fini(void);
PyAPI_FUNC(void) PyList_Fini(void);
PyAPI_FUNC(void) PySet_Fini(void);
PyAPI_FUNC(void) PyString_Fini(void);
PyAPI_FUNC(void) PyInt_Fini(void);
PyAPI_FUNC(void) PyFloat_Fini(void);
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
PyAPI_FUNC(void) PyByteArray_Fini(void);
PyAPI_FUNC(void) _PyExc_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyImport_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyMethod_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyFrame_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyCFunction_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyDict_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyTuple_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyList_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PySet_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyString_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyInt_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyFloat_Fini(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyOS_FiniInterrupts(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyByteArray_Fini(void) PYSTON_NOEXCEPT;
/* Stuff with no proper home (yet) */
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *) PYSTON_NOEXCEPT;
PyAPI_DATA(int) (*PyOS_InputHook)(void);
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
......@@ -165,16 +165,16 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
#ifdef USE_STACKCHECK
/* Check that we aren't overflowing our stack */
PyAPI_FUNC(int) PyOS_CheckStack(void);
PyAPI_FUNC(int) PyOS_CheckStack(void) PYSTON_NOEXCEPT;
#endif
/* Signals */
typedef void (*PyOS_sighandler_t)(int);
PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t) PYSTON_NOEXCEPT;
/* Random */
PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size);
PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -39,16 +39,16 @@ PyAPI_DATA(PyTypeObject*) ellipsis_cls;
// Pyston changes: these aren't direct macros any more [they potentially could be though]
//#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
PyAPI_FUNC(bool) PySlice_Check(PyObject*);
PyAPI_FUNC(bool) PySlice_Check(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
PyObject* step);
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
PyObject* step) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop,
Py_ssize_t *step, Py_ssize_t *slicelength);
Py_ssize_t *step, Py_ssize_t *slicelength) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -65,7 +65,7 @@ PyAPI_DATA(PyTypeObject*) str_cls;
#define PyString_Type (*str_cls)
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) _PyString_Check(PyObject*);
PyAPI_FUNC(bool) _PyString_Check(PyObject*) PYSTON_NOEXCEPT;
#define PyString_Check(op) _PyString_Check((PyObject*)op)
#if 0
#define PyString_Check(op) \
......@@ -73,31 +73,31 @@ PyAPI_FUNC(bool) _PyString_Check(PyObject*);
#endif
#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type)
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyString_FromString(const char *);
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyString_FromString(const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list)
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
PYSTON_NOEXCEPT Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *);
PyAPI_FUNC(char *) PyString_AsString(PyObject *);
PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int);
PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *);
PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *);
PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t);
PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*);
PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *);
PYSTON_NOEXCEPT Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(char *) PyString_AsString(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *) PYSTON_NOEXCEPT;
// Pyston change: added const
PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int,
int, const char**, int*);
int, const char**, int*) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t,
const char *, Py_ssize_t,
const char *);
const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyString_InternInPlace(PyObject **);
PyAPI_FUNC(void) PyString_InternImmortal(PyObject **);
PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *);
PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void);
PyAPI_FUNC(void) PyString_InternInPlace(PyObject **) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyString_InternImmortal(PyObject **) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void) PYSTON_NOEXCEPT;
/* Use only if you know it's a string */
#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate)
......@@ -111,7 +111,7 @@ PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void);
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
x must be an iterable object. */
PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x);
PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x) PYSTON_NOEXCEPT;
/* --- Generic Codecs ----------------------------------------------------- */
......@@ -123,7 +123,7 @@ PyAPI_FUNC(PyObject*) PyString_Decode(
Py_ssize_t size, /* size of buffer */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Encodes a char buffer of the given size and returns a
Python object. */
......@@ -133,7 +133,7 @@ PyAPI_FUNC(PyObject*) PyString_Encode(
Py_ssize_t size, /* number of chars to encode */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Encodes a string object and returns the result as Python
object. */
......@@ -142,7 +142,7 @@ PyAPI_FUNC(PyObject*) PyString_AsEncodedObject(
PyObject *str, /* string object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Encodes a string object and returns the result as Python string
object.
......@@ -156,7 +156,7 @@ PyAPI_FUNC(PyObject*) PyString_AsEncodedString(
PyObject *str, /* string object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Decodes a string object and returns the result as Python
object. */
......@@ -165,7 +165,7 @@ PyAPI_FUNC(PyObject*) PyString_AsDecodedObject(
PyObject *str, /* string object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Decodes a string object and returns the result as Python string
object.
......@@ -179,7 +179,7 @@ PyAPI_FUNC(PyObject*) PyString_AsDecodedString(
PyObject *str, /* string object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Provides access to the internal data buffer and size of a string
object or the default encoded version of an Unicode object. Passing
......@@ -203,7 +203,7 @@ PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGroupingLocale(char *buffer,
Py_ssize_t n_buffer,
char *digits,
Py_ssize_t n_digits,
Py_ssize_t min_width);
Py_ssize_t min_width) PYSTON_NOEXCEPT;
/* Using explicit passed-in values, insert the thousands grouping
into the string pointed to by buffer. For the argument descriptions,
......@@ -214,13 +214,13 @@ PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGrouping(char *buffer,
Py_ssize_t n_digits,
Py_ssize_t min_width,
const char *grouping,
const char *thousands_sep);
const char *thousands_sep) PYSTON_NOEXCEPT;
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj,
char *format_spec,
Py_ssize_t format_spec_len);
Py_ssize_t format_spec_len) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -87,12 +87,12 @@ typedef struct PyMemberDef {
/* Obsolete API, for binary backwards compatibility */
PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *);
PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *);
PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *) PYSTON_NOEXCEPT;
/* Current API, use this */
PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *);
PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *);
PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *) PYSTON_NOEXCEPT;
#ifdef __cplusplus
......
......@@ -23,9 +23,9 @@ typedef struct PyStructSequence_Desc {
extern char* PyStructSequence_UnnamedField;
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
PyStructSequence_Desc *desc);
PyStructSequence_Desc *desc) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type) PYSTON_NOEXCEPT;
typedef struct {
PyObject_VAR_HEAD
......
......@@ -9,21 +9,21 @@ extern "C" {
#endif
// Pyston change: changed most of these to const char*
PyAPI_FUNC(PyObject *) PySys_GetObject(const char *);
PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *);
PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *);
PyAPI_FUNC(void) PySys_SetArgv(int, char **);
PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int);
PyAPI_FUNC(void) PySys_SetPath(char *);
PyAPI_FUNC(PyObject *) PySys_GetObject(const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PySys_SetArgv(int, char **) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PySys_SetPath(char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PYSTON_NOEXCEPT Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PYSTON_NOEXCEPT Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
PyAPI_FUNC(void) PySys_AddWarnOption(char *);
PyAPI_FUNC(int) PySys_HasWarnOptions(void);
PyAPI_FUNC(void) PySys_ResetWarnOptions(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PySys_AddWarnOption(char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PySys_HasWarnOptions(void) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -22,9 +22,9 @@ typedef struct _traceback {
#endif
typedef struct _PyTracebackObject PyTracebackObject;
PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *);
PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *);
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int);
PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int) PYSTON_NOEXCEPT;
/* Reveal traceback type so we can typecheck traceback objects */
// Pyston change: not a static type any more
......
......@@ -42,21 +42,21 @@ PyAPI_DATA(PyTypeObject*) tuple_cls;
#define PyTuple_Type (*tuple_cls)
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) PyTuple_Check(PyObject*);
PyAPI_FUNC(bool) PyTuple_Check(PyObject*) PYSTON_NOEXCEPT;
#if 0
#define PyTuple_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
#endif
#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type)
PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);
PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t);
PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *);
PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...);
PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *) PYSTON_NOEXCEPT;
/* Macro, trading safety for speed */
// Pyston changes: these aren't direct macros any more [they potentially could be though]
......@@ -68,7 +68,7 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
#define PyTuple_SET_ITEM(op, i, v) PyTuple_SetItem((PyObject*)op, i, v)
//#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
PyAPI_FUNC(int) PyTuple_ClearFreeList(void);
PyAPI_FUNC(int) PyTuple_ClearFreeList(void) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -435,7 +435,7 @@ PyAPI_DATA(PyTypeObject*) unicode_cls;
//PyAPI_DATA(PyTypeObject) PyUnicode_Type;
// Pyston changes: these aren't direct macros any more [they potentially could be though]
PyAPI_FUNC(bool) PyUnicode_Check(PyObject*);
PyAPI_FUNC(bool) PyUnicode_Check(PyObject*) PYSTON_NOEXCEPT;
#if 0
#define PyUnicode_Check(op) \
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
......@@ -454,10 +454,10 @@ PyAPI_FUNC(bool) PyUnicode_Check(PyObject*);
#define PyUnicode_AS_DATA(op) \
((const char *)((PyUnicodeObject *)(op))->str)
#endif
Py_ssize_t PyUnicode_GET_SIZE(PyObject*);
Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject*);
Py_UNICODE * PyUnicode_AS_UNICODE(PyObject*);
const char * PyUnicode_AS_DATA(PyObject*);
PyAPI_FUNC(Py_ssize_t) PyUnicode_GET_SIZE(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_ssize_t) PyUnicode_GET_DATA_SIZE(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AS_UNICODE(PyObject*) PYSTON_NOEXCEPT;
PyAPI_FUNC(const char *) PyUnicode_AS_DATA(PyObject*) PYSTON_NOEXCEPT;
/* --- Constants ---------------------------------------------------------- */
......@@ -485,35 +485,35 @@ const char * PyUnicode_AS_DATA(PyObject*);
PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
const Py_UNICODE *u, /* Unicode buffer */
Py_ssize_t size /* size of buffer */
);
) PYSTON_NOEXCEPT;
/* Similar to PyUnicode_FromUnicode(), but u points to Latin-1 encoded bytes */
PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize(
const char *u, /* char buffer */
Py_ssize_t size /* size of buffer */
);
) PYSTON_NOEXCEPT;
/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated
Latin-1 encoded bytes */
PyAPI_FUNC(PyObject*) PyUnicode_FromString(
const char *u /* string */
);
) PYSTON_NOEXCEPT;
/* Return a read-only pointer to the Unicode object's internal
Py_UNICODE buffer. */
PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
/* Get the length of the Unicode object. */
PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
/* Get the maximum ordinal for a Unicode character. */
PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void) PYSTON_NOEXCEPT;
/* Resize an already allocated Unicode object to the new size length.
......@@ -532,7 +532,7 @@ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
PyAPI_FUNC(int) PyUnicode_Resize(
PyObject **unicode, /* Pointer to the Unicode object */
Py_ssize_t length /* New length */
);
) PYSTON_NOEXCEPT;
/* Coerce obj to an Unicode object and return a reference with
*incremented* refcount.
......@@ -555,7 +555,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
register PyObject *obj, /* Object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Coerce obj to an Unicode object and return a reference with
*incremented* refcount.
......@@ -572,16 +572,16 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject(
PyAPI_FUNC(PyObject*) PyUnicode_FromObject(
register PyObject *obj /* Object */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list);
PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...);
PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...) PYSTON_NOEXCEPT;
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj,
Py_UNICODE *format_spec,
Py_ssize_t format_spec_len);
Py_ssize_t format_spec_len) PYSTON_NOEXCEPT;
/* --- wchar_t support for platforms which support it --------------------- */
......@@ -595,7 +595,7 @@ PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj,
PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar(
register const wchar_t *w, /* wchar_t buffer */
Py_ssize_t size /* size of buffer */
);
) PYSTON_NOEXCEPT;
/* Copies the Unicode Object contents into the wchar_t buffer w. At
most size wchar_t characters are copied.
......@@ -613,7 +613,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
PyUnicodeObject *unicode, /* Unicode object */
register wchar_t *w, /* wchar_t buffer */
Py_ssize_t size /* size of buffer */
);
) PYSTON_NOEXCEPT;
#endif
......@@ -627,7 +627,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar(
*/
PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal) PYSTON_NOEXCEPT;
/* --- Free-list management ----------------------------------------------- */
......@@ -638,7 +638,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
*/
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void) PYSTON_NOEXCEPT;
/* === Builtin Codecs =====================================================
......@@ -675,7 +675,7 @@ PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
*/
PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString(
PyObject *, const char *);
PyObject *, const char *) PYSTON_NOEXCEPT;
/* Returns the currently active default encoding.
......@@ -686,7 +686,7 @@ PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString(
*/
PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void);
PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void) PYSTON_NOEXCEPT;
/* Sets the currently active default encoding.
......@@ -696,7 +696,7 @@ PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void);
PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding(
const char *encoding /* Encoding name in standard form */
);
) PYSTON_NOEXCEPT;
/* --- Generic Codecs ----------------------------------------------------- */
......@@ -708,7 +708,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Decode(
Py_ssize_t size, /* size of buffer */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Encodes a Py_UNICODE buffer of the given size and returns a
Python string object. */
......@@ -718,7 +718,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Encode(
Py_ssize_t size, /* number of Py_UNICODE chars to encode */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Encodes a Unicode object and returns the result as Python
object. */
......@@ -727,7 +727,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject(
PyObject *unicode, /* Unicode object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Encodes a Unicode object and returns the result as Python string
object. */
......@@ -736,11 +736,11 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString(
PyObject *unicode, /* Unicode object */
const char *encoding, /* encoding */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap(
PyObject* string /* 256 character map */
);
) PYSTON_NOEXCEPT;
/* --- UTF-7 Codecs ------------------------------------------------------- */
......@@ -749,14 +749,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7(
const char *string, /* UTF-7 encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful(
const char *string, /* UTF-7 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
const Py_UNICODE *data, /* Unicode char buffer */
......@@ -764,7 +764,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* --- UTF-8 Codecs ------------------------------------------------------- */
......@@ -772,24 +772,24 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8(
const char *string, /* UTF-8 encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful(
const char *string, /* UTF-8 encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* --- UTF-32 Codecs ------------------------------------------------------ */
......@@ -823,7 +823,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32(
int *byteorder /* pointer to byteorder to use
0=native;-1=LE,1=BE; updated on
exit */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful(
const char *string, /* UTF-32 encoded string */
......@@ -833,14 +833,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful(
0=native;-1=LE,1=BE; updated on
exit */
Py_ssize_t *consumed /* bytes consumed */
);
) PYSTON_NOEXCEPT;
/* Returns a Python string using the UTF-32 encoding in native byte
order. The string always starts with a BOM mark. */
PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
/* Returns a Python string object holding the UTF-32 encoded value of
the Unicode data.
......@@ -863,7 +863,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
) PYSTON_NOEXCEPT;
/* --- UTF-16 Codecs ------------------------------------------------------ */
......@@ -897,7 +897,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16(
int *byteorder /* pointer to byteorder to use
0=native;-1=LE,1=BE; updated on
exit */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful(
const char *string, /* UTF-16 encoded string */
......@@ -907,14 +907,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful(
0=native;-1=LE,1=BE; updated on
exit */
Py_ssize_t *consumed /* bytes consumed */
);
) PYSTON_NOEXCEPT;
/* Returns a Python string using the UTF-16 encoding in native byte
order. The string always starts with a BOM mark. */
PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
/* Returns a Python string object holding the UTF-16 encoded value of
the Unicode data.
......@@ -941,7 +941,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16(
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);
) PYSTON_NOEXCEPT;
/* --- Unicode-Escape Codecs ---------------------------------------------- */
......@@ -949,16 +949,16 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape(
const char *string, /* Unicode-Escape encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
);
) PYSTON_NOEXCEPT;
/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */
......@@ -966,16 +966,16 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape(
const char *string, /* Raw-Unicode-Escape encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length /* Number of Py_UNICODE chars to encode */
);
) PYSTON_NOEXCEPT;
/* --- Unicode Internal Codec ---------------------------------------------
......@@ -997,17 +997,17 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1(
const char *string, /* Latin-1 encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* --- ASCII Codecs -------------------------------------------------------
......@@ -1019,17 +1019,17 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII(
const char *string, /* ASCII encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* --- Character Map Codecs -----------------------------------------------
......@@ -1059,13 +1059,13 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap(
PyObject *mapping, /* character mapping
(char ordinal -> unicode ordinal) */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString(
PyObject *unicode, /* Unicode object */
PyObject *mapping /* character mapping
(unicode ordinal -> char ordinal) */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
const Py_UNICODE *data, /* Unicode char buffer */
......@@ -1073,7 +1073,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
PyObject *mapping, /* character mapping
(unicode ordinal -> char ordinal) */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Translate a Py_UNICODE buffer of the given length by applying a
character mapping table to it and return the resulting Unicode
......@@ -1093,7 +1093,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
PyObject *table, /* Translate table */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
#ifdef MS_WIN32
......@@ -1103,24 +1103,24 @@ PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS(
const char *string, /* MBCS encoded string */
Py_ssize_t length, /* size of string */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful(
const char *string, /* MBCS encoded string */
Py_ssize_t length, /* size of string */
const char *errors, /* error handling */
Py_ssize_t *consumed /* bytes consumed */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString(
PyObject *unicode /* Unicode object */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
#endif /* MS_WIN32 */
......@@ -1153,7 +1153,7 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
char *output, /* Output buffer; must have size >= length */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* --- Methods & Slots ----------------------------------------------------
......@@ -1166,7 +1166,7 @@ PyAPI_FUNC(int) PyUnicode_EncodeDecimal(
PyAPI_FUNC(PyObject*) PyUnicode_Concat(
PyObject *left, /* Left string */
PyObject *right /* Right string */
);
) PYSTON_NOEXCEPT;
/* Split a string giving a list of Unicode strings.
......@@ -1183,7 +1183,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Split(
PyObject *s, /* String to split */
PyObject *sep, /* String separator */
Py_ssize_t maxsplit /* Maxsplit count */
);
) PYSTON_NOEXCEPT;
/* Dito, but split at line breaks.
......@@ -1193,14 +1193,14 @@ PyAPI_FUNC(PyObject*) PyUnicode_Split(
PyAPI_FUNC(PyObject*) PyUnicode_Splitlines(
PyObject *s, /* String to split */
int keepends /* If true, line end markers are included */
);
) PYSTON_NOEXCEPT;
/* Partition a string using a given separator. */
PyAPI_FUNC(PyObject*) PyUnicode_Partition(
PyObject *s, /* String to partition */
PyObject *sep /* String separator */
);
) PYSTON_NOEXCEPT;
/* Partition a string using a given separator, searching from the end of the
string. */
......@@ -1208,7 +1208,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_Partition(
PyAPI_FUNC(PyObject*) PyUnicode_RPartition(
PyObject *s, /* String to partition */
PyObject *sep /* String separator */
);
) PYSTON_NOEXCEPT;
/* Split a string giving a list of Unicode strings.
......@@ -1227,7 +1227,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_RSplit(
PyObject *s, /* String to split */
PyObject *sep, /* String separator */
Py_ssize_t maxsplit /* Maxsplit count */
);
) PYSTON_NOEXCEPT;
/* Translate a string by applying a character mapping table to it and
return the resulting Unicode object.
......@@ -1245,7 +1245,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_Translate(
PyObject *str, /* String */
PyObject *table, /* Translate table */
const char *errors /* error handling */
);
) PYSTON_NOEXCEPT;
/* Join a sequence of strings using the given separator and return
the resulting Unicode string. */
......@@ -1253,7 +1253,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_Translate(
PyAPI_FUNC(PyObject*) PyUnicode_Join(
PyObject *separator, /* Separator string */
PyObject *seq /* Sequence object */
);
) PYSTON_NOEXCEPT;
/* Return 1 if substr matches str[start:end] at the given tail end, 0
otherwise. */
......@@ -1264,7 +1264,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch(
Py_ssize_t start, /* Start index */
Py_ssize_t end, /* Stop index */
int direction /* Tail end: -1 prefix, +1 suffix */
);
) PYSTON_NOEXCEPT;
/* Return the first position of substr in str[start:end] using the
given search direction or -1 if not found. -2 is returned in case
......@@ -1276,7 +1276,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_Find(
Py_ssize_t start, /* Start index */
Py_ssize_t end, /* Stop index */
int direction /* Find direction: +1 forward, -1 backward */
);
) PYSTON_NOEXCEPT;
/* Count the number of occurrences of substr in str[start:end]. */
......@@ -1285,7 +1285,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_Count(
PyObject *substr, /* Substring to count */
Py_ssize_t start, /* Start index */
Py_ssize_t end /* Stop index */
);
) PYSTON_NOEXCEPT;
/* Replace at most maxcount occurrences of substr in str with replstr
and return the resulting Unicode object. */
......@@ -1296,7 +1296,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_Replace(
PyObject *replstr, /* Substring to replace */
Py_ssize_t maxcount /* Max. number of replacements to apply;
-1 = all */
);
) PYSTON_NOEXCEPT;
/* Compare two strings and return -1, 0, 1 for less than, equal,
greater than resp. */
......@@ -1304,7 +1304,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_Replace(
PyAPI_FUNC(int) PyUnicode_Compare(
PyObject *left, /* Left string */
PyObject *right /* Right string */
);
) PYSTON_NOEXCEPT;
/* Rich compare two strings and return one of the following:
......@@ -1326,7 +1326,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_RichCompare(
PyObject *left, /* Left string */
PyObject *right, /* Right string */
int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */
);
) PYSTON_NOEXCEPT;
/* Apply a argument tuple or dictionary to a format string and return
the resulting Unicode string. */
......@@ -1334,7 +1334,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_RichCompare(
PyAPI_FUNC(PyObject *) PyUnicode_Format(
PyObject *format, /* Format string */
PyObject *args /* Argument tuple or dictionary */
);
) PYSTON_NOEXCEPT;
/* Checks whether element is contained in container and return 1/0
accordingly.
......@@ -1345,14 +1345,14 @@ PyAPI_FUNC(PyObject *) PyUnicode_Format(
PyAPI_FUNC(int) PyUnicode_Contains(
PyObject *container, /* Container string */
PyObject *element /* Element string */
);
) PYSTON_NOEXCEPT;
/* Externally visible for str.strip(unicode) */
PyAPI_FUNC(PyObject *) _PyUnicode_XStrip(
PyUnicodeObject *self,
int striptype,
PyObject *sepobj
);
) PYSTON_NOEXCEPT;
/* === Characters Type APIs =============================================== */
......@@ -1369,63 +1369,63 @@ PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[];
PyAPI_FUNC(int) _PyUnicode_IsLowercase(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsUppercase(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsTitlecase(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsWhitespace(
const Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsLinebreak(
const Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_ToDigit(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(double) _PyUnicode_ToNumeric(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsDigit(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsNumeric(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) _PyUnicode_IsAlpha(
Py_UNICODE ch /* Unicode character */
);
) PYSTON_NOEXCEPT;
#ifdef __cplusplus
}
......
......@@ -6,11 +6,11 @@
extern "C" {
#endif
PyAPI_FUNC(void) _PyWarnings_Init(void);
PyAPI_FUNC(void) _PyWarnings_Init(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t);
PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int,
const char *, PyObject *);
const char *, PyObject *) PYSTON_NOEXCEPT;
#define PyErr_WarnPy3k(msg, stacklevel) \
(Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0)
......
......@@ -215,7 +215,7 @@ static int recursive_isinstance(PyObject* inst, PyObject* cls) noexcept {
return retval;
}
extern "C" int PyObject_IsInstance(PyObject* inst, PyObject* cls) {
extern "C" int PyObject_IsInstance(PyObject* inst, PyObject* cls) noexcept {
static PyObject* name = NULL;
/* Quick test for an exact match */
......@@ -265,7 +265,7 @@ extern "C" int PyObject_IsInstance(PyObject* inst, PyObject* cls) {
return recursive_isinstance(inst, cls);
}
extern "C" PyObject* PyObject_CallFunctionObjArgs(PyObject* callable, ...) {
extern "C" PyObject* PyObject_CallFunctionObjArgs(PyObject* callable, ...) noexcept {
PyObject* args, *tmp;
va_list vargs;
......@@ -308,7 +308,7 @@ static int recursive_issubclass(PyObject* derived, PyObject* cls) noexcept {
return retval;
}
extern "C" int PyObject_IsSubclass(PyObject* derived, PyObject* cls) {
extern "C" int PyObject_IsSubclass(PyObject* derived, PyObject* cls) noexcept {
static PyObject* name = NULL;
if (PyTuple_Check(cls)) {
......
......@@ -29,7 +29,7 @@
namespace pyston {
extern "C" PyObject* PyErr_SetFromErrnoWithFilenameObject(PyObject* exc, PyObject* filenameObject) {
extern "C" PyObject* PyErr_SetFromErrnoWithFilenameObject(PyObject* exc, PyObject* filenameObject) noexcept {
PyObject* v;
// Pyston change: made const
const char* s;
......@@ -101,7 +101,7 @@ extern "C" PyObject* PyErr_SetFromErrnoWithFilenameObject(PyObject* exc, PyObjec
return NULL;
}
extern "C" PyObject* PyErr_SetFromErrnoWithFilename(PyObject* exc, const char* filename) {
extern "C" PyObject* PyErr_SetFromErrnoWithFilename(PyObject* exc, const char* filename) noexcept {
PyObject* name = filename ? PyString_FromString(filename) : NULL;
PyObject* result = PyErr_SetFromErrnoWithFilenameObject(exc, name);
Py_XDECREF(name);
......@@ -109,7 +109,7 @@ extern "C" PyObject* PyErr_SetFromErrnoWithFilename(PyObject* exc, const char* f
}
#ifdef MS_WINDOWS
extern "C" PyObject* PyErr_SetFromErrnoWithUnicodeFilename(PyObject* exc, const Py_UNICODE* filename) {
extern "C" PyObject* PyErr_SetFromErrnoWithUnicodeFilename(PyObject* exc, const Py_UNICODE* filename) noexcept {
PyObject* name = filename ? PyUnicode_FromUnicode(filename, wcslen(filename)) : NULL;
PyObject* result = PyErr_SetFromErrnoWithFilenameObject(exc, name);
Py_XDECREF(name);
......@@ -117,7 +117,7 @@ extern "C" PyObject* PyErr_SetFromErrnoWithUnicodeFilename(PyObject* exc, const
}
#endif /* MS_WINDOWS */
extern "C" void PyErr_Fetch(PyObject** p_type, PyObject** p_value, PyObject** p_traceback) {
extern "C" void PyErr_Fetch(PyObject** p_type, PyObject** p_value, PyObject** p_traceback) noexcept {
PyThreadState* tstate = PyThreadState_GET();
*p_type = tstate->curexc_type;
......@@ -129,13 +129,13 @@ extern "C" void PyErr_Fetch(PyObject** p_type, PyObject** p_value, PyObject** p_
tstate->curexc_traceback = NULL;
}
extern "C" PyObject* PyErr_SetFromErrno(PyObject* exc) {
extern "C" PyObject* PyErr_SetFromErrno(PyObject* exc) noexcept {
return PyErr_SetFromErrnoWithFilenameObject(exc, NULL);
}
/* Call when an exception has occurred but there is no way for Python
to handle it. Examples: exception in __del__ or during GC. */
extern "C" void PyErr_WriteUnraisable(PyObject* obj) {
extern "C" void PyErr_WriteUnraisable(PyObject* obj) noexcept {
PyObject* f, *t, *v, *tb;
PyErr_Fetch(&t, &v, &tb);
f = PySys_GetObject("stderr");
......@@ -191,7 +191,7 @@ static void print_error_text(PyObject* f, int offset, const char* text) noexcept
Py_FatalError("unimplemented");
}
extern "C" void PyErr_Display(PyObject* exception, PyObject* value, PyObject* tb) {
extern "C" void PyErr_Display(PyObject* exception, PyObject* value, PyObject* tb) noexcept {
int err = 0;
PyObject* f = PySys_GetObject("stderr");
Py_INCREF(value);
......@@ -287,7 +287,7 @@ static void handle_system_exit(void) noexcept {
Py_FatalError("unimplemented");
}
extern "C" void PyErr_PrintEx(int set_sys_last_vars) {
extern "C" void PyErr_PrintEx(int set_sys_last_vars) noexcept {
PyObject* exception, *v, *tb, *hook;
if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
......@@ -350,7 +350,7 @@ extern "C" void PyErr_PrintEx(int set_sys_last_vars) {
}
extern "C" void PyErr_Print() {
extern "C" void PyErr_Print() noexcept {
PyErr_PrintEx(1);
}
}
......@@ -28,7 +28,7 @@ typedef enum { unknown_format, ieee_big_endian_format, ieee_little_endian_format
static float_format_type double_format, float_format;
static float_format_type detected_double_format, detected_float_format;
static PyObject* float_getformat(PyTypeObject* v, PyObject* arg) {
static PyObject* float_getformat(PyTypeObject* v, PyObject* arg) noexcept {
char* s;
float_format_type r;
......@@ -69,7 +69,7 @@ PyDoc_STRVAR(float_getformat_doc, "float.__getformat__(typestr) -> string\n"
"'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the\n"
"format of floating point numbers used by the C type named by typestr.");
static PyObject* float_setformat(PyTypeObject* v, PyObject* args) {
static PyObject* float_setformat(PyTypeObject* v, PyObject* args) noexcept {
char* typestr;
char* format;
float_format_type f;
......@@ -118,7 +118,7 @@ static PyObject* float_setformat(PyTypeObject* v, PyObject* args) {
/*----------------------------------------------------------------------------
* _PyFloat_{Pack,Unpack}{4,8}. See floatobject.h.
*/
extern "C" int _PyFloat_Pack4(double x, unsigned char* p, int le) {
extern "C" int _PyFloat_Pack4(double x, unsigned char* p, int le) noexcept {
if (float_format == unknown_format) {
unsigned char sign;
int e;
......@@ -214,7 +214,7 @@ Overflow:
return -1;
}
extern "C" int _PyFloat_Pack8(double x, unsigned char* p, int le) {
extern "C" int _PyFloat_Pack8(double x, unsigned char* p, int le) noexcept {
if (double_format == unknown_format) {
unsigned char sign;
int e;
......@@ -334,7 +334,7 @@ extern "C" int _PyFloat_Pack8(double x, unsigned char* p, int le) {
}
}
double _PyFloat_Unpack4(const unsigned char* p, int le) {
double _PyFloat_Unpack4(const unsigned char* p, int le) noexcept {
if (float_format == unknown_format) {
unsigned char sign;
int e;
......@@ -405,7 +405,7 @@ double _PyFloat_Unpack4(const unsigned char* p, int le) {
}
}
double _PyFloat_Unpack8(const unsigned char* p, int le) {
double _PyFloat_Unpack8(const unsigned char* p, int le) noexcept {
if (double_format == unknown_format) {
unsigned char sign;
int e;
......
......@@ -32,7 +32,7 @@ namespace pyston {
#define FLAG_SIZE_T 1
static int countformat(const char* format, int endchar) {
static int countformat(const char* format, int endchar) noexcept {
int count = 0;
int level = 0;
while (level > 0 || *format != endchar) {
......@@ -196,7 +196,7 @@ static PyObject* do_mktuple(const char** p_format, va_list* p_va, int endchar, i
return v;
}
static PyObject* va_build_value(const char* fmt, va_list va, int flags) {
static PyObject* va_build_value(const char* fmt, va_list va, int flags) noexcept {
int n = countformat(fmt, '\0');
if (n < 0)
......@@ -214,11 +214,11 @@ static PyObject* va_build_value(const char* fmt, va_list va, int flags) {
return do_mktuple(&fmt, &lva, '\0', n, flags);
}
extern "C" PyObject* Py_VaBuildValue(const char* format, va_list va) {
extern "C" PyObject* Py_VaBuildValue(const char* format, va_list va) noexcept {
return va_build_value(format, va, 0);
}
extern "C" PyObject* _Py_BuildValue_SizeT(const char* fmt, ...) {
extern "C" PyObject* _Py_BuildValue_SizeT(const char* fmt, ...) noexcept {
va_list ap;
va_start(ap, fmt);
......@@ -228,7 +228,7 @@ extern "C" PyObject* _Py_BuildValue_SizeT(const char* fmt, ...) {
return r;
}
extern "C" PyObject* Py_BuildValue(const char* fmt, ...) {
extern "C" PyObject* Py_BuildValue(const char* fmt, ...) noexcept {
va_list ap;
va_start(ap, fmt);
......@@ -239,7 +239,7 @@ extern "C" PyObject* Py_BuildValue(const char* fmt, ...) {
}
extern "C" PyObject* Py_InitModule4(const char* name, PyMethodDef* methods, const char* doc, PyObject* self,
int apiver) {
int apiver) noexcept {
BoxedModule* module = createModule(name, "__builtin__");
Box* passthrough = static_cast<Box*>(self);
......@@ -264,14 +264,14 @@ extern "C" PyObject* Py_InitModule4(const char* name, PyMethodDef* methods, cons
return module;
}
extern "C" PyObject* PyModule_GetDict(PyObject* _m) {
extern "C" PyObject* PyModule_GetDict(PyObject* _m) noexcept {
BoxedModule* m = static_cast<BoxedModule*>(_m);
assert(m->cls == module_cls);
return makeAttrWrapper(m);
}
extern "C" int PyModule_AddObject(PyObject* _m, const char* name, PyObject* value) {
extern "C" int PyModule_AddObject(PyObject* _m, const char* name, PyObject* value) noexcept {
BoxedModule* m = static_cast<BoxedModule*>(_m);
assert(m->cls == module_cls);
......@@ -279,7 +279,7 @@ extern "C" int PyModule_AddObject(PyObject* _m, const char* name, PyObject* valu
return 0;
}
extern "C" int PyModule_AddIntConstant(PyObject* _m, const char* name, long value) {
extern "C" int PyModule_AddIntConstant(PyObject* _m, const char* name, long value) noexcept {
return PyModule_AddObject(_m, name, boxInt(value));
}
......
......@@ -26,11 +26,11 @@
namespace pyston {
extern "C" PyObject* PyObject_Unicode(PyObject* v) {
extern "C" PyObject* PyObject_Unicode(PyObject* v) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* _PyObject_Str(PyObject* v) {
extern "C" PyObject* _PyObject_Str(PyObject* v) noexcept {
if (v == NULL)
return boxStrConstant("<NULL>");
......@@ -45,7 +45,7 @@ extern "C" PyObject* _PyObject_Str(PyObject* v) {
}
}
extern "C" PyObject* PyObject_Str(PyObject* v) {
extern "C" PyObject* PyObject_Str(PyObject* v) noexcept {
PyObject* res = _PyObject_Str(v);
if (res == NULL)
return NULL;
......@@ -64,15 +64,15 @@ extern "C" PyObject* PyObject_Str(PyObject* v) {
return res;
}
extern "C" PyObject* PyObject_SelfIter(PyObject* obj) {
extern "C" PyObject* PyObject_SelfIter(PyObject* obj) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyObject_GenericSetAttr(PyObject* obj, PyObject* name, PyObject* value) {
extern "C" int PyObject_GenericSetAttr(PyObject* obj, PyObject* name, PyObject* value) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyObject_GetAttrString(PyObject* o, const char* attr) {
extern "C" PyObject* PyObject_GetAttrString(PyObject* o, const char* attr) noexcept {
// TODO do something like this? not sure if this is safe; will people expect that calling into a known function
// won't end up doing a GIL check?
// threading::GLDemoteRegion _gil_demote;
......@@ -85,7 +85,7 @@ extern "C" PyObject* PyObject_GetAttrString(PyObject* o, const char* attr) {
}
}
extern "C" int PyObject_HasAttrString(PyObject* v, const char* name) {
extern "C" int PyObject_HasAttrString(PyObject* v, const char* name) noexcept {
PyObject* res = PyObject_GetAttrString(v, name);
if (res != NULL) {
Py_DECREF(res);
......@@ -95,12 +95,12 @@ extern "C" int PyObject_HasAttrString(PyObject* v, const char* name) {
return 0;
}
extern "C" int PyObject_AsWriteBuffer(PyObject* obj, void** buffer, Py_ssize_t* buffer_len) {
extern "C" int PyObject_AsWriteBuffer(PyObject* obj, void** buffer, Py_ssize_t* buffer_len) noexcept {
Py_FatalError("unimplemented");
}
/* Return -1 if error; 1 if v op w; 0 if not (v op w). */
extern "C" int PyObject_RichCompareBool(PyObject* v, PyObject* w, int op) {
extern "C" int PyObject_RichCompareBool(PyObject* v, PyObject* w, int op) noexcept {
PyObject* res;
int ok;
......
......@@ -23,7 +23,7 @@ namespace pyston {
// FIXME duplicated with objmodel.cpp
static const std::string _new_str("__new__");
extern "C" void conservativeGCHandler(GCVisitor* v, Box* b) {
extern "C" void conservativeGCHandler(GCVisitor* v, Box* b) noexcept {
v->visitPotentialRange((void* const*)b, (void* const*)((char*)b + b->cls->tp_basicsize));
}
......@@ -133,7 +133,7 @@ static PyObject* wrap_binaryfunc(PyObject* self, PyObject* args, void* wrapped)
return (*func)(self, other);
}
static PyObject* wrap_binaryfunc_l(PyObject* self, PyObject* args, void* wrapped) {
static PyObject* wrap_binaryfunc_l(PyObject* self, PyObject* args, void* wrapped) noexcept {
binaryfunc func = (binaryfunc)wrapped;
PyObject* other;
......@@ -147,7 +147,7 @@ static PyObject* wrap_binaryfunc_l(PyObject* self, PyObject* args, void* wrapped
return (*func)(self, other);
}
static PyObject* wrap_binaryfunc_r(PyObject* self, PyObject* args, void* wrapped) {
static PyObject* wrap_binaryfunc_r(PyObject* self, PyObject* args, void* wrapped) noexcept {
binaryfunc func = (binaryfunc)wrapped;
PyObject* other;
......@@ -362,7 +362,7 @@ static PyObject* lookup_maybe(PyObject* self, const char* attrstr, PyObject** at
return obj;
}
extern "C" PyObject* _PyObject_LookupSpecial(PyObject* self, const char* attrstr, PyObject** attrobj) {
extern "C" PyObject* _PyObject_LookupSpecial(PyObject* self, const char* attrstr, PyObject** attrobj) noexcept {
assert(!PyInstance_Check(self));
return lookup_maybe(self, attrstr, attrobj);
}
......@@ -625,7 +625,7 @@ static PyObject* slot_sq_slice(PyObject* self, Py_ssize_t i, Py_ssize_t j) noexc
return call_method(self, "__getslice__", &getslice_str, "nn", i, j);
}
static int slot_sq_ass_item(PyObject* self, Py_ssize_t index, PyObject* value) {
static int slot_sq_ass_item(PyObject* self, Py_ssize_t index, PyObject* value) noexcept {
PyObject* res;
static PyObject* delitem_str, *setitem_str;
......@@ -639,7 +639,7 @@ static int slot_sq_ass_item(PyObject* self, Py_ssize_t index, PyObject* value) {
return 0;
}
static int slot_sq_ass_slice(PyObject* self, Py_ssize_t i, Py_ssize_t j, PyObject* value) {
static int slot_sq_ass_slice(PyObject* self, Py_ssize_t i, Py_ssize_t j, PyObject* value) noexcept {
PyObject* res;
static PyObject* delslice_str, *setslice_str;
......@@ -662,7 +662,7 @@ static int slot_sq_ass_slice(PyObject* self, Py_ssize_t i, Py_ssize_t j, PyObjec
return 0;
}
static int slot_sq_contains(PyObject* self, PyObject* value) {
static int slot_sq_contains(PyObject* self, PyObject* value) noexcept {
PyObject* func, *res, *args;
int result = -1;
......@@ -705,7 +705,7 @@ static int slot_sq_contains(PyObject* self, PyObject* value) {
/* Boolean helper for SLOT1BINFULL().
right.__class__ is a nontrivial subclass of left.__class__. */
static int method_is_overloaded(PyObject* left, PyObject* right, const char* name) {
static int method_is_overloaded(PyObject* left, PyObject* right, const char* name) noexcept {
PyObject* a, *b;
int ok;
......@@ -736,7 +736,7 @@ static int method_is_overloaded(PyObject* left, PyObject* right, const char* nam
}
#define SLOT1BINFULL(FUNCNAME, TESTFUNC, SLOTNAME, OPSTR, ROPSTR) \
static PyObject* FUNCNAME(PyObject* self, PyObject* other) { \
static PyObject* FUNCNAME(PyObject* self, PyObject* other) noexcept { \
static PyObject* cache_str, *rcache_str; \
int do_other = Py_TYPE(self) != Py_TYPE(other) && Py_TYPE(other)->tp_as_number != NULL \
&& Py_TYPE(other)->tp_as_number->SLOTNAME == TESTFUNC; \
......@@ -774,7 +774,7 @@ static int method_is_overloaded(PyObject* left, PyObject* right, const char* nam
SLOT1(slot_mp_subscript, "__getitem__", PyObject*, "O")
static int slot_mp_ass_subscript(PyObject* self, PyObject* key, PyObject* value) {
static int slot_mp_ass_subscript(PyObject* self, PyObject* key, PyObject* value) noexcept {
PyObject* res;
static PyObject* delitem_str, *setitem_str;
......@@ -795,11 +795,11 @@ SLOT1BIN(slot_nb_divide, nb_divide, "__div__", "__rdiv__")
SLOT1BIN(slot_nb_remainder, nb_remainder, "__mod__", "__rmod__")
SLOT1BIN(slot_nb_divmod, nb_divmod, "__divmod__", "__rdivmod__")
static PyObject* slot_nb_power(PyObject*, PyObject*, PyObject*);
static PyObject* slot_nb_power(PyObject*, PyObject*, PyObject*) noexcept;
SLOT1BINFULL(slot_nb_power_binary, slot_nb_power, nb_power, "__pow__", "__rpow__")
static PyObject* slot_nb_power(PyObject* self, PyObject* other, PyObject* modulus) {
static PyObject* slot_nb_power(PyObject* self, PyObject* other, PyObject* modulus) noexcept {
static PyObject* pow_str;
if (modulus == Py_None)
......@@ -860,7 +860,7 @@ SLOT1BIN(slot_nb_and, nb_and, "__and__", "__rand__")
SLOT1BIN(slot_nb_xor, nb_xor, "__xor__", "__rxor__")
SLOT1BIN(slot_nb_or, nb_or, "__or__", "__ror__")
static int slot_nb_coerce(PyObject** a, PyObject** b);
static int slot_nb_coerce(PyObject** a, PyObject** b) noexcept;
SLOT0(slot_nb_int, "__int__")
SLOT0(slot_nb_long, "__long__")
......@@ -870,7 +870,7 @@ SLOT0(slot_nb_hex, "__hex__")
typedef wrapper_def slotdef;
static void** slotptr(BoxedClass* type, int offset) {
static void** slotptr(BoxedClass* type, int offset) noexcept {
// We use the index into PyHeapTypeObject as the canonical way to represent offsets, even though we are not
// (currently) using that object representation
......@@ -1005,7 +1005,7 @@ static slotdef slotdefs[]
SQSLOT("__imul__", sq_inplace_repeat, NULL, wrap_indexargfunc, "x.__imul__(y) <==> x*=y"),
{ NULL, 0, NULL, NULL, NULL, 0 } };
static void init_slotdefs() {
static void init_slotdefs() noexcept {
static bool initialized = false;
if (initialized)
return;
......@@ -1042,7 +1042,7 @@ static void init_slotdefs() {
/* Return a slot pointer for a given name, but ONLY if the attribute has
exactly one slot function. The name must be an interned string. */
static void** resolve_slotdups(PyTypeObject* type, const std::string& name) {
static void** resolve_slotdups(PyTypeObject* type, const std::string& name) noexcept {
/* XXX Maybe this could be optimized more -- but is it worth it? */
/* pname and ptrs act as a little cache */
......@@ -1076,7 +1076,7 @@ static void** resolve_slotdups(PyTypeObject* type, const std::string& name) {
return res;
}
static const slotdef* update_one_slot(BoxedClass* type, const slotdef* p) {
static const slotdef* update_one_slot(BoxedClass* type, const slotdef* p) noexcept {
assert(p->name);
PyObject* descr;
......@@ -1152,7 +1152,7 @@ static const slotdef* update_one_slot(BoxedClass* type, const slotdef* p) {
return p;
}
bool update_slot(BoxedClass* self, const std::string& attr) {
bool update_slot(BoxedClass* self, const std::string& attr) noexcept {
bool updated = false;
for (const slotdef& p : slotdefs) {
if (!p.name)
......@@ -1166,7 +1166,7 @@ bool update_slot(BoxedClass* self, const std::string& attr) {
return updated;
}
void fixup_slot_dispatchers(BoxedClass* self) {
void fixup_slot_dispatchers(BoxedClass* self) noexcept {
init_slotdefs();
const slotdef* p = slotdefs;
......@@ -1183,7 +1183,7 @@ void fixup_slot_dispatchers(BoxedClass* self) {
}
}
static PyObject* tp_new_wrapper(PyTypeObject* self, BoxedTuple* args, Box* kwds) {
static PyObject* tp_new_wrapper(PyTypeObject* self, BoxedTuple* args, Box* kwds) noexcept {
RELEASE_ASSERT(isSubclass(self->cls, type_cls), "");
// ASSERT(self->tp_new != Py_CallPythonNew, "going to get in an infinite loop");
......@@ -1201,7 +1201,7 @@ static PyObject* tp_new_wrapper(PyTypeObject* self, BoxedTuple* args, Box* kwds)
return self->tp_new(subtype, new_args, kwds);
}
static void add_tp_new_wrapper(BoxedClass* type) {
static void add_tp_new_wrapper(BoxedClass* type) noexcept {
if (type->getattr("__new__"))
return;
......@@ -1209,7 +1209,7 @@ static void add_tp_new_wrapper(BoxedClass* type) {
new BoxedCApiFunction(METH_VARARGS | METH_KEYWORDS, type, "__new__", (PyCFunction)tp_new_wrapper));
}
static void add_operators(BoxedClass* cls) {
static void add_operators(BoxedClass* cls) noexcept {
init_slotdefs();
for (const slotdef& p : slotdefs) {
......@@ -1234,14 +1234,14 @@ static void add_operators(BoxedClass* cls) {
add_tp_new_wrapper(cls);
}
extern "C" int PyType_IsSubtype(PyTypeObject* a, PyTypeObject* b) {
extern "C" int PyType_IsSubtype(PyTypeObject* a, PyTypeObject* b) noexcept {
return isSubclass(a, b);
}
#define BUFFER_FLAGS (Py_TPFLAGS_HAVE_GETCHARBUFFER | Py_TPFLAGS_HAVE_NEWBUFFER)
// This is copied from CPython with some modifications:
static void inherit_special(PyTypeObject* type, PyTypeObject* base) {
static void inherit_special(PyTypeObject* type, PyTypeObject* base) noexcept {
Py_ssize_t oldsize, newsize;
/* Special flag magic */
......@@ -1338,7 +1338,7 @@ static void inherit_special(PyTypeObject* type, PyTypeObject* base) {
#endif
}
static int overrides_name(PyTypeObject* type, const char* name) {
static int overrides_name(PyTypeObject* type, const char* name) noexcept {
PyObject* dict = type->tp_dict;
assert(dict != NULL);
......@@ -1351,7 +1351,7 @@ static int overrides_name(PyTypeObject* type, const char* name) {
#define OVERRIDES_HASH(x) overrides_name(x, "__hash__")
#define OVERRIDES_EQ(x) overrides_name(x, "__eq__")
static void inherit_slots(PyTypeObject* type, PyTypeObject* base) {
static void inherit_slots(PyTypeObject* type, PyTypeObject* base) noexcept {
// Pyston addition:
if (base->tp_base == NULL)
assert(base == object_cls);
......@@ -1553,7 +1553,7 @@ void PystonType_Ready(BoxedClass* cls) {
}
}
extern "C" int PyType_Ready(PyTypeObject* cls) {
extern "C" int PyType_Ready(PyTypeObject* cls) noexcept {
gc::registerNonheapRootObject(cls);
// unhandled fields:
......
......@@ -20,9 +20,9 @@
namespace pyston {
// Returns if a slot was updated
bool update_slot(BoxedClass* self, const std::string& attr);
bool update_slot(BoxedClass* self, const std::string& attr) noexcept;
void fixup_slot_dispatchers(BoxedClass* self);
void fixup_slot_dispatchers(BoxedClass* self) noexcept;
void PystonType_Ready(BoxedClass* cls);
}
......
......@@ -424,7 +424,7 @@ void finishMainThread() {
// TODO maybe this is the place to wait for non-daemon threads?
}
extern "C" void PyEval_ReInitThreads() {
extern "C" void PyEval_ReInitThreads() noexcept {
pthread_t current_thread = pthread_self();
assert(current_threads.count(pthread_self()));
......@@ -447,7 +447,7 @@ extern "C" void PyEval_ReInitThreads() {
// It adds some perf overhead I suppose, though I haven't measured it.
// It also means that you're not allowed to do that much inside an AllowThreads region...
// TODO maybe we should let the client decide which way to handle it
extern "C" void beginAllowThreads() {
extern "C" void beginAllowThreads() noexcept {
// I don't think it matters whether the GL release happens before or after the state
// saving; do it before, then, to reduce the amount we hold the GL:
releaseGLRead();
......@@ -461,7 +461,7 @@ extern "C" void beginAllowThreads() {
}
}
extern "C" void endAllowThreads() {
extern "C" void endAllowThreads() noexcept {
{
LOCK_REGION(&threading_lock);
ThreadStateInternal* state = current_threads[pthread_self()];
......
......@@ -101,8 +101,8 @@ MAKE_REGION(GLPromoteRegion, promoteGL, demoteGL);
// MAKE_REGION(GLWriteReleaseRegion, releaseGLWrite, acquireGLWrite);
#undef MAKE_REGION
extern "C" void beginAllowThreads();
extern "C" void endAllowThreads();
extern "C" void beginAllowThreads() noexcept;
extern "C" void endAllowThreads() noexcept;
class GLAllowThreadsReadRegion {
public:
......
......@@ -31,17 +31,17 @@
namespace pyston {
namespace gc {
extern "C" void* gc_compat_malloc(size_t sz) {
extern "C" void* gc_compat_malloc(size_t sz) noexcept {
return gc_alloc(sz, GCKind::CONSERVATIVE);
}
extern "C" void* gc_compat_realloc(void* ptr, size_t sz) {
extern "C" void* gc_compat_realloc(void* ptr, size_t sz) noexcept {
if (ptr == NULL)
return gc_alloc(sz, GCKind::CONSERVATIVE);
return gc_realloc(ptr, sz);
}
extern "C" void gc_compat_free(void* ptr) {
extern "C" void gc_compat_free(void* ptr) noexcept {
gc_free(ptr);
}
......
......@@ -22,7 +22,7 @@ namespace pyston {
Box* True, *False;
extern "C" PyObject* PyBool_FromLong(long n) {
extern "C" PyObject* PyBool_FromLong(long n) noexcept {
return boxBool(n != 0);
}
......
......@@ -603,7 +603,7 @@ static BoxedClass* makeBuiltinException(BoxedClass* base, const char* name, int
return cls;
}
extern "C" PyObject* PyErr_NewException(char* name, PyObject* _base, PyObject* dict) {
extern "C" PyObject* PyErr_NewException(char* name, PyObject* _base, PyObject* dict) noexcept {
RELEASE_ASSERT(_base == NULL, "unimplemented");
RELEASE_ASSERT(dict == NULL, "unimplemented");
......
......@@ -75,7 +75,7 @@ Box* getSysStdout() {
return sys_stdout;
}
extern "C" int PySys_SetObject(const char* name, PyObject* v) {
extern "C" int PySys_SetObject(const char* name, PyObject* v) noexcept {
try {
if (!v) {
if (sys_module->getattr(name))
......@@ -88,7 +88,7 @@ extern "C" int PySys_SetObject(const char* name, PyObject* v) {
return 0;
}
extern "C" PyObject* PySys_GetObject(const char* name) {
extern "C" PyObject* PySys_GetObject(const char* name) noexcept {
return sys_module->getattr(name);
}
......@@ -118,7 +118,7 @@ static void mywrite(const char* name, FILE* fp, const char* format, va_list va)
PyErr_Restore(error_type, error_value, error_traceback);
}
extern "C" void PySys_WriteStdout(const char* format, ...) {
extern "C" void PySys_WriteStdout(const char* format, ...) noexcept {
va_list va;
va_start(va, format);
......@@ -126,7 +126,7 @@ extern "C" void PySys_WriteStdout(const char* format, ...) {
va_end(va);
}
extern "C" void PySys_WriteStderr(const char* format, ...) {
extern "C" void PySys_WriteStderr(const char* format, ...) noexcept {
va_list va;
va_start(va, format);
......
......@@ -32,9 +32,9 @@ namespace pyston {
BoxedClass* method_cls;
#define MAKE_CHECK(NAME, cls_name) \
extern "C" bool Py##NAME##_Check(PyObject* op) { return isSubclass(op->cls, cls_name); }
extern "C" bool Py##NAME##_Check(PyObject* op) noexcept { return isSubclass(op->cls, cls_name); }
#define MAKE_CHECK2(NAME, cls_name) \
extern "C" bool _Py##NAME##_Check(PyObject* op) { return isSubclass(op->cls, cls_name); }
extern "C" bool _Py##NAME##_Check(PyObject* op) noexcept { return isSubclass(op->cls, cls_name); }
MAKE_CHECK2(Int, int_cls)
MAKE_CHECK2(String, str_cls)
......@@ -52,7 +52,7 @@ MAKE_CHECK(Unicode, unicode_cls)
#undef MAKE_CHECK
#undef MAKE_CHECK2
extern "C" bool _PyIndex_Check(PyObject* op) {
extern "C" bool _PyIndex_Check(PyObject* op) noexcept {
// TODO this is wrong (the CPython version checks for things that can be coerced to a number):
return PyInt_Check(op);
}
......@@ -63,7 +63,7 @@ int Py_Py3kWarningFlag;
BoxedClass* capifunc_cls;
extern "C" PyObject* PyType_GenericAlloc(PyTypeObject* cls, Py_ssize_t nitems) {
extern "C" PyObject* PyType_GenericAlloc(PyTypeObject* cls, Py_ssize_t nitems) noexcept {
RELEASE_ASSERT(nitems == 0, "unimplemented");
RELEASE_ASSERT(cls->tp_itemsize == 0, "unimplemented");
......@@ -90,7 +90,8 @@ Box* BoxedWrapperDescriptor::__get__(BoxedWrapperDescriptor* self, Box* inst, Bo
}
// copied from CPython's getargs.c:
extern "C" int PyBuffer_FillInfo(Py_buffer* view, PyObject* obj, void* buf, Py_ssize_t len, int readonly, int flags) {
extern "C" int PyBuffer_FillInfo(Py_buffer* view, PyObject* obj, void* buf, Py_ssize_t len, int readonly,
int flags) noexcept {
if (view == NULL)
return 0;
if (((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) && (readonly == 1)) {
......@@ -122,7 +123,7 @@ extern "C" int PyBuffer_FillInfo(Py_buffer* view, PyObject* obj, void* buf, Py_s
return 0;
}
extern "C" void PyBuffer_Release(Py_buffer* view) {
extern "C" void PyBuffer_Release(Py_buffer* view) noexcept {
if (!view->buf) {
assert(!view->obj);
return;
......@@ -137,11 +138,11 @@ extern "C" void PyBuffer_Release(Py_buffer* view) {
view->obj = NULL;
}
extern "C" void _PyErr_BadInternalCall(const char* filename, int lineno) {
extern "C" void _PyErr_BadInternalCall(const char* filename, int lineno) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) {
extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) noexcept {
RELEASE_ASSERT(op, "");
RELEASE_ASSERT(tp, "");
......@@ -161,7 +162,7 @@ extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) {
return op;
}
extern "C" PyVarObject* PyObject_InitVar(PyVarObject* op, PyTypeObject* tp, Py_ssize_t size) {
extern "C" PyVarObject* PyObject_InitVar(PyVarObject* op, PyTypeObject* tp, Py_ssize_t size) noexcept {
assert(gc::isValidGCObject(op));
assert(gc::isValidGCObject(tp));
......@@ -172,7 +173,7 @@ extern "C" PyVarObject* PyObject_InitVar(PyVarObject* op, PyTypeObject* tp, Py_s
return op;
}
extern "C" PyObject* _PyObject_New(PyTypeObject* cls) {
extern "C" PyObject* _PyObject_New(PyTypeObject* cls) noexcept {
assert(cls->tp_itemsize == 0);
auto rtn = (PyObject*)gc_alloc(cls->tp_basicsize, gc::GCKind::PYTHON);
......@@ -182,36 +183,36 @@ extern "C" PyObject* _PyObject_New(PyTypeObject* cls) {
return rtn;
}
extern "C" void PyObject_Free(void* p) {
extern "C" void PyObject_Free(void* p) noexcept {
gc::gc_free(p);
ASSERT(0, "I think this is good enough but I'm not sure; should test");
}
extern "C" PyObject* _PyObject_GC_Malloc(size_t) {
extern "C" PyObject* _PyObject_GC_Malloc(size_t) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* _PyObject_GC_New(PyTypeObject* cls) {
extern "C" PyObject* _PyObject_GC_New(PyTypeObject* cls) noexcept {
return _PyObject_New(cls);
}
extern "C" PyVarObject* _PyObject_GC_NewVar(PyTypeObject*, Py_ssize_t) {
extern "C" PyVarObject* _PyObject_GC_NewVar(PyTypeObject*, Py_ssize_t) noexcept {
Py_FatalError("unimplemented");
}
extern "C" void PyObject_GC_Track(void*) {
extern "C" void PyObject_GC_Track(void*) noexcept {
// TODO do we have to do anything to support the C API GC protocol?
}
extern "C" void PyObject_GC_UnTrack(void*) {
extern "C" void PyObject_GC_UnTrack(void*) noexcept {
// TODO do we have to do anything to support the C API GC protocol?
}
extern "C" void PyObject_GC_Del(void*) {
extern "C" void PyObject_GC_Del(void*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyObject_CallObject(PyObject* obj, PyObject* args) {
extern "C" PyObject* PyObject_CallObject(PyObject* obj, PyObject* args) noexcept {
RELEASE_ASSERT(args, ""); // actually it looks like this is allowed to be NULL
RELEASE_ASSERT(args->cls == tuple_cls, "");
......@@ -227,15 +228,15 @@ extern "C" PyObject* PyObject_CallObject(PyObject* obj, PyObject* args) {
}
}
extern "C" PyObject* PyObject_CallMethod(PyObject* o, char* name, char* format, ...) {
extern "C" PyObject* PyObject_CallMethod(PyObject* o, char* name, char* format, ...) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* _PyObject_CallMethod_SizeT(PyObject* o, char* name, char* format, ...) {
extern "C" PyObject* _PyObject_CallMethod_SizeT(PyObject* o, char* name, char* format, ...) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyObject_Size(PyObject* o) {
extern "C" Py_ssize_t PyObject_Size(PyObject* o) noexcept {
try {
return len(o)->n;
} catch (Box* b) {
......@@ -243,11 +244,11 @@ extern "C" Py_ssize_t PyObject_Size(PyObject* o) {
}
}
extern "C" PyObject* PyObject_GetIter(PyObject*) {
extern "C" PyObject* PyObject_GetIter(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyObject_Repr(PyObject* obj) {
extern "C" PyObject* PyObject_Repr(PyObject* obj) noexcept {
try {
return repr(obj);
} catch (Box* b) {
......@@ -255,7 +256,7 @@ extern "C" PyObject* PyObject_Repr(PyObject* obj) {
}
}
extern "C" PyObject* PyObject_Format(PyObject* obj, PyObject* format_spec) {
extern "C" PyObject* PyObject_Format(PyObject* obj, PyObject* format_spec) noexcept {
PyObject* empty = NULL;
PyObject* result = NULL;
#ifdef Py_USING_UNICODE
......@@ -401,7 +402,7 @@ done:
}
extern "C" PyObject* PyObject_GetAttr(PyObject* o, PyObject* attr_name) {
extern "C" PyObject* PyObject_GetAttr(PyObject* o, PyObject* attr_name) noexcept {
if (!isSubclass(attr_name->cls, str_cls)) {
PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", Py_TYPE(attr_name)->tp_name);
return NULL;
......@@ -414,11 +415,11 @@ extern "C" PyObject* PyObject_GetAttr(PyObject* o, PyObject* attr_name) {
}
}
extern "C" PyObject* PyObject_GenericGetAttr(PyObject* o, PyObject* name) {
extern "C" PyObject* PyObject_GenericGetAttr(PyObject* o, PyObject* name) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyObject_GetItem(PyObject* o, PyObject* key) {
extern "C" PyObject* PyObject_GetItem(PyObject* o, PyObject* key) noexcept {
try {
return getitem(o, key);
} catch (Box* b) {
......@@ -427,15 +428,15 @@ extern "C" PyObject* PyObject_GetItem(PyObject* o, PyObject* key) {
}
}
extern "C" int PyObject_SetItem(PyObject* o, PyObject* key, PyObject* v) {
extern "C" int PyObject_SetItem(PyObject* o, PyObject* key, PyObject* v) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyObject_DelItem(PyObject* o, PyObject* key) {
extern "C" int PyObject_DelItem(PyObject* o, PyObject* key) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyObject_RichCompare(PyObject* o1, PyObject* o2, int opid) {
extern "C" PyObject* PyObject_RichCompare(PyObject* o1, PyObject* o2, int opid) noexcept {
Py_FatalError("unimplemented");
}
......@@ -443,7 +444,7 @@ extern "C" {
int _Py_SwappedOp[] = { Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE };
}
extern "C" long PyObject_Hash(PyObject* o) {
extern "C" long PyObject_Hash(PyObject* o) noexcept {
try {
return hash(o)->n;
} catch (Box* b) {
......@@ -451,17 +452,17 @@ extern "C" long PyObject_Hash(PyObject* o) {
}
}
extern "C" long PyObject_HashNotImplemented(PyObject* self) {
extern "C" long PyObject_HashNotImplemented(PyObject* self) noexcept {
PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'", Py_TYPE(self)->tp_name);
return -1;
}
extern "C" PyObject* _PyObject_NextNotImplemented(PyObject* self) {
extern "C" PyObject* _PyObject_NextNotImplemented(PyObject* self) noexcept {
PyErr_Format(PyExc_TypeError, "'%.200s' object is not iterable", Py_TYPE(self)->tp_name);
return NULL;
}
extern "C" long _Py_HashPointer(void* p) {
extern "C" long _Py_HashPointer(void* p) noexcept {
long x;
size_t y = (size_t)p;
/* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid
......@@ -473,7 +474,7 @@ extern "C" long _Py_HashPointer(void* p) {
return x;
}
extern "C" int PyObject_IsTrue(PyObject* o) {
extern "C" int PyObject_IsTrue(PyObject* o) noexcept {
try {
return nonzero(o);
} catch (Box* b) {
......@@ -482,11 +483,11 @@ extern "C" int PyObject_IsTrue(PyObject* o) {
}
extern "C" int PyObject_Not(PyObject* o) {
extern "C" int PyObject_Not(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyEval_CallObjectWithKeywords(PyObject* func, PyObject* arg, PyObject* kw) {
extern "C" PyObject* PyEval_CallObjectWithKeywords(PyObject* func, PyObject* arg, PyObject* kw) noexcept {
PyObject* result;
if (arg == NULL) {
......@@ -510,7 +511,7 @@ extern "C" PyObject* PyEval_CallObjectWithKeywords(PyObject* func, PyObject* arg
return result;
}
extern "C" PyObject* PyObject_Call(PyObject* callable_object, PyObject* args, PyObject* kw) {
extern "C" PyObject* PyObject_Call(PyObject* callable_object, PyObject* args, PyObject* kw) noexcept {
try {
if (kw)
return runtimeCall(callable_object, ArgPassSpec(0, 0, true, true), args, kw, NULL, NULL, NULL);
......@@ -521,43 +522,43 @@ extern "C" PyObject* PyObject_Call(PyObject* callable_object, PyObject* args, Py
}
}
extern "C" void PyObject_ClearWeakRefs(PyObject* object) {
extern "C" void PyObject_ClearWeakRefs(PyObject* object) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyObject_GetBuffer(PyObject* exporter, Py_buffer* view, int flags) {
extern "C" int PyObject_GetBuffer(PyObject* exporter, Py_buffer* view, int flags) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyObject_Print(PyObject* obj, FILE* fp, int flags) {
extern "C" int PyObject_Print(PyObject* obj, FILE* fp, int flags) noexcept {
Py_FatalError("unimplemented");
};
extern "C" int PySequence_Check(PyObject*) {
extern "C" int PySequence_Check(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PySequence_Size(PyObject* o) {
extern "C" Py_ssize_t PySequence_Size(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_Concat(PyObject* o1, PyObject* o2) {
extern "C" PyObject* PySequence_Concat(PyObject* o1, PyObject* o2) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_Repeat(PyObject* o, Py_ssize_t count) {
extern "C" PyObject* PySequence_Repeat(PyObject* o, Py_ssize_t count) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_InPlaceConcat(PyObject* o1, PyObject* o2) {
extern "C" PyObject* PySequence_InPlaceConcat(PyObject* o1, PyObject* o2) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_InPlaceRepeat(PyObject* o, Py_ssize_t count) {
extern "C" PyObject* PySequence_InPlaceRepeat(PyObject* o, Py_ssize_t count) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_GetItem(PyObject* o, Py_ssize_t i) {
extern "C" PyObject* PySequence_GetItem(PyObject* o, Py_ssize_t i) noexcept {
try {
// Not sure if this is really the same:
return getitem(o, boxInt(i));
......@@ -566,7 +567,7 @@ extern "C" PyObject* PySequence_GetItem(PyObject* o, Py_ssize_t i) {
}
}
extern "C" PyObject* PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2) {
extern "C" PyObject* PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2) noexcept {
try {
// Not sure if this is really the same:
return getitem(o, new BoxedSlice(boxInt(i1), boxInt(i2), None));
......@@ -575,51 +576,51 @@ extern "C" PyObject* PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t
}
}
extern "C" int PySequence_SetItem(PyObject* o, Py_ssize_t i, PyObject* v) {
extern "C" int PySequence_SetItem(PyObject* o, Py_ssize_t i, PyObject* v) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PySequence_DelItem(PyObject* o, Py_ssize_t i) {
extern "C" int PySequence_DelItem(PyObject* o, Py_ssize_t i) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PySequence_SetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2, PyObject* v) {
extern "C" int PySequence_SetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2, PyObject* v) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PySequence_DelSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2) {
extern "C" int PySequence_DelSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PySequence_Count(PyObject* o, PyObject* value) {
extern "C" Py_ssize_t PySequence_Count(PyObject* o, PyObject* value) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PySequence_Contains(PyObject* o, PyObject* value) {
extern "C" int PySequence_Contains(PyObject* o, PyObject* value) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PySequence_Index(PyObject* o, PyObject* value) {
extern "C" Py_ssize_t PySequence_Index(PyObject* o, PyObject* value) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_List(PyObject* o) {
extern "C" PyObject* PySequence_List(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_Tuple(PyObject* o) {
extern "C" PyObject* PySequence_Tuple(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PySequence_Fast(PyObject* o, const char* m) {
extern "C" PyObject* PySequence_Fast(PyObject* o, const char* m) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyIter_Next(PyObject*) {
extern "C" PyObject* PyIter_Next(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyCallable_Check(PyObject* x) {
extern "C" int PyCallable_Check(PyObject* x) noexcept {
if (x == NULL)
return 0;
......@@ -627,7 +628,7 @@ extern "C" int PyCallable_Check(PyObject* x) {
return typeLookup(x->cls, call_attr, NULL) != NULL;
}
extern "C" int Py_FlushLine(void) {
extern "C" int Py_FlushLine(void) noexcept {
PyObject* f = PySys_GetObject("stdout");
if (f == NULL)
return 0;
......@@ -636,7 +637,7 @@ extern "C" int Py_FlushLine(void) {
return PyFile_WriteString("\n", f);
}
extern "C" void PyErr_NormalizeException(PyObject** exc, PyObject** val, PyObject** tb) {
extern "C" void PyErr_NormalizeException(PyObject** exc, PyObject** val, PyObject** tb) noexcept {
PyObject* type = *exc;
PyObject* value = *val;
PyObject* inclass = NULL;
......@@ -762,54 +763,54 @@ void checkAndThrowCAPIException() {
}
}
extern "C" void PyErr_Restore(PyObject* type, PyObject* value, PyObject* traceback) {
extern "C" void PyErr_Restore(PyObject* type, PyObject* value, PyObject* traceback) noexcept {
cur_thread_state.curexc_type = type;
cur_thread_state.curexc_value = value;
cur_thread_state.curexc_traceback = traceback;
}
extern "C" void PyErr_Clear() {
extern "C" void PyErr_Clear() noexcept {
PyErr_Restore(NULL, NULL, NULL);
}
extern "C" void PyErr_SetString(PyObject* exception, const char* string) {
extern "C" void PyErr_SetString(PyObject* exception, const char* string) noexcept {
PyErr_SetObject(exception, boxStrConstant(string));
}
extern "C" void PyErr_SetObject(PyObject* exception, PyObject* value) {
extern "C" void PyErr_SetObject(PyObject* exception, PyObject* value) noexcept {
PyErr_Restore(exception, value, NULL);
}
extern "C" PyObject* PyErr_Format(PyObject* exception, const char* format, ...) {
extern "C" PyObject* PyErr_Format(PyObject* exception, const char* format, ...) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyErr_NoMemory() {
extern "C" PyObject* PyErr_NoMemory() noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyErr_CheckSignals() {
extern "C" int PyErr_CheckSignals() noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyExceptionClass_Check(PyObject* o) {
extern "C" int PyExceptionClass_Check(PyObject* o) noexcept {
return PyClass_Check(o) || (PyType_Check(o) && isSubclass(static_cast<BoxedClass*>(o), BaseException));
}
extern "C" int PyExceptionInstance_Check(PyObject* o) {
extern "C" int PyExceptionInstance_Check(PyObject* o) noexcept {
return PyInstance_Check(o) || isSubclass(o->cls, BaseException);
}
extern "C" const char* PyExceptionClass_Name(PyObject* o) {
extern "C" const char* PyExceptionClass_Name(PyObject* o) noexcept {
return PyClass_Check(o) ? PyString_AS_STRING(static_cast<BoxedClassobj*>(o)->name)
: static_cast<BoxedClass*>(o)->tp_name;
}
extern "C" PyObject* PyExceptionInstance_Class(PyObject* o) {
extern "C" PyObject* PyExceptionInstance_Class(PyObject* o) noexcept {
return PyInstance_Check(o) ? (Box*)static_cast<BoxedInstance*>(o)->inst_cls : o->cls;
}
extern "C" int PyTraceBack_Print(PyObject* v, PyObject* f) {
extern "C" int PyTraceBack_Print(PyObject* v, PyObject* f) noexcept {
Py_FatalError("unimplemented");
}
......@@ -824,7 +825,7 @@ int _Py_CheckRecursionLimit = Py_DEFAULT_RECURSION_LIMIT;
If USE_STACKCHECK, the macro decrements _Py_CheckRecursionLimit
to guarantee that _Py_CheckRecursiveCall() is regularly called.
Without USE_STACKCHECK, there is no need for this. */
extern "C" int _Py_CheckRecursiveCall(const char* where) {
extern "C" int _Py_CheckRecursiveCall(const char* where) noexcept {
PyThreadState* tstate = PyThreadState_GET();
#ifdef USE_STACKCHECK
......@@ -843,16 +844,16 @@ extern "C" int _Py_CheckRecursiveCall(const char* where) {
return 0;
}
extern "C" int Py_GetRecursionLimit(void) {
extern "C" int Py_GetRecursionLimit(void) noexcept {
return recursion_limit;
}
extern "C" void Py_SetRecursionLimit(int new_limit) {
extern "C" void Py_SetRecursionLimit(int new_limit) noexcept {
recursion_limit = new_limit;
_Py_CheckRecursionLimit = recursion_limit;
}
extern "C" int PyErr_GivenExceptionMatches(PyObject* err, PyObject* exc) {
extern "C" int PyErr_GivenExceptionMatches(PyObject* err, PyObject* exc) noexcept {
if (err == NULL || exc == NULL) {
/* maybe caused by "import exceptions" that failed early on */
return 0;
......@@ -897,19 +898,19 @@ extern "C" int PyErr_GivenExceptionMatches(PyObject* err, PyObject* exc) {
return err == exc;
}
extern "C" int PyErr_ExceptionMatches(PyObject* exc) {
extern "C" int PyErr_ExceptionMatches(PyObject* exc) noexcept {
return PyErr_GivenExceptionMatches(PyErr_Occurred(), exc);
}
extern "C" PyObject* PyErr_Occurred() {
extern "C" PyObject* PyErr_Occurred() noexcept {
return cur_thread_state.curexc_type;
}
extern "C" int PyErr_WarnEx(PyObject* category, const char* text, Py_ssize_t stacklevel) {
extern "C" int PyErr_WarnEx(PyObject* category, const char* text, Py_ssize_t stacklevel) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyImport_Import(PyObject* module_name) {
extern "C" PyObject* PyImport_Import(PyObject* module_name) noexcept {
RELEASE_ASSERT(module_name, "");
RELEASE_ASSERT(module_name->cls == str_cls, "");
......@@ -921,23 +922,23 @@ extern "C" PyObject* PyImport_Import(PyObject* module_name) {
}
extern "C" PyObject* PyCallIter_New(PyObject* callable, PyObject* sentinel) {
extern "C" PyObject* PyCallIter_New(PyObject* callable, PyObject* sentinel) noexcept {
Py_FatalError("unimplemented");
}
extern "C" void* PyMem_Malloc(size_t sz) {
extern "C" void* PyMem_Malloc(size_t sz) noexcept {
return gc_compat_malloc(sz);
}
extern "C" void* PyMem_Realloc(void* ptr, size_t sz) {
extern "C" void* PyMem_Realloc(void* ptr, size_t sz) noexcept {
return gc_compat_realloc(ptr, sz);
}
extern "C" void PyMem_Free(void* ptr) {
extern "C" void PyMem_Free(void* ptr) noexcept {
gc_compat_free(ptr);
}
extern "C" int PyNumber_Check(PyObject* obj) {
extern "C" int PyNumber_Check(PyObject* obj) noexcept {
assert(obj && obj->cls);
// Our check, since we don't currently fill in tp_as_number:
......@@ -948,7 +949,7 @@ extern "C" int PyNumber_Check(PyObject* obj) {
return obj->cls->tp_as_number && (obj->cls->tp_as_number->nb_int || obj->cls->tp_as_number->nb_float);
}
extern "C" PyObject* PyNumber_Add(PyObject* lhs, PyObject* rhs) {
extern "C" PyObject* PyNumber_Add(PyObject* lhs, PyObject* rhs) noexcept {
try {
return binop(lhs, rhs, AST_TYPE::Add);
} catch (Box* b) {
......@@ -956,7 +957,7 @@ extern "C" PyObject* PyNumber_Add(PyObject* lhs, PyObject* rhs) {
}
}
extern "C" PyObject* PyNumber_Subtract(PyObject* lhs, PyObject* rhs) {
extern "C" PyObject* PyNumber_Subtract(PyObject* lhs, PyObject* rhs) noexcept {
try {
return binop(lhs, rhs, AST_TYPE::Sub);
} catch (Box* b) {
......@@ -964,7 +965,7 @@ extern "C" PyObject* PyNumber_Subtract(PyObject* lhs, PyObject* rhs) {
}
}
extern "C" PyObject* PyNumber_Multiply(PyObject* lhs, PyObject* rhs) {
extern "C" PyObject* PyNumber_Multiply(PyObject* lhs, PyObject* rhs) noexcept {
try {
return binop(lhs, rhs, AST_TYPE::Mult);
} catch (Box* b) {
......@@ -972,7 +973,7 @@ extern "C" PyObject* PyNumber_Multiply(PyObject* lhs, PyObject* rhs) {
}
}
extern "C" PyObject* PyNumber_Divide(PyObject* lhs, PyObject* rhs) {
extern "C" PyObject* PyNumber_Divide(PyObject* lhs, PyObject* rhs) noexcept {
try {
return binop(lhs, rhs, AST_TYPE::Div);
} catch (Box* b) {
......@@ -980,15 +981,15 @@ extern "C" PyObject* PyNumber_Divide(PyObject* lhs, PyObject* rhs) {
}
}
extern "C" PyObject* PyNumber_FloorDivide(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_FloorDivide(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_TrueDivide(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_TrueDivide(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Remainder(PyObject* lhs, PyObject* rhs) {
extern "C" PyObject* PyNumber_Remainder(PyObject* lhs, PyObject* rhs) noexcept {
try {
return binop(lhs, rhs, AST_TYPE::Mod);
} catch (Box* b) {
......@@ -996,23 +997,23 @@ extern "C" PyObject* PyNumber_Remainder(PyObject* lhs, PyObject* rhs) {
}
}
extern "C" PyObject* PyNumber_Divmod(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_Divmod(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Power(PyObject*, PyObject*, PyObject* o3) {
extern "C" PyObject* PyNumber_Power(PyObject*, PyObject*, PyObject* o3) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Negative(PyObject* o) {
extern "C" PyObject* PyNumber_Negative(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Positive(PyObject* o) {
extern "C" PyObject* PyNumber_Positive(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Absolute(PyObject* o) {
extern "C" PyObject* PyNumber_Absolute(PyObject* o) noexcept {
try {
return abs_(o);
} catch (Box* b) {
......@@ -1020,15 +1021,15 @@ extern "C" PyObject* PyNumber_Absolute(PyObject* o) {
}
}
extern "C" PyObject* PyNumber_Invert(PyObject* o) {
extern "C" PyObject* PyNumber_Invert(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Lshift(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_Lshift(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Rshift(PyObject* lhs, PyObject* rhs) {
extern "C" PyObject* PyNumber_Rshift(PyObject* lhs, PyObject* rhs) noexcept {
try {
return binop(lhs, rhs, AST_TYPE::RShift);
} catch (Box* b) {
......@@ -1036,7 +1037,7 @@ extern "C" PyObject* PyNumber_Rshift(PyObject* lhs, PyObject* rhs) {
}
}
extern "C" PyObject* PyNumber_And(PyObject* lhs, PyObject* rhs) {
extern "C" PyObject* PyNumber_And(PyObject* lhs, PyObject* rhs) noexcept {
try {
return binop(lhs, rhs, AST_TYPE::BitAnd);
} catch (Box* b) {
......@@ -1044,95 +1045,95 @@ extern "C" PyObject* PyNumber_And(PyObject* lhs, PyObject* rhs) {
}
}
extern "C" PyObject* PyNumber_Xor(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_Xor(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Or(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_Or(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceAdd(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceAdd(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceSubtract(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceSubtract(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceMultiply(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceMultiply(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceDivide(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceDivide(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceFloorDivide(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceFloorDivide(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceTrueDivide(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceTrueDivide(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceRemainder(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceRemainder(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlacePower(PyObject*, PyObject*, PyObject* o3) {
extern "C" PyObject* PyNumber_InPlacePower(PyObject*, PyObject*, PyObject* o3) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceLshift(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceLshift(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceRshift(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceRshift(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceAnd(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceAnd(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceXor(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceXor(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_InPlaceOr(PyObject*, PyObject*) {
extern "C" PyObject* PyNumber_InPlaceOr(PyObject*, PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyNumber_Coerce(PyObject**, PyObject**) {
extern "C" int PyNumber_Coerce(PyObject**, PyObject**) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyNumber_CoerceEx(PyObject**, PyObject**) {
extern "C" int PyNumber_CoerceEx(PyObject**, PyObject**) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Int(PyObject* o) {
extern "C" PyObject* PyNumber_Int(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Long(PyObject* o) {
extern "C" PyObject* PyNumber_Long(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Float(PyObject* o) {
extern "C" PyObject* PyNumber_Float(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_Index(PyObject* o) {
extern "C" PyObject* PyNumber_Index(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyNumber_ToBase(PyObject* n, int base) {
extern "C" PyObject* PyNumber_ToBase(PyObject* n, int base) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyNumber_AsSsize_t(PyObject* o, PyObject* exc) {
extern "C" Py_ssize_t PyNumber_AsSsize_t(PyObject* o, PyObject* exc) noexcept {
RELEASE_ASSERT(o->cls != long_cls, "unhandled");
RELEASE_ASSERT(isSubclass(o->cls, int_cls), "??");
......@@ -1141,27 +1142,27 @@ extern "C" Py_ssize_t PyNumber_AsSsize_t(PyObject* o, PyObject* exc) {
return n;
}
extern "C" Py_ssize_t PyUnicode_GET_SIZE(PyObject*) {
extern "C" Py_ssize_t PyUnicode_GET_SIZE(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject*) {
extern "C" Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_UNICODE* PyUnicode_AS_UNICODE(PyObject*) {
extern "C" Py_UNICODE* PyUnicode_AS_UNICODE(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" const char* PyUnicode_AS_DATA(PyObject*) {
extern "C" const char* PyUnicode_AS_DATA(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyBuffer_IsContiguous(Py_buffer* view, char fort) {
extern "C" int PyBuffer_IsContiguous(Py_buffer* view, char fort) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyOS_snprintf(char* str, size_t size, const char* format, ...) {
extern "C" int PyOS_snprintf(char* str, size_t size, const char* format, ...) noexcept {
int rc;
va_list va;
......@@ -1171,7 +1172,7 @@ extern "C" int PyOS_snprintf(char* str, size_t size, const char* format, ...) {
return rc;
}
extern "C" int PyOS_vsnprintf(char* str, size_t size, const char* format, va_list va) {
extern "C" int PyOS_vsnprintf(char* str, size_t size, const char* format, va_list va) noexcept {
int len; /* # bytes written, excluding \0 */
#ifdef HAVE_SNPRINTF
#define _PyOS_vsnprintf_EXTRA_SPACE 1
......@@ -1222,7 +1223,7 @@ Done:
#undef _PyOS_vsnprintf_EXTRA_SPACE
}
extern "C" void PyOS_AfterFork(void) {
extern "C" void PyOS_AfterFork(void) noexcept {
// TODO CPython does a number of things after a fork:
// - clears pending signals
// - updates the cached "main_pid"
......@@ -1287,7 +1288,7 @@ static int dev_urandom_python(char* buffer, Py_ssize_t size) noexcept {
}
}
extern "C" int _PyOS_URandom(void* buffer, Py_ssize_t size) {
extern "C" int _PyOS_URandom(void* buffer, Py_ssize_t size) noexcept {
if (size < 0) {
PyErr_Format(PyExc_ValueError, "negative argument not allowed");
return -1;
......
......@@ -57,7 +57,7 @@ static Box* classLookup(BoxedClassobj* cls, const std::string& attr) {
return NULL;
}
extern "C" int PyClass_IsSubclass(PyObject* klass, PyObject* base) {
extern "C" int PyClass_IsSubclass(PyObject* klass, PyObject* base) noexcept {
Py_FatalError("unimplemented");
}
......
......@@ -30,11 +30,11 @@ extern "C" Box* createPureImaginary(double i) {
return new BoxedComplex(0.0, i);
}
extern "C" Py_complex PyComplex_AsCComplex(PyObject* op) {
extern "C" Py_complex PyComplex_AsCComplex(PyObject* op) noexcept {
Py_FatalError("unimplemented");
}
extern "C" double PyComplex_RealAsDouble(PyObject* op) {
extern "C" double PyComplex_RealAsDouble(PyObject* op) noexcept {
if (PyComplex_Check(op)) {
return static_cast<BoxedComplex*>(op)->real;
} else {
......@@ -42,7 +42,7 @@ extern "C" double PyComplex_RealAsDouble(PyObject* op) {
}
}
extern "C" double PyComplex_ImagAsDouble(PyObject* op) {
extern "C" double PyComplex_ImagAsDouble(PyObject* op) noexcept {
if (PyComplex_Check(op)) {
return static_cast<BoxedComplex*>(op)->imag;
} else {
......
......@@ -122,12 +122,12 @@ Box* dictLen(BoxedDict* self) {
return boxInt(self->d.size());
}
extern "C" Py_ssize_t PyDict_Size(PyObject* op) {
extern "C" Py_ssize_t PyDict_Size(PyObject* op) noexcept {
RELEASE_ASSERT(PyDict_Check(op), "");
return static_cast<BoxedDict*>(op)->d.size();
}
extern "C" void PyDict_Clear(PyObject* op) {
extern "C" void PyDict_Clear(PyObject* op) noexcept {
RELEASE_ASSERT(PyDict_Check(op), "");
static_cast<BoxedDict*>(op)->d.clear();
}
......@@ -150,7 +150,7 @@ Box* dictGetitem(BoxedDict* self, Box* k) {
return pos;
}
extern "C" PyObject* PyDict_New() {
extern "C" PyObject* PyDict_New() noexcept {
return new BoxedDict();
}
......@@ -158,7 +158,7 @@ extern "C" PyObject* PyDict_New() {
// that we provide dict-like objects instead of proper dicts.
// The performance should hopefully be comparable to the CPython fast case, since we can use
// runtimeICs.
extern "C" int PyDict_SetItem(PyObject* mp, PyObject* _key, PyObject* _item) {
extern "C" int PyDict_SetItem(PyObject* mp, PyObject* _key, PyObject* _item) noexcept {
ASSERT(mp->cls == dict_cls || mp->cls == attrwrapper_cls, "%s", getTypeName(mp)->c_str());
assert(mp);
......@@ -175,7 +175,7 @@ extern "C" int PyDict_SetItem(PyObject* mp, PyObject* _key, PyObject* _item) {
return 0;
}
extern "C" int PyDict_SetItemString(PyObject* mp, const char* key, PyObject* item) {
extern "C" int PyDict_SetItemString(PyObject* mp, const char* key, PyObject* item) noexcept {
Box* key_s;
try {
key_s = boxStrConstant(key);
......@@ -186,7 +186,7 @@ extern "C" int PyDict_SetItemString(PyObject* mp, const char* key, PyObject* ite
return PyDict_SetItem(mp, key_s, item);
}
extern "C" PyObject* PyDict_GetItem(PyObject* dict, PyObject* key) {
extern "C" PyObject* PyDict_GetItem(PyObject* dict, PyObject* key) noexcept {
ASSERT(dict->cls == dict_cls || dict->cls == attrwrapper_cls, "%s", getTypeName(dict)->c_str());
try {
return getitem(dict, key);
......@@ -197,11 +197,11 @@ extern "C" PyObject* PyDict_GetItem(PyObject* dict, PyObject* key) {
}
}
extern "C" int PyDict_Next(PyObject* op, Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue) {
extern "C" int PyDict_Next(PyObject* op, Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyDict_GetItemString(PyObject* dict, const char* key) {
extern "C" PyObject* PyDict_GetItemString(PyObject* dict, const char* key) noexcept {
Box* key_s;
try {
key_s = boxStrConstant(key);
......@@ -422,27 +422,27 @@ extern "C" Box* dictInit(BoxedDict* self, BoxedTuple* args, BoxedDict* kwargs) {
return None;
}
extern "C" int PyMapping_Check(PyObject* o) {
extern "C" int PyMapping_Check(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyMapping_Size(PyObject* o) {
extern "C" Py_ssize_t PyMapping_Size(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyMapping_HasKeyString(PyObject* o, char* key) {
extern "C" int PyMapping_HasKeyString(PyObject* o, char* key) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyMapping_HasKey(PyObject* o, PyObject* key) {
extern "C" int PyMapping_HasKey(PyObject* o, PyObject* key) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyMapping_GetItemString(PyObject* o, char* key) {
extern "C" PyObject* PyMapping_GetItemString(PyObject* o, char* key) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyMapping_SetItemString(PyObject* o, char* key, PyObject* v) {
extern "C" int PyMapping_SetItemString(PyObject* o, char* key, PyObject* v) noexcept {
Py_FatalError("unimplemented");
}
......
......@@ -187,18 +187,18 @@ Box* fileIterHasNext(Box* s) {
return boxBool(!fileEof(self));
}
extern "C" PyObject* PyFile_FromFile(FILE* fp, char* name, char* mode, int (*close)(FILE*)) {
extern "C" PyObject* PyFile_FromFile(FILE* fp, char* name, char* mode, int (*close)(FILE*)) noexcept {
Py_FatalError("unimplemented");
}
extern "C" FILE* PyFile_AsFile(PyObject* f) {
extern "C" FILE* PyFile_AsFile(PyObject* f) noexcept {
if (!f || !PyFile_Check(f))
return NULL;
return static_cast<BoxedFile*>(f)->f;
}
extern "C" int PyFile_WriteObject(PyObject* v, PyObject* f, int flags) {
extern "C" int PyFile_WriteObject(PyObject* v, PyObject* f, int flags) noexcept {
if (f->cls != file_cls || v->cls != str_cls || flags != Py_PRINT_RAW)
Py_FatalError("unimplemented");
try {
......@@ -227,7 +227,7 @@ static PyObject* err_closed(void) noexcept {
return NULL;
}
extern "C" int PyFile_WriteString(const char* s, PyObject* f) {
extern "C" int PyFile_WriteString(const char* s, PyObject* f) noexcept {
if (f == NULL) {
/* Should be caused by a pre-existing error */
if (!PyErr_Occurred())
......@@ -256,19 +256,19 @@ extern "C" int PyFile_WriteString(const char* s, PyObject* f) {
return -1;
}
extern "C" void PyFile_SetBufSize(PyObject* f, int bufsize) {
extern "C" void PyFile_SetBufSize(PyObject* f, int bufsize) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyFile_SanitizeMode(char* mode) {
extern "C" int _PyFile_SanitizeMode(char* mode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyObject_AsFileDescriptor(PyObject* o) {
extern "C" int PyObject_AsFileDescriptor(PyObject* o) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyFile_SoftSpace(PyObject* f, int newflag) {
extern "C" int PyFile_SoftSpace(PyObject* f, int newflag) noexcept {
try {
return softspace(f, newflag);
} catch (Box* b) {
......
......@@ -23,11 +23,11 @@
namespace pyston {
extern "C" PyObject* PyFloat_FromDouble(double d) {
extern "C" PyObject* PyFloat_FromDouble(double d) noexcept {
return boxFloat(d);
}
extern "C" double PyFloat_AsDouble(PyObject* o) {
extern "C" double PyFloat_AsDouble(PyObject* o) noexcept {
if (o->cls == float_cls)
return static_cast<BoxedFloat*>(o)->d;
else if (isSubclass(o->cls, int_cls))
......
......@@ -192,20 +192,20 @@ static Box* import(const std::string* name, bool return_first) {
return return_first ? first_module : last_module;
}
extern "C" void _PyImport_AcquireLock() {
extern "C" void _PyImport_AcquireLock() noexcept {
// TODO: currently no import lock!
}
extern "C" int _PyImport_ReleaseLock() {
extern "C" int _PyImport_ReleaseLock() noexcept {
// TODO: currently no import lock!
return 1;
}
extern "C" void _PyImport_ReInitLock() {
extern "C" void _PyImport_ReInitLock() noexcept {
// TODO: currently no import lock!
}
extern "C" PyObject* PyImport_ImportModuleNoBlock(const char* name) {
extern "C" PyObject* PyImport_ImportModuleNoBlock(const char* name) noexcept {
Py_FatalError("unimplemented");
}
......
......@@ -31,38 +31,38 @@
namespace pyston {
extern "C" unsigned long PyInt_AsUnsignedLongMask(PyObject* op) {
extern "C" unsigned long PyInt_AsUnsignedLongMask(PyObject* op) noexcept {
Py_FatalError("unimplemented");
}
extern "C" long PyInt_AsLong(PyObject* op) {
extern "C" long PyInt_AsLong(PyObject* op) noexcept {
RELEASE_ASSERT(isSubclass(op->cls, int_cls), "");
return static_cast<BoxedInt*>(op)->n;
}
extern "C" Py_ssize_t PyInt_AsSsize_t(PyObject* op) {
extern "C" Py_ssize_t PyInt_AsSsize_t(PyObject* op) noexcept {
RELEASE_ASSERT(isSubclass(op->cls, int_cls), "");
return static_cast<BoxedInt*>(op)->n;
}
extern "C" PyObject* PyInt_FromSize_t(size_t ival) {
extern "C" PyObject* PyInt_FromSize_t(size_t ival) noexcept {
RELEASE_ASSERT(ival <= LONG_MAX, "");
return boxInt(ival);
}
extern "C" PyObject* PyInt_FromSsize_t(Py_ssize_t ival) {
extern "C" PyObject* PyInt_FromSsize_t(Py_ssize_t ival) noexcept {
return boxInt(ival);
}
extern "C" PyObject* PyInt_FromLong(long n) {
extern "C" PyObject* PyInt_FromLong(long n) noexcept {
return boxInt(n);
}
extern "C" PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle) {
extern "C" PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyInt_AsInt(PyObject*) {
extern "C" int _PyInt_AsInt(PyObject*) noexcept {
Py_FatalError("unimplemented");
}
......
......@@ -29,7 +29,7 @@
namespace pyston {
extern "C" int PyList_Append(PyObject* op, PyObject* newitem) {
extern "C" int PyList_Append(PyObject* op, PyObject* newitem) noexcept {
try {
listAppend(op, newitem);
} catch (Box* b) {
......@@ -95,7 +95,7 @@ extern "C" Box* listPop(BoxedList* self, Box* idx) {
return rtn;
}
extern "C" Py_ssize_t PyList_Size(PyObject* self) {
extern "C" Py_ssize_t PyList_Size(PyObject* self) noexcept {
RELEASE_ASSERT(self->cls == list_cls, "");
return static_cast<BoxedList*>(self)->size;
}
......@@ -144,7 +144,7 @@ extern "C" Box* listGetitemInt(BoxedList* self, BoxedInt* slice) {
return listGetitemUnboxed(self, slice->n);
}
extern "C" PyObject* PyList_GetItem(PyObject* op, Py_ssize_t i) {
extern "C" PyObject* PyList_GetItem(PyObject* op, Py_ssize_t i) noexcept {
RELEASE_ASSERT(PyList_Check(op), "");
RELEASE_ASSERT(i >= 0, ""); // unlike list.__getitem__, PyList_GetItem doesn't do index wrapping
try {
......@@ -494,7 +494,7 @@ extern "C" Box* listNew(Box* cls, Box* container) {
return rtn;
}
extern "C" PyObject* PyList_New(Py_ssize_t size) {
extern "C" PyObject* PyList_New(Py_ssize_t size) noexcept {
// This function is supposed to return a list of `size` NULL elements.
// That will probably trip an assert somewhere if we try to create that (ex
// I think the GC will expect them to be real objects so they can be relocated).
......
......@@ -35,11 +35,11 @@ BoxedClass* long_cls;
#define IS_LITTLE_ENDIAN (int)*(unsigned char*)&one
#define PY_ABS_LLONG_MIN (0 - (unsigned PY_LONG_LONG)PY_LLONG_MIN)
extern "C" int _PyLong_Sign(PyObject* l) {
extern "C" int _PyLong_Sign(PyObject* l) noexcept {
return mpz_sgn(static_cast<BoxedLong*>(l)->n);
}
extern "C" unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject* vv) {
extern "C" unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject* vv) noexcept {
unsigned PY_LONG_LONG bytes;
int one = 1;
int res;
......@@ -58,15 +58,15 @@ extern "C" unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject* vv) {
return bytes;
}
extern "C" unsigned long PyLong_AsUnsignedLongMask(PyObject* op) {
extern "C" unsigned long PyLong_AsUnsignedLongMask(PyObject* op) noexcept {
Py_FatalError("unimplemented");
}
extern "C" unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(PyObject* vv) {
extern "C" unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(PyObject* vv) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PY_LONG_LONG PyLong_AsLongLong(PyObject* vv) {
extern "C" PY_LONG_LONG PyLong_AsLongLong(PyObject* vv) noexcept {
Py_FatalError("unimplemented");
}
......@@ -88,7 +88,7 @@ static uint64_t asUnsignedLong(BoxedLong* self) {
return mpz_get_ui(self->n);
}
extern "C" unsigned long PyLong_AsUnsignedLong(PyObject* vv) {
extern "C" unsigned long PyLong_AsUnsignedLong(PyObject* vv) noexcept {
RELEASE_ASSERT(PyLong_Check(vv), "");
BoxedLong* l = static_cast<BoxedLong*>(vv);
......@@ -99,14 +99,14 @@ extern "C" unsigned long PyLong_AsUnsignedLong(PyObject* vv) {
}
}
extern "C" long PyLong_AsLong(PyObject* vv) {
extern "C" long PyLong_AsLong(PyObject* vv) noexcept {
RELEASE_ASSERT(PyLong_Check(vv), "");
BoxedLong* l = static_cast<BoxedLong*>(vv);
RELEASE_ASSERT(mpz_fits_slong_p(l->n), "");
return mpz_get_si(l->n);
}
extern "C" long PyLong_AsLongAndOverflow(Box* vv, int* overflow) {
extern "C" long PyLong_AsLongAndOverflow(Box* vv, int* overflow) noexcept {
// Ported from CPython; original comment:
/* This version by Tim Peters */
......@@ -133,39 +133,39 @@ extern "C" long PyLong_AsLongAndOverflow(Box* vv, int* overflow) {
Py_FatalError("unsupported case");
}
extern "C" double PyLong_AsDouble(PyObject* vv) {
extern "C" double PyLong_AsDouble(PyObject* vv) noexcept {
RELEASE_ASSERT(PyLong_Check(vv), "");
BoxedLong* l = static_cast<BoxedLong*>(vv);
return mpz_get_d(l->n);
}
extern "C" PyAPI_FUNC(PyObject*) _PyLong_Format(PyObject* aa, int base, int addL, int newstyle) {
extern "C" PyAPI_FUNC(PyObject*) _PyLong_Format(PyObject* aa, int base, int addL, int newstyle) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyLong_FromDouble(double v) {
extern "C" PyObject* PyLong_FromDouble(double v) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyLong_FromLong(long ival) {
extern "C" PyObject* PyLong_FromLong(long ival) noexcept {
BoxedLong* rtn = new BoxedLong(long_cls);
mpz_init_set_si(rtn->n, ival);
return rtn;
}
extern "C" PyObject* PyLong_FromUnsignedLong(unsigned long ival) {
extern "C" PyObject* PyLong_FromUnsignedLong(unsigned long ival) noexcept {
BoxedLong* rtn = new BoxedLong(long_cls);
mpz_init_set_ui(rtn->n, ival);
return rtn;
}
extern "C" PyObject* PyLong_FromSsize_t(Py_ssize_t ival) {
extern "C" PyObject* PyLong_FromSsize_t(Py_ssize_t ival) noexcept {
Py_ssize_t bytes = ival;
int one = 1;
return _PyLong_FromByteArray((unsigned char*)&bytes, SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1);
}
extern "C" PyObject* PyLong_FromSize_t(size_t ival) {
extern "C" PyObject* PyLong_FromSize_t(size_t ival) noexcept {
size_t bytes = ival;
int one = 1;
return _PyLong_FromByteArray((unsigned char*)&bytes, SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0);
......@@ -173,13 +173,13 @@ extern "C" PyObject* PyLong_FromSize_t(size_t ival) {
#undef IS_LITTLE_ENDIAN
extern "C" double _PyLong_Frexp(PyLongObject* a, Py_ssize_t* e) {
extern "C" double _PyLong_Frexp(PyLongObject* a, Py_ssize_t* e) noexcept {
Py_FatalError("unimplemented");
}
/* Create a new long (or int) object from a C pointer */
extern "C" PyObject* PyLong_FromVoidPtr(void* p) {
extern "C" PyObject* PyLong_FromVoidPtr(void* p) noexcept {
#if SIZEOF_VOID_P <= SIZEOF_LONG
if ((long)p < 0)
return PyLong_FromUnsignedLong((unsigned long)p);
......@@ -202,7 +202,7 @@ extern "C" PyObject* PyLong_FromVoidPtr(void* p) {
/* Get a C pointer from a long object (or an int object in some cases) */
extern "C" void* PyLong_AsVoidPtr(PyObject* vv) {
extern "C" void* PyLong_AsVoidPtr(PyObject* vv) noexcept {
/* This function will allow int or long objects. If vv is neither,
then the PyLong_AsLong*() functions will raise the exception:
PyExc_SystemError, "bad argument to internal function"
......@@ -240,11 +240,13 @@ extern "C" void* PyLong_AsVoidPtr(PyObject* vv) {
return (void*)x;
}
extern "C" int _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian, int is_signed) {
extern "C" int _PyLong_AsByteArray(PyLongObject* v, unsigned char* bytes, size_t n, int little_endian,
int is_signed) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* _PyLong_FromByteArray(const unsigned char* bytes, size_t n, int little_endian, int is_signed) {
extern "C" PyObject* _PyLong_FromByteArray(const unsigned char* bytes, size_t n, int little_endian,
int is_signed) noexcept {
if (n == 0)
return PyLong_FromLong(0);
......@@ -278,13 +280,13 @@ extern "C" BoxedLong* boxLong(int64_t n) {
return rtn;
}
extern "C" PyObject* PyLong_FromLongLong(long long ival) {
extern "C" PyObject* PyLong_FromLongLong(long long ival) noexcept {
BoxedLong* rtn = new BoxedLong(long_cls);
mpz_init_set_si(rtn->n, ival);
return rtn;
}
extern "C" PyObject* PyLong_FromUnsignedLongLong(unsigned long long ival) {
extern "C" PyObject* PyLong_FromUnsignedLongLong(unsigned long long ival) noexcept {
BoxedLong* rtn = new BoxedLong(long_cls);
mpz_init_set_ui(rtn->n, ival);
return rtn;
......
......@@ -32,7 +32,7 @@
namespace pyston {
extern "C" PyObject* PyString_FromFormatV(const char* format, va_list vargs) {
extern "C" PyObject* PyString_FromFormatV(const char* format, va_list vargs) noexcept {
va_list count;
Py_ssize_t n = 0;
const char* f;
......@@ -256,7 +256,7 @@ end:
return string;
}
extern "C" PyObject* PyString_FromFormat(const char* format, ...) {
extern "C" PyObject* PyString_FromFormat(const char* format, ...) noexcept {
PyObject* ret;
va_list vargs;
......@@ -307,7 +307,7 @@ Py_LOCAL_INLINE(PyObject*) getnextarg(PyObject* args, Py_ssize_t arglen, Py_ssiz
return NULL;
}
extern "C" PyObject* _PyString_FormatLong(PyObject*, int, int, int, const char**, int*) {
extern "C" PyObject* _PyString_FormatLong(PyObject*, int, int, int, const char**, int*) noexcept {
Py_FatalError("unimplemented");
}
......@@ -413,7 +413,7 @@ Py_LOCAL_INLINE(int) formatchar(char* buf, size_t buflen, PyObject* v) {
}
#define FORMATBUFLEN (size_t)120
extern "C" PyObject* PyString_Format(PyObject* format, PyObject* args) {
extern "C" PyObject* PyString_Format(PyObject* format, PyObject* args) noexcept {
char* fmt, *res;
Py_ssize_t arglen, argidx;
Py_ssize_t reslen, rescnt, fmtcnt;
......@@ -1663,7 +1663,7 @@ Box* strCount2(BoxedString* self, Box* elt) {
return boxInt(strCount2Unboxed(self, elt));
}
extern "C" PyObject* PyString_FromString(const char* s) {
extern "C" PyObject* PyString_FromString(const char* s) noexcept {
return boxStrConstant(s);
}
......@@ -1686,25 +1686,25 @@ char* getWriteableStringContents(BoxedString* s) {
return &s->s[0];
}
extern "C" PyObject* PyString_FromStringAndSize(const char* s, ssize_t n) {
extern "C" PyObject* PyString_FromStringAndSize(const char* s, ssize_t n) noexcept {
if (s == NULL)
return createUninitializedString(n);
return boxStrConstantSize(s, n);
}
extern "C" char* PyString_AsString(PyObject* o) {
extern "C" char* PyString_AsString(PyObject* o) noexcept {
RELEASE_ASSERT(o->cls == str_cls, "");
BoxedString* s = static_cast<BoxedString*>(o);
return getWriteableStringContents(s);
}
extern "C" Py_ssize_t PyString_Size(PyObject* s) {
extern "C" Py_ssize_t PyString_Size(PyObject* s) noexcept {
RELEASE_ASSERT(s->cls == str_cls, "");
return static_cast<BoxedString*>(s)->s.size();
}
extern "C" int _PyString_Resize(PyObject** pv, Py_ssize_t newsize) {
extern "C" int _PyString_Resize(PyObject** pv, Py_ssize_t newsize) noexcept {
// This is only allowed to be called when there is only one user of the string (ie a refcount of 1 in CPython)
assert(pv);
......
......@@ -68,7 +68,7 @@ Box* tupleGetitemInt(BoxedTuple* self, BoxedInt* slice) {
return tupleGetitemUnboxed(self, slice->n);
}
extern "C" PyObject* PyTuple_GetItem(PyObject* op, Py_ssize_t i) {
extern "C" PyObject* PyTuple_GetItem(PyObject* op, Py_ssize_t i) noexcept {
RELEASE_ASSERT(PyTuple_Check(op), "");
RELEASE_ASSERT(i >= 0, ""); // unlike tuple.__getitem__, PyTuple_GetItem doesn't do index wrapping
try {
......@@ -87,7 +87,7 @@ Box* tupleGetitemSlice(BoxedTuple* self, BoxedSlice* slice) {
return _tupleSlice(self, start, stop, step, length);
}
extern "C" PyObject* PyTuple_GetSlice(PyObject* p, Py_ssize_t low, Py_ssize_t high) {
extern "C" PyObject* PyTuple_GetSlice(PyObject* p, Py_ssize_t low, Py_ssize_t high) noexcept {
RELEASE_ASSERT(p->cls == tuple_cls, ""); // could it be a subclass or something else?
BoxedTuple* t = static_cast<BoxedTuple*>(p);
......@@ -157,7 +157,7 @@ Box* tupleLen(BoxedTuple* t) {
return boxInt(t->elts.size());
}
extern "C" Py_ssize_t PyTuple_Size(PyObject* op) {
extern "C" Py_ssize_t PyTuple_Size(PyObject* op) noexcept {
RELEASE_ASSERT(PyTuple_Check(op), "");
return static_cast<BoxedTuple*>(op)->elts.size();
}
......@@ -338,7 +338,7 @@ extern "C" Box* tupleNew(Box* _cls, BoxedTuple* args, BoxedDict* kwargs) {
return new BoxedTuple(std::move(velts));
}
extern "C" int PyTuple_SetItem(PyObject* op, Py_ssize_t i, PyObject* newitem) {
extern "C" int PyTuple_SetItem(PyObject* op, Py_ssize_t i, PyObject* newitem) noexcept {
RELEASE_ASSERT(PyTuple_Check(op), "");
BoxedTuple* t = static_cast<BoxedTuple*>(op);
......@@ -347,7 +347,7 @@ extern "C" int PyTuple_SetItem(PyObject* op, Py_ssize_t i, PyObject* newitem) {
return 0;
}
extern "C" PyObject* PyTuple_Pack(Py_ssize_t n, ...) {
extern "C" PyObject* PyTuple_Pack(Py_ssize_t n, ...) noexcept {
va_list vargs;
va_start(vargs, n);
......@@ -366,7 +366,7 @@ extern "C" PyObject* PyTuple_Pack(Py_ssize_t n, ...) {
return result;
}
extern "C" PyObject* PyTuple_New(Py_ssize_t size) {
extern "C" PyObject* PyTuple_New(Py_ssize_t size) noexcept {
RELEASE_ASSERT(size >= 0, "");
return new BoxedTuple(BoxedTuple::GCVector(size, NULL));
......
......@@ -623,12 +623,12 @@ Box* sliceRepr(BoxedSlice* self) {
}
extern "C" int PySlice_GetIndices(PySliceObject* r, Py_ssize_t length, Py_ssize_t* start, Py_ssize_t* stop,
Py_ssize_t* step) {
Py_ssize_t* step) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PySlice_GetIndicesEx(PySliceObject* r, Py_ssize_t length, Py_ssize_t* start, Py_ssize_t* stop,
Py_ssize_t* step, Py_ssize_t* slicelength) {
Py_ssize_t* step, Py_ssize_t* slicelength) noexcept {
Py_FatalError("unimplemented");
}
......
......@@ -19,348 +19,357 @@ namespace pyston {
// capi stuff
static std::string unicode_default_encoding = "ascii";
extern "C" const char* PyUnicode_GetDefaultEncoding(void) {
extern "C" const char* PyUnicode_GetDefaultEncoding(void) noexcept {
return unicode_default_encoding.c_str();
}
extern "C" int PyUnicode_SetDefaultEncoding(const char* encoding) {
extern "C" int PyUnicode_SetDefaultEncoding(const char* encoding) noexcept {
unicode_default_encoding = encoding;
return 0;
}
extern "C" int PyUnicode_ClearFreeList() {
extern "C" int PyUnicode_ClearFreeList() noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromUnicode(const Py_UNICODE* u, Py_ssize_t size) {
extern "C" PyObject* PyUnicode_FromUnicode(const Py_UNICODE* u, Py_ssize_t size) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromStringAndSize(const char* u, Py_ssize_t size) {
extern "C" PyObject* PyUnicode_FromStringAndSize(const char* u, Py_ssize_t size) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromString(const char* u) {
extern "C" PyObject* PyUnicode_FromString(const char* u) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromFormat(const char* format, ...) {
extern "C" PyObject* PyUnicode_FromFormat(const char* format, ...) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromFormatV(const char* format, va_list vargs) {
extern "C" PyObject* PyUnicode_FromFormatV(const char* format, va_list vargs) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_UNICODE* PyUnicode_AsUnicode(PyObject* unicode) {
extern "C" Py_UNICODE* PyUnicode_AsUnicode(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyUnicode_GetSize(PyObject* unicode) {
extern "C" Py_ssize_t PyUnicode_GetSize(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromEncodedObject(PyObject* obj, const char* encoding, const char* errors) {
extern "C" PyObject* PyUnicode_FromEncodedObject(PyObject* obj, const char* encoding, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromObject(PyObject* obj) {
extern "C" PyObject* PyUnicode_FromObject(PyObject* obj) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_FromWideChar(const wchar_t* w, Py_ssize_t size) {
extern "C" PyObject* PyUnicode_FromWideChar(const wchar_t* w, Py_ssize_t size) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject* unicode, wchar_t* w, Py_ssize_t size) {
extern "C" Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject* unicode, wchar_t* w, Py_ssize_t size) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Decode(const char* s, Py_ssize_t size, const char* encoding, const char* errors) {
extern "C" PyObject* PyUnicode_Decode(const char* s, Py_ssize_t size, const char* encoding,
const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Encode(const Py_UNICODE* s, Py_ssize_t size, const char* encoding, const char* errors) {
extern "C" PyObject* PyUnicode_Encode(const Py_UNICODE* s, Py_ssize_t size, const char* encoding,
const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsEncodedObject(PyObject* unicode, const char* encoding, const char* errors) {
extern "C" PyObject* PyUnicode_AsEncodedObject(PyObject* unicode, const char* encoding, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsEncodedString(PyObject* unicode, const char* encoding, const char* errors) {
extern "C" PyObject* PyUnicode_AsEncodedString(PyObject* unicode, const char* encoding, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF8(const char* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeUTF8(const char* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF8Stateful(const char* s, Py_ssize_t size, const char* errors,
Py_ssize_t* consumed) {
Py_ssize_t* consumed) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsUTF8String(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsUTF8String(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF32(const char* s, Py_ssize_t size, const char* errors, int* byteorder) {
extern "C" PyObject* PyUnicode_DecodeUTF32(const char* s, Py_ssize_t size, const char* errors,
int* byteorder) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF32Stateful(const char* s, Py_ssize_t size, const char* errors, int* byteorder,
Py_ssize_t* consumed) {
Py_ssize_t* consumed) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE* s, Py_ssize_t size, const char* errors, int byteorder) {
extern "C" PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE* s, Py_ssize_t size, const char* errors,
int byteorder) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsUTF32String(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsUTF32String(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF16(const char* s, Py_ssize_t size, const char* errors, int* byteorder) {
extern "C" PyObject* PyUnicode_DecodeUTF16(const char* s, Py_ssize_t size, const char* errors,
int* byteorder) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF16Stateful(const char* s, Py_ssize_t size, const char* errors, int* byteorder,
Py_ssize_t* consumed) {
Py_ssize_t* consumed) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE* s, Py_ssize_t size, const char* errors, int byteorder) {
extern "C" PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE* s, Py_ssize_t size, const char* errors,
int byteorder) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsUTF16String(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsUTF16String(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF7(const char* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeUTF7(const char* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUTF7Stateful(const char* s, Py_ssize_t size, const char* errors,
Py_ssize_t* consumed) {
Py_ssize_t* consumed) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeUTF7(const Py_UNICODE* s, Py_ssize_t size, int base64SetO, int base64WhiteSpace,
const char* errors) {
const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeUnicodeEscape(const char* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeUnicodeEscape(const char* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE* s, Py_ssize_t size) {
extern "C" PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE* s, Py_ssize_t size) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsUnicodeEscapeString(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsUnicodeEscapeString(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeRawUnicodeEscape(const char* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeRawUnicodeEscape(const char* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE* s, Py_ssize_t size) {
extern "C" PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE* s, Py_ssize_t size) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeLatin1(const char* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeLatin1(const char* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsLatin1String(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsLatin1String(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeASCII(const char* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeASCII(const char* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeASCII(const Py_UNICODE* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_EncodeASCII(const Py_UNICODE* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsASCIIString(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsASCIIString(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeCharmap(const char* s, Py_ssize_t size, PyObject* mapping, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeCharmap(const char* s, Py_ssize_t size, PyObject* mapping,
const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE* s, Py_ssize_t size, PyObject* mapping,
const char* errors) {
const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsCharmapString(PyObject* unicode, PyObject* mapping) {
extern "C" PyObject* PyUnicode_AsCharmapString(PyObject* unicode, PyObject* mapping) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE* s, Py_ssize_t size, PyObject* table,
const char* errors) {
const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeMBCS(const char* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_DecodeMBCS(const char* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_DecodeMBCSStateful(const char* s, int size, const char* errors, int* consumed) {
extern "C" PyObject* PyUnicode_DecodeMBCSStateful(const char* s, int size, const char* errors, int* consumed) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE* s, Py_ssize_t size, const char* errors) {
extern "C" PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE* s, Py_ssize_t size, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_AsMBCSString(PyObject* unicode) {
extern "C" PyObject* PyUnicode_AsMBCSString(PyObject* unicode) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Concat(PyObject* left, PyObject* right) {
extern "C" PyObject* PyUnicode_Concat(PyObject* left, PyObject* right) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Split(PyObject* s, PyObject* sep, Py_ssize_t maxsplit) {
extern "C" PyObject* PyUnicode_Split(PyObject* s, PyObject* sep, Py_ssize_t maxsplit) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Splitlines(PyObject* s, int keepend) {
extern "C" PyObject* PyUnicode_Splitlines(PyObject* s, int keepend) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Translate(PyObject* str, PyObject* table, const char* errors) {
extern "C" PyObject* PyUnicode_Translate(PyObject* str, PyObject* table, const char* errors) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Join(PyObject* separator, PyObject* seq) {
extern "C" PyObject* PyUnicode_Join(PyObject* separator, PyObject* seq) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyUnicode_Tailmatch(PyObject* str, PyObject* substr, Py_ssize_t start, Py_ssize_t end,
int direction) {
int direction) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyUnicode_Find(PyObject* str, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction) {
extern "C" Py_ssize_t PyUnicode_Find(PyObject* str, PyObject* substr, Py_ssize_t start, Py_ssize_t end,
int direction) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_ssize_t PyUnicode_Count(PyObject* str, PyObject* substr, Py_ssize_t start, Py_ssize_t end) {
extern "C" Py_ssize_t PyUnicode_Count(PyObject* str, PyObject* substr, Py_ssize_t start, Py_ssize_t end) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Replace(PyObject* str, PyObject* substr, PyObject* replstr, Py_ssize_t maxcount) {
extern "C" PyObject* PyUnicode_Replace(PyObject* str, PyObject* substr, PyObject* replstr,
Py_ssize_t maxcount) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyUnicode_Compare(PyObject* left, PyObject* right) {
extern "C" int PyUnicode_Compare(PyObject* left, PyObject* right) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_RichCompare(PyObject* left, PyObject* right, int op) {
extern "C" PyObject* PyUnicode_RichCompare(PyObject* left, PyObject* right, int op) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* PyUnicode_Format(PyObject* format, PyObject* args) {
extern "C" PyObject* PyUnicode_Format(PyObject* format, PyObject* args) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int PyUnicode_Contains(PyObject* container, PyObject* element) {
extern "C" int PyUnicode_Contains(PyObject* container, PyObject* element) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* _PyUnicode_AsDefaultEncodedString(PyObject*, const char*) {
extern "C" PyObject* _PyUnicode_AsDefaultEncodedString(PyObject*, const char*) noexcept {
Py_FatalError("unimplemented");
}
extern "C" void _PyUnicode_Fini() {
extern "C" void _PyUnicode_Fini() noexcept {
Py_FatalError("unimplemented");
}
extern "C" void _PyUnicode_Init() {
extern "C" void _PyUnicode_Init() noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsAlpha(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsAlpha(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsDecimalDigit(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsDecimalDigit(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsDigit(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsDigit(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsLinebreak(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsLinebreak(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsLowercase(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsLowercase(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsNumeric(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsNumeric(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsTitlecase(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsTitlecase(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsUppercase(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsUppercase(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_IsWhitespace(Py_UNICODE ch) {
extern "C" int _PyUnicode_IsWhitespace(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_ToDecimalDigit(Py_UNICODE ch) {
extern "C" int _PyUnicode_ToDecimalDigit(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" int _PyUnicode_ToDigit(Py_UNICODE ch) {
extern "C" int _PyUnicode_ToDigit(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_UNICODE _PyUnicode_ToLowercase(Py_UNICODE ch) {
extern "C" Py_UNICODE _PyUnicode_ToLowercase(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" double _PyUnicode_ToNumeric(Py_UNICODE ch) {
extern "C" double _PyUnicode_ToNumeric(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_UNICODE _PyUnicode_ToTitlecase(Py_UNICODE ch) {
extern "C" Py_UNICODE _PyUnicode_ToTitlecase(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
extern "C" Py_UNICODE _PyUnicode_ToUppercase(Py_UNICODE ch) {
extern "C" Py_UNICODE _PyUnicode_ToUppercase(Py_UNICODE ch) noexcept {
Py_FatalError("unimplemented");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment