For the record, along the way I notice a) that metacpan does not know your module depends on ExtUtils::Depends and Test2::Suite, and b) in the module you appear to invoke Scalar::Util::weaken without loading Scalar::Util.
After confusing myself a few times, I've come to the conclusion that you've hit an unfortunate case - the EXTEND macro evaluates its arguments several times. Along the way it invokes EXTEND_HWM_SET, which looks like this for a debugging build:
# define EXTEND_HWM_SET(p, n) \ STMT_START { \ SSize_t ix = (p) - PL_stack_base + (n); \ if (ix > PL_curstackinfo->si_stack_hwm) \ PL_curstackinfo->si_stack_hwm = ix; \ } STMT_END
So given that n here is the string ix==3 ? 2*n : n, it is quite reasonable things are going to go wrong. If you use some variable other than ix, or (for example) duplicate the EXTEND call inside the if/else blocks to avoid the conditional, then the error goes away.
Update: #19818
HTH, Hugo
In reply to Re: XS debugging "failed to extend arg stack"
by hv
in thread [Solved] XS debugging "failed to extend arg stack"
by NERDVANA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |