mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-06 11:40:16 +00:00
fix memory leak in property and staticmethod.
This commit is contained in:
parent
2e4a248e2c
commit
7070fa5352
@ -585,24 +585,14 @@ class cpp_function : public function {
|
|||||||
class property : public object {
|
class property : public object {
|
||||||
PKBIND_TYPE_IMPL(object, property, tp_property);
|
PKBIND_TYPE_IMPL(object, property, tp_property);
|
||||||
|
|
||||||
property(handle getter, handle setter = none()) : object() {
|
property(handle getter, handle setter = none()) :
|
||||||
auto start = py_peek(0);
|
object(type::of<property>()(getter, setter)) {}
|
||||||
py_push(getter.ptr());
|
|
||||||
py_push(setter.ptr());
|
|
||||||
raise_call<py_tpcall>(type::of<property>().index(), 2, start);
|
|
||||||
*this = object::from_ret();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class staticmethod : public object {
|
class staticmethod : public object {
|
||||||
PKBIND_TYPE_IMPL(object, staticmethod, tp_staticmethod);
|
PKBIND_TYPE_IMPL(object, staticmethod, tp_staticmethod);
|
||||||
|
|
||||||
staticmethod(handle method) : object() {
|
staticmethod(handle method) : object(type::of<staticmethod>()(method)) {}
|
||||||
auto start = py_peek(0);
|
|
||||||
py_push(method.ptr());
|
|
||||||
raise_call<py_tpcall>(type::of<staticmethod>().index(), 1, start);
|
|
||||||
*this = object::from_ret();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user