blueloveTH hai 1 ano
pai
achega
4e8920b280
Modificáronse 2 ficheiros con 2 adicións e 4 borrados
  1. 0 2
      include/pocketpy/pocketpy.h
  2. 2 2
      src/modules/os.c

+ 0 - 2
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__)

+ 2 - 2
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;
 }