Skip to content

Add shape handling and better compatabilty with numpy#31

Merged
rjfarmer merged 4 commits into
mainfrom
feature/numpy-parity
May 30, 2026
Merged

Add shape handling and better compatabilty with numpy#31
rjfarmer merged 4 commits into
mainfrom
feature/numpy-parity

Conversation

@rjfarmer
Copy link
Copy Markdown
Owner

No description provided.

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 89.677%. remained the same — feature/numpy-parity into main

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the array constructors and conversion helpers in the three numpy-backed extension modules (qarray, qiarray, qcarray) to accept tuple shapes (multidimensional) and adds numpy-compatible copy/order/ndmin keyword arguments to array/asarray, plus an order keyword to ravel. Tests are added for the new shapes/keywords and for numpy reductions/concatenate/stack interoperability. A small fix in qcmplx.c adds float/int acceptance in PyObject_to_QuadCObject and corrects two bool-returning paths that wrongly returned NULL.

Changes:

  • Add multidimensional shape parsing and shared ..._from_object / ..._parse_order helpers in qfloatarray.c, qiarray.c, qcarray.c; rewire array/asarray/ravel to use METH_VARARGS | METH_KEYWORDS with new kwargs; update .pyi stubs accordingly.
  • In qcmplx.c, accept PyFloat/PyLong inputs in PyObject_to_QuadCObject and replace two return NULL; with return false; in a bool-returning function.
  • Tooling: tighten build_and_test.sh with set -euo pipefail, and tweak .github/copilot-instructions.md wording (require limited API; ufunc preference; broaden test guidance). Tests added in tests/qarray_test.py, tests/qiarray_test.py, tests/qcarray_test.py.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyquadp/qfloatarray.c Adds shape/order helpers, refactors array/asarray/ravel/constructors for ND shapes and kwargs.
pyquadp/qiarray.c Same refactor pattern as qfloatarray for the integer array module.
pyquadp/qcarray.c Same refactor pattern as qfloatarray for the complex array module.
pyquadp/qcmplx.c Adds float/int support in PyObject_to_QuadCObject and fixes wrong NULL returns in bool paths.
pyquadp/qarray.pyi Stubs updated for ShapeLike and new keyword arguments.
pyquadp/qiarray.pyi Stubs updated for ShapeLike and new keyword arguments.
pyquadp/qcarray.pyi Stubs updated for ShapeLike and new keyword arguments.
tests/qarray_test.py New tests for tuple shapes, ravel order, array/asarray kwargs, and numpy reductions/concat/stack.
tests/qiarray_test.py Same set of new tests for the integer array module.
tests/qcarray_test.py Same set of new tests for the complex array module.
build_and_test.sh Adds set -euo pipefail to fail fast on errors.
.github/copilot-instructions.md Tightens limited-API requirement, adds ufunc preference, broadens test validation guidance.

@rjfarmer rjfarmer merged commit 65f230b into main May 30, 2026
166 checks passed
@rjfarmer rjfarmer deleted the feature/numpy-parity branch May 30, 2026 19:19
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.

3 participants