Commit 406c721e authored by Kevin Modzelewski's avatar Kevin Modzelewski

Ref fixes

parent 819424ee
......@@ -27,10 +27,10 @@ PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *) PYSTON_NOEXCEPT;
struct _frame; /* Avoid including frameobject.h */
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(BORROWED(PyObject *)) PyEval_GetBuiltins(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(BORROWED(PyObject *)) PyEval_GetGlobals(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(BORROWED(PyObject *)) PyEval_GetLocals(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(BORROWED(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
......
......@@ -431,7 +431,7 @@ extern "C" PyObject* Py_InitModule4(const char* name, PyMethodDef* methods, cons
return module;
}
extern "C" PyObject* PyModule_GetDict(BORROWED(PyObject*) _m) noexcept {
extern "C" BORROWED(PyObject*) PyModule_GetDict(PyObject* _m) noexcept {
BoxedModule* m = static_cast<BoxedModule*>(_m);
assert(PyModule_Check(m));
......
......@@ -469,6 +469,7 @@ Box* bltinImport(Box* name, Box* globals, Box* locals, Box** args) {
// which ignores it. So we don't even pass it through.
name = coerceUnicodeToStr<CXX>(name);
AUTO_DECREF(name);
if (name->cls != str_cls) {
raiseExcHelper(TypeError, "__import__() argument 1 must be string, not %s", getTypeName(name));
......@@ -1209,8 +1210,9 @@ Box* locals() {
return fastLocalsToBoxedLocals();
}
extern "C" PyObject* PyEval_GetLocals(void) noexcept {
extern "C" BORROWED(PyObject*) PyEval_GetLocals(void) noexcept {
try {
assert(0 && "check refcounting");
return locals();
} catch (ExcInfo e) {
setCAPIException(e);
......@@ -1218,16 +1220,16 @@ extern "C" PyObject* PyEval_GetLocals(void) noexcept {
}
}
extern "C" PyObject* PyEval_GetGlobals(void) noexcept {
extern "C" BORROWED(PyObject*) PyEval_GetGlobals(void) noexcept {
try {
return globals();
return autoXDecref(globals());
} catch (ExcInfo e) {
setCAPIException(e);
return NULL;
}
}
extern "C" PyObject* PyEval_GetBuiltins(void) noexcept {
extern "C" BORROWED(PyObject*) PyEval_GetBuiltins(void) noexcept {
return builtins_module;
}
......
......@@ -1579,7 +1579,8 @@ extern "C" void PyEval_RestoreThread(PyThreadState* tstate) noexcept {
endAllowThreads();
}
extern "C" struct _frame* PyEval_GetFrame(void) noexcept {
extern "C" BORROWED(struct _frame*) PyEval_GetFrame(void) noexcept {
assert(0 && "check refcounting");
Box* frame = NULL;
try {
frame = getFrame(0);
......
......@@ -4151,7 +4151,6 @@ void setupRuntime() {
_PyUnicode_Init();
unicode_cls->is_constant = true;
unicode_cls->is_user_defined = false;
_PyWarnings_Init();
_string_init();
setupDescr();
setupCode();
......
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