mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
fix a bug
This commit is contained in:
parent
ee0489b8d6
commit
37db7bc29b
@ -63,6 +63,9 @@ goto *OP_LABELS[byte.op];
|
||||
__NEXT_STEP:;
|
||||
#if DEBUG_CEVAL_STEP
|
||||
std::cout << frame->stack_info() << " " << OP_NAMES[byte.op] << std::endl;
|
||||
#endif
|
||||
#if DEBUG_CEVAL_STEP_MIN
|
||||
std::cout << OP_NAMES[byte.op] << std::endl;
|
||||
#endif
|
||||
switch (byte.op)
|
||||
{
|
||||
@ -213,14 +216,14 @@ __NEXT_STEP:;
|
||||
} DISPATCH();
|
||||
TARGET(BUILD_DICT) {
|
||||
PyObject* t = VAR(STACK_VIEW(byte.arg).to_tuple());
|
||||
STACK_SHRINK(byte.arg);
|
||||
PyObject* obj = call(builtins->attr(m_dict), Args{t});
|
||||
STACK_SHRINK(byte.arg);
|
||||
PUSH(obj);
|
||||
} DISPATCH();
|
||||
TARGET(BUILD_SET) {
|
||||
PyObject* t = VAR(STACK_VIEW(byte.arg).to_tuple());
|
||||
STACK_SHRINK(byte.arg);
|
||||
PyObject* obj = call(builtins->attr(m_set), Args{t});
|
||||
STACK_SHRINK(byte.arg);
|
||||
PUSH(obj);
|
||||
} DISPATCH();
|
||||
TARGET(BUILD_SLICE) {
|
||||
|
@ -36,6 +36,7 @@
|
||||
#define DEBUG_EXTRA_CHECK 0
|
||||
#define DEBUG_DIS_EXEC 0
|
||||
#define DEBUG_CEVAL_STEP 0
|
||||
#define DEBUG_CEVAL_STEP_MIN 0
|
||||
#define DEBUG_FULL_EXCEPTION 0
|
||||
#define DEBUG_MEMORY_POOL 0
|
||||
#define DEBUG_NO_MEMORY_POOL 0
|
||||
|
@ -619,8 +619,7 @@ struct CallExpr: Expr{
|
||||
|
||||
void emit(CodeEmitContext* ctx) override {
|
||||
VM* vm = ctx->vm;
|
||||
// TODO: if callable is a AttrExpr, we should try to use `fast_call`
|
||||
// instead of use `boundmethod` proxy
|
||||
// if callable is a AttrExpr, we should try to use `fast_call` instead of use `boundmethod` proxy
|
||||
if(callable->is_attrib()){
|
||||
auto p = static_cast<AttribExpr*>(callable.get());
|
||||
p->emit_method(ctx);
|
||||
|
@ -254,7 +254,7 @@ struct Frame {
|
||||
|
||||
void _gc_mark() const {
|
||||
// do return if this frame has been moved
|
||||
if(!_locals.is_valid()) return;
|
||||
if(_s.data() == nullptr) return;
|
||||
for(PyObject* obj: _s) OBJ_MARK(obj);
|
||||
OBJ_MARK(_module);
|
||||
_locals._gc_mark();
|
||||
|
2
src/vm.h
2
src/vm.h
@ -752,7 +752,7 @@ inline PyObject* VM::call(PyObject* callable, Args args, const Args& kwargs, boo
|
||||
}
|
||||
|
||||
if(is_type(callable, tp_type)){
|
||||
// TODO: use get_unbound_method here
|
||||
// TODO: derived __new__ ?
|
||||
PyObject* new_f = callable->attr().try_get(__new__);
|
||||
PyObject* obj;
|
||||
if(new_f != nullptr){
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user