ソースを参照

fix a bug of property

blueloveTH 6 ヶ月 前
コミット
1ab175006d
2 ファイル変更12 行追加2 行削除
  1. 1 1
      src/public/internal.c
  2. 11 1
      tests/95_bugs.py

+ 1 - 1
src/public/internal.c

@@ -260,7 +260,7 @@ bool pk_loadmethod(py_StackRef self, py_Name name) {
                 self[0] = *py_getslot(cls_var, 0);
                 self[1] = ti->self;
                 break;
-            default: c11__unreachable();
+            default: return false;
         }
         return true;
     }

+ 11 - 1
tests/95_bugs.py

@@ -169,4 +169,14 @@ for x in xs:
     xs.append(x+1)
 
 assert res == list(range(101))
-assert xs == res
+assert xs == res
+
+# call property
+from vmath import vec2
+
+a = vec2(1, 2)
+try:
+    x = a.x()
+    exit(1)
+except TypeError:
+    pass