Skip to content

Commit 88e1167

Browse files
authored
Suppress a deprecation warning on import from dpctl.tensor submodule (#2709)
The `dpctl.tensor` submodule was marked as a deprecated in scope of [dpctl-2191](IntelPython/dpctl#2191) which will cause raising `DeprecationWarning` for any import from `dpctl.tensor`. The PR suppresses the warning when dpnp imports the borrowed attributes from `dpctl.tensor`.
1 parent 5416df7 commit 88e1167

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum
5151

5252
### Fixed
5353

54+
* Suppressed a potential deprecation warning triggered during import of the `dpctl.tensor` module [#2709](https://github.com/IntelPython/dpnp/pull/2709)
55+
5456
### Security
5557

5658

dpnp/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import os
3030
import sys
31+
import warnings
3132

3233
mypath = os.path.dirname(os.path.realpath(__file__))
3334

@@ -61,7 +62,9 @@
6162
)
6263

6364
# Borrowed from DPCTL
64-
from dpctl.tensor import __array_api_version__, DLDeviceType
65+
with warnings.catch_warnings():
66+
warnings.simplefilter("ignore", DeprecationWarning)
67+
from dpctl.tensor import __array_api_version__, DLDeviceType
6568

6669
from .dpnp_array import dpnp_array as ndarray
6770
from .dpnp_array_api_info import __array_namespace_info__

0 commit comments

Comments
 (0)