Skip to content

Commit a0de5d6

Browse files
committed
Remove backward/forward compat wrappers for CONFIG_EXPERIMENTAL_UNIFIED_METHOD_HINTS
1 parent 2e22358 commit a0de5d6

File tree

172 files changed

+1949
-3618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+1949
-3618
lines changed

cpp.hint

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,12 +1418,6 @@
14181418
#define DEFINE_ANY_BYTES_TRAIT(n,...) DeeObject*bytes_##n(Bytes*self,size_t argc,DeeObject*const*argv,DeeObject*kw);
14191419
#define SUPER_PRIVATE_EXPANDARGS(...) (DeeTypeObject *tp_self, __VA_ARGS__)
14201420
#define DEFINE_OPERATOR(return,n,args) return DeeObject_T##n SUPER_PRIVATE_EXPANDARGS args{} return DeeObject_##n args
1421-
#define DEFINE_INTERNAL_OPERATOR(return,n,args) return DeeObject_T##n SUPER_PRIVATE_EXPANDARGS args{} return DeeObject_##n args
1422-
#define DEFINE_INTERNAL_SEQ_OPERATOR(return,n,args) return DeeSeq_T##n SUPER_PRIVATE_EXPANDARGS args{} return DeeSeq_##n args
1423-
#define DEFINE_INTERNAL_SET_OPERATOR(return,n,args) return DeeSet_T##n SUPER_PRIVATE_EXPANDARGS args{} return DeeSet_##n args
1424-
#define DEFINE_INTERNAL_MAP_OPERATOR(return,n,args) return DeeMap_T##n SUPER_PRIVATE_EXPANDARGS args{} return DeeMap_##n args
1425-
#define DEFINE_DEFAULT_FOO_WITH_INPLACE_FOO_OPERATOR(x,...) DEFINE_INTERNAL_OPERATOR(DeeObject*,Default##x##WithInplace##x,(DeeObject*self,DeeObject*other)){}
1426-
#define DEFINE_DEFAULT_INPLACE_FOO_WITH_FOO_OPERATOR(x,...) DEFINE_INTERNAL_OPERATOR(DeeObject*,DefaultInplace##x##With##x,(DeeObject*self,DeeObject*other)){}
14271421
#define DEFINE_FILE_OPERATOR(return,n,args) return DeeFile_T##n SUPER_PRIVATE_EXPANDARGS args{} return DeeFile_##n args
14281422
#define DEFINE_MATH_INPLACE_INT_OPERATOR(n,a,b,c,...) int n(DeeObject**restrict p_self,c val){}
14291423
#define DEF_STRING(n,a,b,c) DeeStringObject n={};

include/deemon/method-hints.h

Lines changed: 58 additions & 885 deletions
Large diffs are not rendered by default.

include/deemon/object.h

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,11 +1954,6 @@ struct Dee_type_cmp {
19541954
#define Dee_BOUND_FROMHAS_UNBOUND(has_value) \
19551955
(unlikely(has_value) < 0 ? Dee_BOUND_ERR : Dee_BOUND_FROMPRESENT_UNBOUND(has_value))
19561956

1957-
#if 1 /* TODO: CONFIG_EXPERIMENTAL_UNIFIED_METHOD_HINTS: REMOVE ME */
1958-
typedef WUNUSED_T NONNULL_T((2)) Dee_ssize_t (DCALL *Dee_seq_enumerate_t)(void *arg, DeeObject *index, /*nullable*/ DeeObject *value);
1959-
typedef WUNUSED_T Dee_ssize_t (DCALL *Dee_seq_enumerate_index_t)(void *arg, size_t index, /*nullable*/ DeeObject *value);
1960-
#endif
1961-
19621957
struct Dee_type_seq {
19631958
/* Sequence operators. */
19641959
WUNUSED_T NONNULL_T((1)) DREF DeeObject *(DCALL *tp_iter)(DeeObject *__restrict self);
@@ -1983,14 +1978,6 @@ struct Dee_type_seq {
19831978
WUNUSED_T NONNULL_T((1, 2)) Dee_ssize_t (DCALL *tp_foreach)(DeeObject *__restrict self, Dee_foreach_t proc, void *arg);
19841979
WUNUSED_T NONNULL_T((1, 2)) Dee_ssize_t (DCALL *tp_foreach_pair)(DeeObject *__restrict self, Dee_foreach_pair_t proc, void *arg);
19851980

1986-
#if 1 /* TODO: CONFIG_EXPERIMENTAL_UNIFIED_METHOD_HINTS: REMOVE ME */
1987-
/* These will go away and only be accessible via method hints.
1988-
* Reason: Not perfectly equivalent to "tp_foreach", so user-impl must happen via attributes. */
1989-
WUNUSED_T NONNULL_T((1, 2)) Dee_ssize_t (DCALL *tp_enumerate)(DeeObject *__restrict self, Dee_seq_enumerate_t proc, void *arg);
1990-
WUNUSED_T NONNULL_T((1, 2)) Dee_ssize_t (DCALL *tp_enumerate_index)(DeeObject *__restrict self, Dee_seq_enumerate_index_t proc, void *arg, size_t start, size_t end);
1991-
WUNUSED_T NONNULL_T((1)) DREF DeeObject *(DCALL *tp_iterkeys)(DeeObject *__restrict self);
1992-
#endif
1993-
19941981
/* Optional function to check if a specific item index/key is bound. (inherited alongside `tp_getitem')
19951982
* Check if a given item is bound (`self[index] is bound' / `deemon.bounditem(self, index)')
19961983
* @return: Dee_BOUND_YES: Item is bound.
@@ -2103,14 +2090,6 @@ struct Dee_type_seq {
21032090
* to hold at least "return" elements, and call this operator again. */
21042091
WUNUSED_T NONNULL_T((1)) size_t (DCALL *tp_asvector_nothrow)(DeeObject *self, size_t dst_length, /*out*/ DREF DeeObject **dst);
21052092

2106-
#if 1 /* TODO: CONFIG_EXPERIMENTAL_UNIFIED_METHOD_HINTS: REMOVE ME */
2107-
/* These will go away and only be accessible via method hints.
2108-
* Reason: Not perfectly equivalent to "tp_foreach", so user-impl must happen via attributes. */
2109-
WUNUSED_T NONNULL_T((1)) int (DCALL *_deprecated_tp_unpack)(DeeObject *self, size_t dst_length, /*out*/ DREF DeeObject **dst);
2110-
WUNUSED_T NONNULL_T((1, 4)) size_t (DCALL *_deprecated_tp_unpack_ex)(DeeObject *self, size_t dst_length_min, size_t dst_length_max, /*out*/ DREF DeeObject **dst);
2111-
WUNUSED_T NONNULL_T((1)) int (DCALL *_deprecated_tp_unpack_ub)(DeeObject *self, size_t dst_length, /*out*/ DREF DeeObject **dst);
2112-
#endif
2113-
21142093
/* All of the following are *always* and *unconditionally* implemented
21152094
* when the associated type has the "tp_features & TF_KW" flag set,
21162095
* with the exception of `DeeKwds_Type', which has that flag, but does
@@ -2489,9 +2468,6 @@ PRIVATE struct type_seq myob_seq = {
24892468
/* .tp_setrange = */ (int (DCALL *)(DeeObject *, DeeObject *, DeeObject *, DeeObject *))&myob_setrange,
24902469
/* .tp_foreach = */ (Dee_ssize_t (DCALL *)(DeeObject *__restrict, Dee_foreach_t, void *))&myob_foreach,
24912470
/* .tp_foreach_pair = */ (Dee_ssize_t (DCALL *)(DeeObject *__restrict, Dee_foreach_pair_t, void *))&myob_foreach_pair,
2492-
/* .tp_enumerate = */ NULL,
2493-
/* .tp_enumerate_index= */ NULL,
2494-
/* .tp_iterkeys = */ NULL,
24952471
/* .tp_bounditem = */ (int (DCALL *)(DeeObject *, DeeObject *))&myob_bounditem,
24962472
/* .tp_hasitem = */ (int (DCALL *)(DeeObject *, DeeObject *))&myob_hasitem,
24972473
/* .tp_size = */ (size_t (DCALL *)(DeeObject *__restrict))&myob_size,
@@ -2524,9 +2500,6 @@ PRIVATE struct type_seq myob_seq = {
25242500
/* .tp_hasitem_string_len_hash = */ (int (DCALL *)(DeeObject *, char const *, size_t, Dee_hash_t))&myob_hasitem_string_len_hash,
25252501
/* .tp_asvector = */ (size_t (DCALL *)(DeeObject *, size_t, DREF DeeObject **))&myob_asvector,
25262502
/* .tp_asvector_nothrow = */ (size_t (DCALL *)(DeeObject *, size_t, DREF DeeObject **))&myob_asvector_nothrow,
2527-
/* ._deprecated_tp_unpack = */ NULL,
2528-
/* ._deprecated_tp_unpack_ex = */ NULL,
2529-
/* ._deprecated_tp_unpack_ub = */ NULL,
25302503
/* .tp_getitemnr = */ (DeeObject *(DCALL *)(DeeObject *__restrict, /*string*/ DeeObject *__restrict))NULL,
25312504
/* .tp_getitemnr_string_hash = */ (DeeObject *(DCALL *)(DeeObject *__restrict, char const *__restrict, Dee_hash_t))NULL,
25322505
/* .tp_getitemnr_string_len_hash = */ (DeeObject *(DCALL *)(DeeObject *__restrict, char const *__restrict, size_t, Dee_hash_t))NULL,
@@ -2537,13 +2510,13 @@ PRIVATE struct type_seq myob_seq = {
25372510
#endif
25382511

25392512
struct Dee_type_iterator {
2540-
/* Fast-pass for `DeeObject_Unpack(DeeObject_IterNext(self), 2)'
2513+
/* Fast-pass for `DeeSeq_Unpack(DeeObject_IterNext(self), 2)'
25412514
* @return: 0 : Success
25422515
* @return: 1 : Iterator has been exhausted
25432516
* @return: -1: Error */
25442517
WUNUSED_T NONNULL_T((1, 2)) int (DCALL *tp_nextpair)(DeeObject *__restrict self, /*out*/ DREF DeeObject *key_and_value[2]);
25452518

2546-
/* Fast-pass for `DeeObject_Unpack(DeeObject_IterNext(self), 2).first[key]/last[value]'
2519+
/* Fast-pass for `DeeSeq_Unpack(DeeObject_IterNext(self), 2).first[key]/last[value]'
25472520
* In the case of mapping iterators, these can be used to iterate only the
25482521
* key/value part of the map, without needing to construct a temporary tuple
25492522
* holding both values (as needs to be done by `tp_iter_next'). */
@@ -2622,8 +2595,8 @@ struct Dee_type_attr {
26222595
* If implemented, it *MUST* behave identical to the above operators.
26232596
*
26242597
* NOTE: Deemon will *NOT* substitute the above functions with those below!!!
2625-
* (As a matter of fact: it doesn't use DeeObject_Default* operators for
2626-
* any of this stuff since doing so would be slower due to the fact that
2598+
* (As a matter of fact: it doesn't use default__* operators for any
2599+
* of this stuff since doing so would be slower due to the fact that
26272600
* it would add a whole ton of otherwise unnecessary DeeObject_T-checks)
26282601
* This means that if you want to implement stuff below, you *MUST* also
26292602
* implement the operators above like follows:
@@ -4903,7 +4876,7 @@ DFUNDEF WUNUSED NONNULL((1, 2, 4)) Dee_ssize_t
49034876
DFUNDEF WUNUSED NONNULL((1)) DREF DeeObject *(DCALL DeeObject_Iter)(DeeObject *__restrict self);
49044877
DFUNDEF WUNUSED NONNULL((1)) DREF DeeObject *(DCALL DeeObject_IterNext)(DeeObject *__restrict self);
49054878

4906-
/* Fast-pass for `DeeObject_Unpack(DeeObject_IterNext(self), 2).first[key]/last[value]'
4879+
/* Fast-pass for `DeeSeq_Unpack(DeeObject_IterNext(self), 2).first[key]/last[value]'
49074880
* In the case of mapping iterators, these can be used to iterate only the
49084881
* key/value part of the map, without needing to construct a temporary tuple
49094882
* holding both values (as needs to be done by `DeeObject_IterNext'). */
@@ -4928,35 +4901,9 @@ DFUNDEF WUNUSED NONNULL((1, 2)) Dee_ssize_t /* TODO: Refactor more code to use t
49284901
(DCALL DeeObject_Foreach)(DeeObject *__restrict self, Dee_foreach_t proc, void *arg);
49294902

49304903
/* Same as `DeeObject_Foreach()', but meant for enumeration of mapping key/value pairs. */
4931-
DFUNDEF WUNUSED NONNULL((1, 2)) Dee_ssize_t /* TODO: Refactor more code to use this instead of `DeeObject_Unpack()' */
4904+
DFUNDEF WUNUSED NONNULL((1, 2)) Dee_ssize_t /* TODO: Refactor more code to use this instead of `DeeSeq_Unpack()' */
49324905
(DCALL DeeObject_ForeachPair)(DeeObject *__restrict self, Dee_foreach_pair_t proc, void *arg);
49334906

4934-
/* Unpack the given sequence `self' into `dst_length' items then stored within the `dst' vector.
4935-
* This operator follows `DeeObject_Foreach()' semantics, in that unbound items are skipped.
4936-
* @return: 0 : Success (`dst' now contains exactly `dst_length' references to [1..1] objects)
4937-
* @return: -1: An error was thrown (`dst' may have been modified, but contains no references) */
4938-
DFUNDEF WUNUSED ATTR_OUTS(3, 2) NONNULL((1)) int /* DEPRECATED after "CONFIG_EXPERIMENTAL_UNIFIED_METHOD_HINTS" -- use DeeObject_InvokeMethodHint(seq_unpack) instead */
4939-
(DCALL DeeObject_Unpack)(DeeObject *__restrict self, size_t dst_length,
4940-
/*out*/ DREF DeeObject **__restrict dst);
4941-
4942-
/* @return: * : The actual # of objects written to `dst' (always in range [dst_length_min, dst_length_max])
4943-
* @return: (size_t)-1: Error */
4944-
DFUNDEF WUNUSED NONNULL((1)) size_t /* DEPRECATED after "CONFIG_EXPERIMENTAL_UNIFIED_METHOD_HINTS" -- use DeeObject_InvokeMethodHint(seq_unpack_ex) instead */
4945-
(DCALL DeeObject_UnpackEx)(DeeObject *__restrict self,
4946-
size_t dst_length_min, size_t dst_length_max,
4947-
/*out*/ DREF DeeObject **__restrict dst);
4948-
4949-
/* Similar to `DeeObject_Unpack()', but does not skip unbound items. Instead,
4950-
* unbound items will appear as `NULL' in `dst' upon success (meaning you have
4951-
* to use `Dee_XDecrefv()' to drop references).
4952-
* This operator follows `DeeObject_Enumerate()' semantics, in that unbound items
4953-
* are NOT skipped.
4954-
* @return: 0 : Success (`dst' now contains exactly `dst_length' references to [0..1] objects)
4955-
* @return: -1: An error was thrown (`dst' may have been modified, but contains no references) */
4956-
DFUNDEF WUNUSED ATTR_OUTS(3, 2) NONNULL((1)) int /* DEPRECATED after "CONFIG_EXPERIMENTAL_UNIFIED_METHOD_HINTS" -- use DeeObject_InvokeMethodHint(seq_unpack_ub) instead */
4957-
(DCALL DeeObject_UnpackWithUnbound)(DeeObject *__restrict self, size_t dst_length,
4958-
/*out*/ DREF DeeObject **__restrict dst);
4959-
49604907
/* >> DeeObject_GetAttr() -- <self>.<attr>;
49614908
* Retrieve a named attribute of an object
49624909
* @return: * : The value of the attribute `attr'
@@ -5160,8 +5107,6 @@ DFUNDEF NONNULL((1, 2)) void (DCALL DeeObject_PutBuf)(DeeObject *__restrict self
51605107
#define DeeObject_SetRangeBeginIndex(self, begin, end, value) __builtin_expect(DeeObject_SetRangeBeginIndex(self, begin, end, value), 0)
51615108
#define DeeObject_SetRangeEndIndex(self, begin, end, value) __builtin_expect(DeeObject_SetRangeEndIndex(self, begin, end, value), 0)
51625109
#define DeeObject_SetRangeIndex(self, begin, end, value) __builtin_expect(DeeObject_SetRangeIndex(self, begin, end, value), 0)
5163-
#define DeeObject_Unpack(self, dst_length, objv) __builtin_expect(DeeObject_Unpack(self, dst_length, objv), 0)
5164-
#define DeeObject_UnpackWithUnbound(self, dst_length, objv) __builtin_expect(DeeObject_UnpackWithUnbound(self, dst_length, objv), 0)
51655110
#define DeeObject_DelAttr(self, attr) __builtin_expect(DeeObject_DelAttr(self, attr), 0)
51665111
#define DeeObject_SetAttr(self, attr, value) __builtin_expect(DeeObject_SetAttr(self, attr, value), 0)
51675112
#ifndef DeeObject_DelAttrString

0 commit comments

Comments
 (0)