Update 1_5_0.md

This commit is contained in:
blueloveTH 2024-05-04 23:24:47 +08:00
parent f17c764a43
commit ade87cb848

View File

@ -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.