Update 1_5_0.md

This commit is contained in:
blueloveTH 2024-05-04 23:18:05 +08:00
parent 402de82d47
commit 12d3ae8055

View File

@ -146,3 +146,31 @@ from __builtins import next
```
Related C++ APIs do not change. They still return `vm->StopIteration` to indicate the end of iteration.
## User config support
We used to read `user_config.h` file to override the default configurations.
In `v1.5.0`, this is no longer supported.
Please use config macros before `#include "pocketpy.h"` directly.
```cpp
#define PK_ENABLE_OS 1
#define PK_ENABLE_THREAD 1
#define PK_ENABLE_PROFILER 1
// for all config macros, please refer to `include/pocketpy/config.h`
#include "pocketpy.h"
```
## Debugger and profiler
We added a macro `PK_ENABLE_PROFILER` (default is 0) to control the availability of the builtin debugger and profiler.
If you want to use them, for example, you want to call `breakpoint()` or `import line_profiler`, you need to set `PK_ENABLE_PROFILER` to 1 before `#include "pocketpy.h"`.
```cpp
#define PK_ENABLE_PROFILER 1
#include "pocketpy.h"
```
!!!
Enabling the profiler has a performance overhead. Only enable it when you need it.
!!!