diff --git a/src/ceval.h b/src/ceval.h index 521e3079..ee884bfb 100644 --- a/src/ceval.h +++ b/src/ceval.h @@ -36,7 +36,7 @@ inline PyObject* VM::_run_top_frame(){ { #if PK_ENABLE_CEVAL_CALLBACK -#define CEVAL_STEP() byte = frame->next_bytecode(); if(_ceval_on_step) _ceval_on_step(this, frame, byte) +#define CEVAL_STEP() byte = frame->next_bytecode(); if(_ceval_on_step) _ceval_on_step(this, frame.get(), byte) #else #define CEVAL_STEP() byte = frame->next_bytecode() #endif diff --git a/src/config.h b/src/config.h index cd8b6d96..3e9523e5 100644 --- a/src/config.h +++ b/src/config.h @@ -50,17 +50,19 @@ // (not recommended to change this) #define PK_MAX_CO_VARNAMES 255 -// Hash table load factor (smaller ones mean less collision but more memory) -// For class instance -inline const float kInstAttrLoadFactor = 0.67f; -// For class itself -inline const float kTypeAttrLoadFactor = 0.5f; +namespace pkpy{ + // Hash table load factor (smaller ones mean less collision but more memory) + // For class instance + inline const float kInstAttrLoadFactor = 0.67f; + // For class itself + inline const float kTypeAttrLoadFactor = 0.5f; -#ifdef _WIN32 - inline const char kPlatformSep = '\\'; -#else - inline const char kPlatformSep = '/'; -#endif + #ifdef _WIN32 + inline const char kPlatformSep = '\\'; + #else + inline const char kPlatformSep = '/'; + #endif +} #ifdef _MSC_VER #pragma warning (disable:4267) diff --git a/src/vm.h b/src/vm.h index 70b5246f..edd40462 100644 --- a/src/vm.h +++ b/src/vm.h @@ -98,6 +98,7 @@ struct FrameId{ int index; FrameId(std::vector* data, int index) : data(data), index(index) {} Frame* operator->() const { return &data->operator[](index); } + Frame* get() const { return &data->operator[](index); } }; typedef void(*PrintFunc)(VM*, const Str&);