Skip to content

Fix _as_numpy_array: use variable obj instead of string literal "obj"#14472

Merged
bluetech merged 2 commits into
pytest-dev:mainfrom
algojogacor:fix/hasattr-obj-variable
May 14, 2026
Merged

Fix _as_numpy_array: use variable obj instead of string literal "obj"#14472
bluetech merged 2 commits into
pytest-dev:mainfrom
algojogacor:fix/hasattr-obj-variable

Conversation

@algojogacor
Copy link
Copy Markdown
Contributor

The second hasattr call in _as_numpy_array incorrectly passed the string literal "obj" instead of the variable obj when checking for __array_interface__. This caused objects implementing only __array_interface__ (without __array__) to not be recognized as numpy-like arrays by pytest.approx.

Closes #14456

The second hasattr call in _as_numpy_array incorrectly passed the
string literal "obj" instead of the variable obj when checking for
__array_interface__. This caused objects implementing only
__array_interface__ (without __array__) to not be recognized as
numpy-like arrays by pytest.approx.

Closes pytest-dev#14456
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label May 13, 2026
Comment thread changelog/14456.bugfix.rst Outdated
@bluetech bluetech added the backport 9.0.x apply to PRs at any point; backports the changes to the 9.0.x branch label May 14, 2026
@bluetech bluetech enabled auto-merge (squash) May 14, 2026 09:25
@bluetech bluetech merged commit 21be7a2 into pytest-dev:main May 14, 2026
33 checks passed
@patchback
Copy link
Copy Markdown

patchback Bot commented May 14, 2026

Backport to 9.0.x: 💚 backport PR created

✅ Backport PR branch: patchback/backports/9.0.x/21be7a259424e509e3d667082a138bcc8fc45c00/pr-14472

Backported as #14480

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 9.0.x apply to PRs at any point; backports the changes to the 9.0.x branch bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_as_numpy_array: hasattr uses string literal 'obj' instead of variable

2 participants