blueloveTH 3 ani în urmă
părinte
comite
0a90998fe2

+ 3 - 2
plugins/flutter/CHANGELOG.md

@@ -17,9 +17,10 @@ The initial version. Hello, world!
 + Fix a bug about comment and indentation
 + Fix a bug about comment and indentation
 + Fix a bug about compile error line number
 + Fix a bug about compile error line number
 
 
-## 0.4.8+5
+## 0.4.8+6
 
 
 + Downgrade to `sdk>=2.17.0`
 + Downgrade to `sdk>=2.17.0`
 + Fix some bugs about compile error
 + Fix some bugs about compile error
 + Fix a bug for jsonify `nan` or `inf`
 + Fix a bug for jsonify `nan` or `inf`
-+ Add `math.isnan` and `math.isinf`
++ Add `math.isnan` and `math.isinf`
++ Fix a bug of `__checkType`

+ 1 - 1
plugins/flutter/pubspec.yaml

@@ -1,6 +1,6 @@
 name: pocketpy
 name: pocketpy
 description: A lightweight Python interpreter for game engines.
 description: A lightweight Python interpreter for game engines.
-version: 0.4.8+5
+version: 0.4.8+6
 homepage: https://pocketpy.dev
 homepage: https://pocketpy.dev
 repository: https://github.com/blueloveth/pocketpy
 repository: https://github.com/blueloveth/pocketpy
 
 

+ 2 - 1
plugins/flutter/src/pocketpy.h

@@ -3077,6 +3077,7 @@ struct Py_ : PyObject {
 
 
 #define UNION_GET(T, obj) (((Py_<T>*)((obj).get()))->_valueT)
 #define UNION_GET(T, obj) (((Py_<T>*)((obj).get()))->_valueT)
 #define UNION_TP_NAME(obj) UNION_GET(_Str, (obj)->_typeName())
 #define UNION_TP_NAME(obj) UNION_GET(_Str, (obj)->_typeName())
+#define UNION_NAME(obj) UNION_GET(_Str, (obj)->attribs[__name__])
 
 
 
 
 class RangeIterator : public BaseIterator {
 class RangeIterator : public BaseIterator {
@@ -4823,7 +4824,7 @@ public:
 
 
     inline void __checkType(const PyVar& obj, const PyVar& type){
     inline void __checkType(const PyVar& obj, const PyVar& type){
 #ifndef PKPY_NO_TYPE_CHECK
 #ifndef PKPY_NO_TYPE_CHECK
-        if(!obj->isType(type)) typeError("expected '" + UNION_TP_NAME(type) + "', but got '" + UNION_TP_NAME(obj) + "'");
+        if(!obj->isType(type)) typeError("expected '" + UNION_NAME(type) + "', but got '" + UNION_TP_NAME(obj) + "'");
 #endif
 #endif
     }
     }
 
 

+ 1 - 1
plugins/godot/godot-cpp

@@ -1 +1 @@
-Subproject commit b1d3e4f63e539272d5b77bfb44ed8f5778efef9e
+Subproject commit eaeddb40e8691f6fbc8419da1d4996583aef07a8

+ 2 - 1
plugins/unity/com.bl.pocketpy/Plugins/iOS/pocketpy.h

@@ -3077,6 +3077,7 @@ struct Py_ : PyObject {
 
 
 #define UNION_GET(T, obj) (((Py_<T>*)((obj).get()))->_valueT)
 #define UNION_GET(T, obj) (((Py_<T>*)((obj).get()))->_valueT)
 #define UNION_TP_NAME(obj) UNION_GET(_Str, (obj)->_typeName())
 #define UNION_TP_NAME(obj) UNION_GET(_Str, (obj)->_typeName())
+#define UNION_NAME(obj) UNION_GET(_Str, (obj)->attribs[__name__])
 
 
 
 
 class RangeIterator : public BaseIterator {
 class RangeIterator : public BaseIterator {
@@ -4823,7 +4824,7 @@ public:
 
 
     inline void __checkType(const PyVar& obj, const PyVar& type){
     inline void __checkType(const PyVar& obj, const PyVar& type){
 #ifndef PKPY_NO_TYPE_CHECK
 #ifndef PKPY_NO_TYPE_CHECK
-        if(!obj->isType(type)) typeError("expected '" + UNION_TP_NAME(type) + "', but got '" + UNION_TP_NAME(obj) + "'");
+        if(!obj->isType(type)) typeError("expected '" + UNION_NAME(type) + "', but got '" + UNION_TP_NAME(obj) + "'");
 #endif
 #endif
     }
     }
 
 

+ 2 - 1
src/obj.h

@@ -90,4 +90,5 @@ struct Py_ : PyObject {
 };
 };
 
 
 #define UNION_GET(T, obj) (((Py_<T>*)((obj).get()))->_valueT)
 #define UNION_GET(T, obj) (((Py_<T>*)((obj).get()))->_valueT)
-#define UNION_TP_NAME(obj) UNION_GET(_Str, (obj)->_typeName())
+#define UNION_TP_NAME(obj) UNION_GET(_Str, (obj)->_typeName())
+#define UNION_NAME(obj) UNION_GET(_Str, (obj)->attribs[__name__])

+ 1 - 1
src/vm.h

@@ -943,7 +943,7 @@ public:
 
 
     inline void __checkType(const PyVar& obj, const PyVar& type){
     inline void __checkType(const PyVar& obj, const PyVar& type){
 #ifndef PKPY_NO_TYPE_CHECK
 #ifndef PKPY_NO_TYPE_CHECK
-        if(!obj->isType(type)) typeError("expected '" + UNION_TP_NAME(type) + "', but got '" + UNION_TP_NAME(obj) + "'");
+        if(!obj->isType(type)) typeError("expected '" + UNION_NAME(type) + "', but got '" + UNION_TP_NAME(obj) + "'");
 #endif
 #endif
     }
     }