diff options
| author | Anson Mansfield <amansfield@mantaro.com> | 2025-09-11 17:52:10 -0400 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-09-16 10:51:40 +1000 |
| commit | 6d640a15ab5258140f402d62fcd69e73650c08d6 (patch) | |
| tree | 7ff0622af0fa82765a79ba24532f868a6399cb4b /py | |
| parent | c3040463849eb9b3e5f85706bb223d648e60510d (diff) | |
py/obj: Document undocumented MP_TYPE_FLAG values.
This adds comments documentign the meaning of the type flag bits
`MP_TYPE_FLAG_IS_SUBCLASSED` and `MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS`,
for consistency with the comments added later on documenting the other
flags.
These flags were were originally made part of the public API in
c3450effd4c3a402eeccf44a84a05ef4b36d69a0. This block of doc comments
was only added later on when `MP_TYPE_FLAG_EQ_NOT_REFLEXIVE`,
`MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE`, and `MP_TYPE_FLAG_EQ_HAS_NEQ_TEST`
were added in 9ec1caf42e7733b5141b7aecf1b6e58834a94bf7.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
Diffstat (limited to 'py')
| -rw-r--r-- | py/obj.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -539,6 +539,10 @@ typedef mp_obj_t (*mp_fun_var_t)(size_t n, const mp_obj_t *); typedef mp_obj_t (*mp_fun_kw_t)(size_t n, const mp_obj_t *, mp_map_t *); // Flags for type behaviour (mp_obj_type_t.flags) +// If MP_TYPE_FLAG_IS_SUBCLASSED is set, then subclasses of this class have been created. +// Mutations to this class that would require updating all subclasses must be rejected. +// If MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS is set, then attribute lookups involving this +// class need to additionally check for special accessor methods, such as from descriptors. // If MP_TYPE_FLAG_EQ_NOT_REFLEXIVE is clear then __eq__ is reflexive (A==A returns True). // If MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE is clear then the type can't be equal to an // instance of any different class that also clears this flag. If this flag is set |
