Skip to content

Fix sycl queue argument validation #1052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: black
exclude: "versioneer.py|dpctl/_version.py"
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
Expand Down
5 changes: 5 additions & 0 deletions dpctl/_sycl_queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ cdef class SyclQueue(_SyclQueue):
props = _parse_queue_properties(
kwargs.pop('property', _queue_property_type._DEFAULT_PROPERTY)
)
if (kwargs):
raise TypeError(
f"Unsupported keyword arguments {kwargs} to "
"SyclQueue constructor encountered."
)
len_args = len(args)
if len_args == 0:
status = self._init_queue_default(props)
Expand Down
8 changes: 8 additions & 0 deletions dpctl/tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ def test_invalid_filter_selectors(invalid_filter):
dpctl.SyclQueue(invalid_filter)


def test_unexpected_keyword():
"""
An unexpected keyword use raises TypeError.
"""
with pytest.raises(TypeError):
dpctl.SyclQueue(device="cpu")


def test_context_not_equals():
try:
gpuQ = dpctl.SyclQueue("gpu")
Expand Down