mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 20:10:17 +00:00
up
This commit is contained in:
parent
b2a64c47b8
commit
30798f101c
@ -1,8 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
def test_file(filepath):
|
def test_file(filepath):
|
||||||
return os.system("./pocketpy " + filepath) == 0
|
if sys.platform == 'win32':
|
||||||
#return os.system("python3 " + filepath) == 0
|
return os.system("pocketpy.exe " + filepath) == 0
|
||||||
|
else:
|
||||||
|
return os.system("./pocketpy " + filepath) == 0
|
||||||
|
|
||||||
def test_dir(path):
|
def test_dir(path):
|
||||||
has_error = False
|
has_error = False
|
||||||
|
@ -128,6 +128,15 @@ namespace pkpy {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArgList move_extended_self(const PyVar& self){
|
||||||
|
static_assert(std::is_standard_layout_v<PyVar>);
|
||||||
|
pkpy::ArgList ret(size()+1);
|
||||||
|
ret[0] = self;
|
||||||
|
memcpy(ret._args+1, _args, sizeof(PyVar)*size());
|
||||||
|
memset(_args, 0, sizeof(PyVar)*size());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
~ArgList(){
|
~ArgList(){
|
||||||
__tryRelease();
|
__tryRelease();
|
||||||
}
|
}
|
||||||
|
12
src/vm.h
12
src/vm.h
@ -449,12 +449,14 @@ public:
|
|||||||
const PyVar* callable = &_callable;
|
const PyVar* callable = &_callable;
|
||||||
if((*callable)->is_type(_tp_bounded_method)){
|
if((*callable)->is_type(_tp_bounded_method)){
|
||||||
auto& bm = PyBoundedMethod_AS_C((*callable));
|
auto& bm = PyBoundedMethod_AS_C((*callable));
|
||||||
|
callable = &bm.method; // get unbound method
|
||||||
|
|
||||||
// TODO: avoid insertion here, bad performance
|
// TODO: avoid insertion here, bad performance
|
||||||
pkpy::ArgList new_args(args.size()+1);
|
// pkpy::ArgList new_args(args.size()+1);
|
||||||
new_args[0] = bm.obj;
|
// new_args[0] = bm.obj;
|
||||||
for(int i=0; i<args.size(); i++) new_args[i+1] = args[i];
|
// for(int i=0; i<args.size(); i++) new_args[i+1] = args[i];
|
||||||
callable = &bm.method;
|
// args = std::move(new_args);
|
||||||
args = std::move(new_args);
|
args = args.move_extended_self(bm.obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((*callable)->is_type(_tp_native_function)){
|
if((*callable)->is_type(_tp_native_function)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user