Skip to content

Conversation

@vlad-perevezentsev
Copy link
Collaborator

@vlad-perevezentsev vlad-perevezentsev commented Dec 22, 2025

This PR aligns usm_ndarray scalar conversion semantics with the Python Array API by allowing scalar conversion only for 0D usm_ndarrays

Conversions to Python numeric scalars via int, float, complex, bool, and their corresponding methods (__int__, _float__, __complex__, bool) now raise TypeErrorwhen applied to usm_ndarrays withndim !=0`

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

@vlad-perevezentsev vlad-perevezentsev self-assigned this Dec 22, 2025
@github-actions
Copy link

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_103 ran successfully.
Passed: 1114
Failed: 44
Skipped: 82

@coveralls
Copy link
Collaborator

coveralls commented Dec 22, 2025

Coverage Status

coverage: 86.245%. remained the same
when pulling 5f28594 on disallow_conv_to_scalar_ndim
into 4c57ee7 on master.

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_108 ran successfully.
Passed: 1112
Failed: 46
Skipped: 82

ndgrigorian
ndgrigorian previously approved these changes Jan 8, 2026
Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aside from minor comments this LGTM

@vlad-perevezentsev vlad-perevezentsev changed the title Disallow numeric scalar conversation for non-0D arrays Disallow scalar conversation for non-0D arrays Jan 9, 2026
@vlad-perevezentsev vlad-perevezentsev marked this pull request as ready for review January 9, 2026 14:04
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_109 ran successfully.
Passed: 1114
Failed: 44
Skipped: 82

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_110 ran successfully.
Passed: 1114
Failed: 44
Skipped: 82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants