mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-22 04:20:17 +00:00
some fix
This commit is contained in:
parent
dd734f71dc
commit
634ad16d45
@ -89,6 +89,7 @@ PyObject* VM::bind(PyObject* obj, const char* sig, const char* docstring, Ret(T:
|
|||||||
template<typename T, typename F, bool ReadOnly>
|
template<typename T, typename F, bool ReadOnly>
|
||||||
PyObject* VM::bind_field(PyObject* obj, const char* name, F T::*field){
|
PyObject* VM::bind_field(PyObject* obj, const char* name, F T::*field){
|
||||||
static_assert(!std::is_reference_v<F>);
|
static_assert(!std::is_reference_v<F>);
|
||||||
|
PK_ASSERT(is_type(obj, tp_type));
|
||||||
std::string_view name_sv(name); int pos = name_sv.find(':');
|
std::string_view name_sv(name); int pos = name_sv.find(':');
|
||||||
if(pos > 0) name_sv = name_sv.substr(0, pos);
|
if(pos > 0) name_sv = name_sv.substr(0, pos);
|
||||||
auto fget = [](VM* vm, ArgsView args) -> PyObject*{
|
auto fget = [](VM* vm, ArgsView args) -> PyObject*{
|
||||||
|
@ -1269,6 +1269,7 @@ PyObject* VM::bind(PyObject* obj, const char* sig, const char* docstring, Native
|
|||||||
}
|
}
|
||||||
|
|
||||||
PyObject* VM::bind_property(PyObject* obj, const char* name, NativeFuncC fget, NativeFuncC fset){
|
PyObject* VM::bind_property(PyObject* obj, const char* name, NativeFuncC fget, NativeFuncC fset){
|
||||||
|
PK_ASSERT(is_type(obj, tp_type));
|
||||||
std::string_view name_sv(name); int pos = name_sv.find(':');
|
std::string_view name_sv(name); int pos = name_sv.find(':');
|
||||||
if(pos > 0) name_sv = name_sv.substr(0, pos);
|
if(pos > 0) name_sv = name_sv.substr(0, pos);
|
||||||
PyObject* _0 = heap.gcnew<NativeFunc>(tp_native_func, fget, 1, false);
|
PyObject* _0 = heap.gcnew<NativeFunc>(tp_native_func, fget, 1, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user