Skip to content

Fix confusing loop start expression in py_c_api.cc - #1088

Closed
justinchuby with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-only-review-suggestion
Closed

Fix confusing loop start expression in py_c_api.cc#1088
justinchuby with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-only-review-suggestion

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown

The dimension-copy loop used num_dims - num_dims as the start value (always 0), which is unnecessarily confusing and prone to type-deduction surprises.

  • pyop/py_c_api.cc: Replace auto n = num_dims - num_dims with explicit size_t n = 0; add npy_dims.reserve(num_dims) to avoid unnecessary reallocations.
// Before
std::vector<std::size_t> npy_dims;
for (auto n = num_dims - num_dims; n < num_dims; ++n) {

// After
std::vector<std::size_t> npy_dims;
npy_dims.reserve(num_dims);
for (size_t n = 0; n < num_dims; ++n) {

Copilot AI changed the title [WIP] Fix code as per review comment Fix confusing loop start expression in py_c_api.cc Jul 1, 2026
Copilot AI requested a review from justinchuby July 1, 2026 05:22
@justinchuby justinchuby closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants