kopia lustrzana https://github.com/micropython/micropython
Updated Build Troubleshooting (markdown)
rodzic
d026052dd4
commit
aa87c041a7
|
@ -51,7 +51,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
|||
...
|
||||
```
|
||||
|
||||
In most cases this change should be mechanical, pass the type, name, and flags as the first three arguments, then just replace all remaining `.a = b,` with `a, b,`. The one exception is `getiter` & `iternext`, see the next section.
|
||||
In most cases this change should be mechanical, pass the type, name, and flags as the first three arguments, then just replace all remaining `.a = b,` with `a, b,`. The two exceptions are `buffer` and `getiter` / `iternext`, see the next two sections.
|
||||
|
||||
If your code need to access properties on a give type, e.g. `mp_type_foo.make_new` then it needs to be updated to use the accessor macros.
|
||||
|
||||
|
@ -61,6 +61,30 @@ MP_OBJ_TYPE_GET_SLOT(type, slot) # equivalent to type->slot (but you must know t
|
|||
MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, slot) # marginally less efficient but will return NULL if the slot is not set
|
||||
```
|
||||
|
||||
## buffer
|
||||
|
||||
The definition for a type with a buffer slot has been simplified and no longer requires a nested struct.
|
||||
|
||||
As part of updating to use `MP_DEFINE_CONST_OBJ_TYPE`, change
|
||||
|
||||
```c
|
||||
const mp_obj_type_t mp_type_foo = {
|
||||
...
|
||||
.buffer_p = { .get_buffer = mp_obj_str_get_buffer },
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```c
|
||||
MP_DEFINE_CONST_OBJ_TYPE(
|
||||
...
|
||||
buffer, mp_obj_str_get_buffer,
|
||||
...
|
||||
);
|
||||
```
|
||||
|
||||
## getiter/iternext
|
||||
|
||||
If you see errors about `getiter` and/or `iternext` then also see #8813.
|
||||
|
|
Ładowanie…
Reference in New Issue