mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
e6a57085ea
commit
2f5b34fe46
28
src/common.h
28
src/common.h
@ -1,13 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable:4267)
|
||||
#pragma warning (disable:4101)
|
||||
#pragma warning (disable:4244)
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
@ -29,16 +21,14 @@
|
||||
#include <variant>
|
||||
#include <type_traits>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define PK_VERSION "1.0.3"
|
||||
|
||||
/*******************************************************************************/
|
||||
#include "config.h"
|
||||
|
||||
/*******************************************************************************/
|
||||
#if PK_ENABLE_STD_FUNCTION
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
/*******************************************************************************/
|
||||
|
||||
#if PK_ENABLE_THREAD
|
||||
@ -57,20 +47,6 @@ struct GIL {
|
||||
#define GLOBAL_SCOPE_LOCK()
|
||||
#endif
|
||||
|
||||
/*******************************************************************************/
|
||||
#if _MSC_VER
|
||||
#define PK_ENABLE_COMPUTED_GOTO 0
|
||||
#define UNREACHABLE() __assume(0)
|
||||
#else
|
||||
#define PK_ENABLE_COMPUTED_GOTO 1
|
||||
#define UNREACHABLE() __builtin_unreachable()
|
||||
|
||||
#if DEBUG_CEVAL_STEP
|
||||
#undef PK_ENABLE_COMPUTED_GOTO
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************/
|
||||
|
||||
namespace pkpy{
|
||||
|
45
src/config.h
45
src/config.h
@ -21,6 +21,21 @@
|
||||
// but it's slower and may cause severe "code bloat", also needs more time to compile.
|
||||
#define PK_ENABLE_STD_FUNCTION 0
|
||||
|
||||
/*************** debug settings ***************/
|
||||
|
||||
// Enable this may help you find bugs
|
||||
#define DEBUG_EXTRA_CHECK 0
|
||||
|
||||
// Do not edit the following settings unless you know what you are doing
|
||||
#define DEBUG_NO_BUILTIN_MODULES 0
|
||||
#define DEBUG_DIS_EXEC 0
|
||||
#define DEBUG_CEVAL_STEP 0
|
||||
#define DEBUG_FULL_EXCEPTION 0
|
||||
#define DEBUG_MEMORY_POOL 0
|
||||
#define DEBUG_NO_MEMORY_POOL 0
|
||||
#define DEBUG_NO_AUTO_GC 0
|
||||
#define DEBUG_GC_STATS 0
|
||||
|
||||
/*************** internal settings ***************/
|
||||
|
||||
// This is the maximum size of the value stack in void* units
|
||||
@ -44,19 +59,25 @@ inline const float kTypeAttrLoadFactor = 0.5f;
|
||||
inline const char kPlatformSep = '/';
|
||||
#endif
|
||||
|
||||
/*************** debug settings ***************/
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable:4267)
|
||||
#pragma warning (disable:4101)
|
||||
#pragma warning (disable:4244)
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
||||
// Enable this may help you find bugs
|
||||
#define DEBUG_EXTRA_CHECK 0
|
||||
#ifdef _MSC_VER
|
||||
#define PK_ENABLE_COMPUTED_GOTO 0
|
||||
#define UNREACHABLE() __assume(0)
|
||||
#else
|
||||
#define PK_ENABLE_COMPUTED_GOTO 1
|
||||
#define UNREACHABLE() __builtin_unreachable()
|
||||
#endif
|
||||
|
||||
// Do not edit the following settings unless you know what you are doing
|
||||
#define DEBUG_NO_BUILTIN_MODULES 0
|
||||
#define DEBUG_DIS_EXEC 0
|
||||
#define DEBUG_CEVAL_STEP 0
|
||||
#define DEBUG_FULL_EXCEPTION 0
|
||||
#define DEBUG_MEMORY_POOL 0
|
||||
#define DEBUG_NO_MEMORY_POOL 0
|
||||
#define DEBUG_NO_AUTO_GC 0
|
||||
#define DEBUG_GC_STATS 0
|
||||
|
||||
#if DEBUG_CEVAL_STEP && defined(PK_ENABLE_COMPUTED_GOTO)
|
||||
#undef PK_ENABLE_COMPUTED_GOTO
|
||||
#endif
|
||||
|
||||
#endif
|
2
src/vm.h
2
src/vm.h
@ -1513,7 +1513,7 @@ PyObject* PyArrayGetItem(VM* vm, PyObject* obj, PyObject* index){
|
||||
static_assert(std::is_same_v<T, List> || std::is_same_v<T, Tuple>);
|
||||
const T& self = _CAST(T&, obj);
|
||||
|
||||
if(is_type(index, vm->tp_slice)){
|
||||
if(is_non_tagged_type(index, vm->tp_slice)){
|
||||
const Slice& s = _CAST(Slice&, index);
|
||||
int start, stop, step;
|
||||
vm->parse_int_slice(s, self.size(), start, stop, step);
|
||||
|
Loading…
x
Reference in New Issue
Block a user