Skip to content

Commit

Permalink
Merge branch 'ershi/array-deprecation-warnings' into 'main'
Browse files Browse the repository at this point in the history
Emit deprecation warnings for the length and owner keywords

See merge request omniverse/warp!955
  • Loading branch information
mmacklin committed Jan 14, 2025
2 parents 0fcefa8 + 57fb847 commit 9aa8c38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

- Files in the kernel cache will be named according to their directory. Previously, all files began with
`module_codegen` ([GH-431](https://github.com/NVIDIA/warp/issues/431)).
- Emit deprecation warnings for the use of the `owner` and `length` keywords in
the `wp.array` initializer.

### Fixed

Expand Down
14 changes: 14 additions & 0 deletions warp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,8 +1700,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 9aa8c38

Please sign in to comment.