Skip to content

Commit

Permalink
Emit deprecation warnings for the length and owner keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
shi-eric committed Jan 7, 2025
1 parent 3d2b5f9 commit 57fb847
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

### Changed

- Emit deprecation warnings for the use of the `owner` and `length` keywords in
the `wp.array` initializer.

### Fixed

- Fix errors during graph capture caused by module unloading ([GH-401](https://github.com/NVIDIA/warp/issues/401)).
Expand Down
14 changes: 14 additions & 0 deletions warp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,22 @@ def __init__(
)
elif length is not None:
# backward compatibility
warp.utils.warn(
"The 'length' keyword is deprecated and will be removed\n" "in a future version. Use 'shape' instead.",
category=DeprecationWarning,
stacklevel=2,
)
shape = (length,)

if owner:
warp.utils.warn(
"The 'owner' keyword in the array initializer is\n"
"deprecated and will be removed in a future version. It currently has no effect.\n"
"Pass a function to the 'deleter' keyword instead.",
category=DeprecationWarning,
stacklevel=2,
)

# determine the construction path from the given arguments
if data is not None:
# data or ptr, not both
Expand Down

0 comments on commit 57fb847

Please sign in to comment.