瀏覽代碼

Update codeobject.cpp

blueloveTH 1 年之前
父節點
當前提交
0f543a2c96
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      src/codeobject.cpp

+ 8 - 3
src/codeobject.cpp

@@ -24,7 +24,12 @@ namespace pkpy{
         this->decl = decl;
     }
 
-    PyObject* const PY_NULL = (PyObject*)new int(0);
-    PyObject* const PY_OP_CALL = (PyObject*)new int(1);
-    PyObject* const PY_OP_YIELD = (PyObject*)new int(2);
+    struct PySignalObject: PyObject {
+        PySignalObject() : PyObject(0) { gc_enabled = false; }
+        void _obj_gc_mark() override {}
+    };
+
+    PyObject* const PY_NULL = new PySignalObject();
+    PyObject* const PY_OP_CALL = new PySignalObject();
+    PyObject* const PY_OP_YIELD = new PySignalObject();
 }   // namespace pkpy