diff --git a/include/pocketpy/pocketpy.h b/include/pocketpy/pocketpy.h index 84dbb3c7..c96f05b9 100644 --- a/include/pocketpy/pocketpy.h +++ b/include/pocketpy/pocketpy.h @@ -295,8 +295,6 @@ bool py_matchexc(py_Type type); /// Clear the current exception. void py_clearexc(py_StackRef p0); -#define IOError(...) py_exception(tp_IOError, __VA_ARGS__) -#define OSError(...) py_exception(tp_OSError, __VA_ARGS__) #define NameError(n) py_exception(tp_NameError, "name '%n' is not defined", (n)) #define TypeError(...) py_exception(tp_TypeError, __VA_ARGS__) #define RuntimeError(...) py_exception(tp_RuntimeError, __VA_ARGS__) diff --git a/src/modules/os.c b/src/modules/os.c index 984c81f9..f8dff7e0 100644 --- a/src/modules/os.c +++ b/src/modules/os.c @@ -31,13 +31,13 @@ static bool os_chdir(int argc, py_Ref argv) { PY_CHECK_ARG_TYPE(0, tp_str); const char* path = py_tostr(py_arg(0)); int code = platform_chdir(path); - if(code != 0) return OSError("chdir() failed: %d", code); + if(code != 0) return py_exception(tp_OSError, "chdir() failed: %d", code); return true; } static bool os_getcwd(int argc, py_Ref argv) { char buf[1024]; - if(!platform_getcwd(buf, sizeof(buf))) return OSError("getcwd() failed"); + if(!platform_getcwd(buf, sizeof(buf))) return py_exception(tp_OSError, "getcwd() failed"); py_newstr(py_retval(), buf); return true; }