Skip to content

Commit 6d640a1

Browse files
AJMansfielddpgeorge
authored andcommitted
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 c3450ef. 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 9ec1caf. Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
1 parent c304046 commit 6d640a1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

py/obj.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,10 @@ typedef mp_obj_t (*mp_fun_var_t)(size_t n, const mp_obj_t *);
539539
typedef mp_obj_t (*mp_fun_kw_t)(size_t n, const mp_obj_t *, mp_map_t *);
540540

541541
// Flags for type behaviour (mp_obj_type_t.flags)
542+
// If MP_TYPE_FLAG_IS_SUBCLASSED is set, then subclasses of this class have been created.
543+
// Mutations to this class that would require updating all subclasses must be rejected.
544+
// If MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS is set, then attribute lookups involving this
545+
// class need to additionally check for special accessor methods, such as from descriptors.
542546
// If MP_TYPE_FLAG_EQ_NOT_REFLEXIVE is clear then __eq__ is reflexive (A==A returns True).
543547
// If MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE is clear then the type can't be equal to an
544548
// instance of any different class that also clears this flag. If this flag is set

0 commit comments

Comments
 (0)