Skip to content

Commit 5bb2126

Browse files
committed
Document each slot in SlotKind
1 parent 67000c6 commit 5bb2126

File tree

1 file changed

+26
-11
lines changed
  • graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations

1 file changed

+26
-11
lines changed

graalpython/com.oracle.graal.python.annotations/src/com/oracle/graal/python/annotations/Slot.java

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,32 @@
9191
String raiseErrorName() default "";
9292
}
9393

94+
/** See <a href="https://docs.python.org/3/c-api/typeobj.html">slot documentation</a> */
9495
enum SlotKind {
95-
nb_bool,
96-
nb_add,
97-
sq_length,
98-
sq_item,
99-
sq_concat,
100-
mp_length,
101-
mp_subscript,
102-
tp_descr_get,
103-
tp_descr_set,
104-
tp_getattro,
105-
tp_setattro,
96+
/** Whether this object is treated as true or false for {@code if object} */
97+
nb_bool("__bool__"),
98+
/** foo + bar */
99+
nb_add("__add__, __radd__"),
100+
/** sequence length/size */
101+
sq_length("__len__"),
102+
/** sequence item: read element at index */
103+
sq_item("__getitem__"),
104+
/** seq + seq, nb_add is tried before */
105+
sq_concat("__add__"),
106+
/** mapping length */
107+
mp_length("__len__"),
108+
/** mapping subscript, e.g. o[key], o[i:j] */
109+
mp_subscript("__getitem__"),
110+
/** type descriptor get */
111+
tp_descr_get("__get__"),
112+
/** type descriptor set/delete */
113+
tp_descr_set("__set__, __delete__"),
114+
/** get object attribute */
115+
tp_getattro("__getattribute__, __getattr__"),
116+
/** set/delete object attribute */
117+
tp_setattro("__setattr__, __delattr__");
118+
119+
SlotKind(@SuppressWarnings("unused") String specialMethods) {
120+
}
106121
}
107122
}

0 commit comments

Comments
 (0)