Skip to content

Commit 667fe3e

Browse files
authored
Use hasattr instead of getattr in checks for convert_item call (#2467)
The PR improves tests logic to replace unnecessary `getattr` with `hasattr` call to check an item interface.
1 parent f15dafe commit 667fe3e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Fixed
1414

1515

16-
## [0.18.0] - 05/DD/2025
16+
## [0.18.0] - 06/DD/2025
1717

1818
This release achieves 100% compliance with Python Array API specification (revision [2024.12](https://data-apis.org/array-api/2024.12/)).
1919
The release provides enhanced compatibility with NumPy 2.2.5. Window and mathematical routines are complemented by a set of new functions.
@@ -61,6 +61,7 @@ Moreover, it adds support to build `dpnp` from the source for AMD GPUs.
6161
* Added handling of empty string passed to a test env variable defining data type scope as a `False` value [#2415](https://github.com/IntelPython/dpnp/pull/2415)
6262
* Resolved build issues on non-Intel targets in `dpnp.i0` and `dpnp.kaiser` [#2439](https://github.com/IntelPython/dpnp/pull/2439)
6363
* Ensure consistency in the `dpnp.linalg.LinAlgError` exception raised on singular input matrices for both non-batched and batched cases in `dpnp.linalg.inv` [#2458] (https://github.com/IntelPython/dpnp/pull/2458)
64+
* Updated test f/w to correct a check of array interface while converting to `numpy.ndarray` for comparison [#2467] (https://github.com/IntelPython/dpnp/pull/2467)
6465

6566

6667
## [0.17.0] - 02/26/2025

dpnp/dpnp_utils/dpnp_algo_utils.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ cdef ERROR_PREFIX = "DPNP error:"
7676

7777

7878
def convert_item(item):
79-
if getattr(item, "__sycl_usm_array_interface__", False):
79+
if hasattr(item, "__sycl_usm_array_interface__"):
8080
item_converted = dpnp.asnumpy(item)
81-
elif getattr(item, "__array_interface__", False): # detect if it is a container (TODO any better way?)
81+
elif hasattr(item, "__array_interface__"): # detect if it is a container (TODO any better way?)
8282
mod_name = getattr(item, "__module__", 'none')
8383
if (mod_name != 'numpy'):
8484
item_converted = dpnp.asnumpy(item)

0 commit comments

Comments
 (0)