This commit is contained in:
blueloveTH 2024-05-03 20:36:07 +08:00
parent b0a74ffe27
commit f91c4db49d
3 changed files with 3 additions and 3 deletions

View File

@ -441,7 +441,7 @@ public:
/***** Private *****/ /***** Private *****/
void __breakpoint(); void __breakpoint();
PyObject* __format_string(Str, PyObject*); PyObject* __format_object(PyObject*, Str);
PyObject* __run_top_frame(); PyObject* __run_top_frame();
void __pop_frame(); void __pop_frame();
PyObject* __py_generator(Frame&& frame, ArgsView buffer); PyObject* __py_generator(Frame&& frame, ArgsView buffer);

View File

@ -945,7 +945,7 @@ __NEXT_STEP:;
case OP_FORMAT_STRING: { case OP_FORMAT_STRING: {
PyObject* _0 = POPX(); PyObject* _0 = POPX();
const Str& spec = CAST(Str&, co->consts[byte.arg]); const Str& spec = CAST(Str&, co->consts[byte.arg]);
PUSH(__format_string(spec, _0)); PUSH(__format_object(_0, spec));
} DISPATCH(); } DISPATCH();
/*****************************************/ /*****************************************/
case OP_INC_FAST:{ case OP_INC_FAST:{

View File

@ -499,7 +499,7 @@ i64 VM::py_hash(PyObject* obj){
} }
} }
PyObject* VM::__format_string(Str spec, PyObject* obj){ PyObject* VM::__format_object(PyObject* obj, Str spec){
if(spec.empty()) return py_str(obj); if(spec.empty()) return py_str(obj);
char type; char type;
switch(spec.end()[-1]){ switch(spec.end()[-1]){