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
......
This diff is collapsed.
......@@ -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, \
......
This diff is collapsed.
......@@ -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) \
......
This diff is collapsed.
......@@ -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: */
......
This diff is collapsed.
......@@ -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
}
......
This diff is collapsed.
......@@ -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;
......
This diff is collapsed.
......@@ -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);
......
This diff is collapsed.
......@@ -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");
}
......
This diff is collapsed.
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