From ade87cb848886652f5c520c2e6ac19fdd44e2098 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 4 May 2024 23:24:47 +0800 Subject: [PATCH] Update 1_5_0.md --- docs/1_5_0.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/1_5_0.md b/docs/1_5_0.md index 2c7fc665..52d02567 100644 --- a/docs/1_5_0.md +++ b/docs/1_5_0.md @@ -6,7 +6,7 @@ order: 25 We are applying a major API refactoring in this release. The main goal is to make the API more consistent and easier to use. We are also adding new features and improvements. This release is not backward compatible with the previous versions. Please read the following guide to upgrade your project. -## New style bindings +## Old style bindings We introduced the new style bindings `vm->bind` in [`v1.1.3`](https://github.com/pocketpy/pocketpy/releases/tag/v1.1.3) and deprecated the old style bindings `vm->bind_func<>` and `vm->bind_method<>`. @@ -85,7 +85,22 @@ int main(){ } ``` -## Optimization of `vm->bind__next__` +## Signature of `_import_handler` + +The signature of `_import_handler` was changed from: + +```cpp +unsigned char* (*)(const char* name_p, int name_size, int* out_size); +``` + +to: +```cpp +unsigned char* (*)(const char* name, int* out_size); +``` + +This is because `str` object was ensured to be null-terminated after `v1.4.1`. + +## Signature of `bind__next__` `vm->bind__next__` is a special method that is used to implement the iterator protocol. Previously, if you want to return multiple values, you need to pack them into a tuple. @@ -178,4 +193,4 @@ Enabling the profiler has a performance overhead. Only enable it when you need i ## Type checking functions + `vm->is_non_tagged_type` was removed. Use `vm->is_type` instead. -+ `vm->check_non_tagged_type` was removed. Use `vm->check_type` instead. \ No newline at end of file ++ `vm->check_non_tagged_type` was removed. Use `vm->check_type` instead.