@@ -286,6 +286,7 @@ class ClassStateData(typing.NamedTuple):
286
286
287
287
# have to defer processing these
288
288
defer_protected_methods : typing .List [Method ]
289
+ defer_private_nonvirtual_methods : typing .List [Method ]
289
290
defer_private_virtual_methods : typing .List [Method ]
290
291
defer_protected_fields : typing .List [Field ]
291
292
@@ -750,6 +751,7 @@ def on_class_start(self, state: AWClassBlockState) -> typing.Optional[bool]:
750
751
typealias_names = typealias_names ,
751
752
# Method data
752
753
defer_protected_methods = [],
754
+ defer_private_nonvirtual_methods = [],
753
755
defer_private_virtual_methods = [],
754
756
defer_protected_fields = [],
755
757
# Trampoline data
@@ -983,8 +985,11 @@ def on_class_method(self, state: AWClassBlockState, method: Method) -> None:
983
985
self ._on_class_method (state , method , cctx .wrapped_public_methods )
984
986
elif access == "protected" :
985
987
cdata .defer_protected_methods .append (method )
986
- elif access == "private" and is_polymorphic :
987
- cdata .defer_private_virtual_methods .append (method )
988
+ elif access == "private" :
989
+ if is_polymorphic :
990
+ cdata .defer_private_virtual_methods .append (method )
991
+ else :
992
+ cdata .defer_private_nonvirtual_methods .append (method )
988
993
989
994
def _on_class_method (
990
995
self ,
@@ -1152,6 +1157,23 @@ def _on_class_method(
1152
1157
f"{ cdata .cls_key } ::{ method_name } : has && ref-qualifier which cannot be directly bound by pybind11, must specify cpp_code or ignore_py"
1153
1158
)
1154
1159
1160
+ def _on_class_method_process_overload_only (
1161
+ self , state : AWClassBlockState , method : Method
1162
+ ):
1163
+ cdata = state .user_data
1164
+
1165
+ method_name = self ._get_fn_name (method )
1166
+ if not method_name :
1167
+ return
1168
+
1169
+ self .gendata .get_function_data (
1170
+ method_name ,
1171
+ method ,
1172
+ cdata .cls_key ,
1173
+ cdata .data ,
1174
+ True ,
1175
+ )
1176
+
1155
1177
def _is_copy_move_constructor (
1156
1178
self , cctx : ClassContext , first_type_param : DecoratedType
1157
1179
) -> bool :
@@ -1242,6 +1264,17 @@ def on_class_end(self, state: AWClassBlockState) -> None:
1242
1264
f"{ cdata .cls_key } has trampoline_inline_code specified, but there is no trampoline!"
1243
1265
)
1244
1266
1267
+ else :
1268
+ # still need to do minimal processing to add deferred functions
1269
+ # to the overload tracker, otherwise we won't handle it correctly
1270
+ for m in cdata .defer_protected_methods :
1271
+ self ._on_class_method_process_overload_only (state , m )
1272
+ for m in cdata .defer_private_virtual_methods :
1273
+ self ._on_class_method_process_overload_only (state , m )
1274
+
1275
+ for m in cdata .defer_private_nonvirtual_methods :
1276
+ self ._on_class_method_process_overload_only (state , m )
1277
+
1245
1278
#
1246
1279
# Function/method processing
1247
1280
#
0 commit comments