szdytom 1 год назад
Родитель
Сommit
f4e9293643
2 измененных файлов с 3 добавлено и 7 удалено
  1. 1 1
      include/pocketpy/objects/dict.hpp
  2. 2 6
      include/pocketpy/objects/pyvar.h

+ 1 - 1
include/pocketpy/objects/dict.hpp

@@ -34,7 +34,7 @@ struct Dict : private pkpy_Dict {
     PyVar try_get(VM* vm, PyVar key) const {
         auto res = pkpy_Dict__try_get(this, vm, *reinterpret_cast<::pkpy_Var*>(&key));
         if (!res) return nullptr;
-        return *reinterpret_cast<PyVar*>(&res);
+        return PyVar(*reinterpret_cast<PyVar*>(&res));
     }
 
     bool contains(VM* vm, PyVar key) const {

+ 2 - 6
include/pocketpy/objects/pyvar.h

@@ -11,12 +11,8 @@ extern "C" {
  * @brief A python value in pocketpy.
  */
 typedef struct {
-    // TODO: implement
-
-    union {
-        int type;
-        char buf[16];
-    };
+    int type;
+    int _0, _1, _2;
 } pkpy_Var;
 
 /**