Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MRBind is meant to cover a large API surface area with minimal effort, but in tu

All MRBind features were developed without any use of AI.

I received some trivial vibecoded bugfix PRs that were merged after manual cleanup (which among other things includes replacing generated comments). I've also merged some generated testcases for those bugs.
I received some simple vibecoded contributions (bugfixes, binary size reductions) that were merged after manual cleanup, which among other things includes replacing the generated comments. I've also merged some generated testcases for those bugs.

## Usage

Expand Down
31 changes: 17 additions & 14 deletions include/mrbind/targets/pybind11/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -3668,9 +3668,12 @@ static_assert(std::is_same_v<MRBind::RebindContainer<std::array<int, 4>, float>,
#define DETAIL_MB_PB11_CONV_OP_KIND_() MRBind::pb11::FuncKind::conv_op
#define DETAIL_MB_PB11_CONV_OP_KIND_explicit() MRBind::pb11::FuncKind::conv_op_explicit

// If the parameter is empty, returns `nullptr`. Otherwise prepends `+`. This is intended for optional comment strings, and `+` forces a conversion to a pointer, which helps reduce the number of instantiations.
// If the parameter is empty, returns `(const char *)nullptr`. Otherwise prepends `+`. This is intended for optional comment strings, and `+` forces a conversion to a pointer, which helps reduce the number of instantiations.
// The cast on `nullptr` is there for the same reason, to reduce the number of instantiations.
// It's good to use this macro instead of conditionally passing the comment, since it too reduces the number of instantiations,
// and Pybind apparently treats the null pointers as if no comment was passed at all.
#define DETAIL_MB_PB11_COMMENT_PTR(...) MRBIND_CAT(DETAIL_MB_PB11_COMMENT_PTR_, __VA_OPT__(1))(__VA_ARGS__)
#define DETAIL_MB_PB11_COMMENT_PTR_(...) nullptr
#define DETAIL_MB_PB11_COMMENT_PTR_(...) ((const char *)nullptr)
#define DETAIL_MB_PB11_COMMENT_PTR_1(...) +__VA_ARGS__

// Returns the "namespace marker" class for the given namespace stack.
Expand Down Expand Up @@ -3755,9 +3758,9 @@ static_assert(std::is_same_v<MRBind::RebindContainer<std::array<int, 4>, float>,
/* Pybind extras: */\
[](auto _pb11_f){_pb11_f(MRBIND_STRIP_LEADING_COMMA( \
/* Parameters. */\
DETAIL_MB_PB11_MAKE_PARAMS(params_) \
/* Comment, if any. */ \
MRBIND_PREPEND_COMMA(comment_) \
DETAIL_MB_PB11_MAKE_PARAMS(params_), \
/* Comment, possibly null. */ \
DETAIL_MB_PB11_COMMENT_PTR(comment_) \
/* Lifetime annotations. */ \
DETAIL_MB_PB11_KEEP_ALIVE(lifetimes_) \
));} \
Expand Down Expand Up @@ -3890,9 +3893,9 @@ static_assert(std::is_same_v<MRBind::RebindContainer<std::array<int, 4>, float>,
>(\
_pb11_c,\
/* Name. */\
MRBind::pb11::ToPythonName(MRBIND_STR(MRBIND_IDENTITY fullname_)).c_str()\
/* Comment, if any. */\
DETAIL_MB_PB11_PREPEND_COMMA_PLUS(comment_)\
MRBind::pb11::ToPythonName(MRBIND_STR(MRBIND_IDENTITY fullname_)).c_str(),\
/* Comment, possibly null. */\
DETAIL_MB_PB11_COMMENT_PTR(comment_)\
); \
/* Add `offsetof` static variables. */\
MRBIND_CAT(DETAIL_MB_PB11_DISPATCH_MEMBER_field_OFFSETOF_,static_)(qualname_, name_) \
Expand Down Expand Up @@ -3923,9 +3926,9 @@ static_assert(std::is_same_v<MRBind::RebindContainer<std::array<int, 4>, float>,
_pb11_c, \
&_pb11_state.func_scope_state, _pb11_state.pass_number \
/* Parameters. */\
DETAIL_MB_PB11_MAKE_PARAMS(params_) \
/* Comment, if any. */\
DETAIL_MB_PB11_PREPEND_COMMA_PLUS(comment_) \
DETAIL_MB_PB11_MAKE_PARAMS(params_), \
/* Comment, possibly null. */\
DETAIL_MB_PB11_COMMENT_PTR(comment_)\
/* Lifetime annotations. */ \
DETAIL_MB_PB11_KEEP_ALIVE(lifetimes_) \
);
Expand Down Expand Up @@ -3960,9 +3963,9 @@ static_assert(std::is_same_v<MRBind::RebindContainer<std::array<int, 4>, float>,
/* Pybind extras: */\
[](auto _pb11_f){_pb11_f(MRBIND_STRIP_LEADING_COMMA( \
/* Parameters. */\
DETAIL_MB_PB11_MAKE_PARAMS(params_) \
/* Comment, if any. */ \
MRBIND_PREPEND_COMMA(comment_) \
DETAIL_MB_PB11_MAKE_PARAMS(params_), \
/* Comment, possibly null. */ \
DETAIL_MB_PB11_COMMENT_PTR(comment_) \
/* Lifetime annotations. */ \
DETAIL_MB_PB11_KEEP_ALIVE(lifetimes_) \
));} \
Expand Down