Title: array[:] = value silently coerce value to array type even when unsafe · Issue #1164 · larray-project/larray · GitHub
Open Graph Title: array[:] = value silently coerce value to array type even when unsafe · Issue #1164 · larray-project/larray
X Title: array[:] = value silently coerce value to array type even when unsafe · Issue #1164 · larray-project/larray
Description: Unsure if this should be a warning or an error, but doing this silently is clearly not acceptable to me for unsafe conversions. class CS(CheckedSession): v: CheckedArray(a, dtype=int) >>> arr = ndtest(a) * 1.6 >>> arr a a0 a1 0.0 1.6 >>>...
Open Graph Description: Unsure if this should be a warning or an error, but doing this silently is clearly not acceptable to me for unsafe conversions. class CS(CheckedSession): v: CheckedArray(a, dtype=int) >>> arr = ndt...
X Description: Unsure if this should be a warning or an error, but doing this silently is clearly not acceptable to me for unsafe conversions. class CS(CheckedSession): v: CheckedArray(a, dtype=int) >>> ...
Opengraph URL: https://github.com/larray-project/larray/issues/1164
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"array[:] = value silently coerce value to array type even when unsafe","articleBody":"Unsure if this should be a warning or an error, but doing this silently is clearly not acceptable to me for unsafe conversions.\n\n```python\nclass CS(CheckedSession):\n v: CheckedArray(a, dtype=int)\n\n>>> arr = ndtest(a) * 1.6\n>>> arr\na a0 a1\n 0.0 1.6\n>>> cs = CS(v=arr)\n>>> cs.v\na a0 a1\n 0 1\n```\n\nSurprisingly Numpy has the issue too (I suppose we inherit it from there):\n\n```python\n>>> import numpy as np\n>>> np.__version__\n'2.3.5'\n>>> target = np.zeros(2, dtype=np.int64)\n>>> source = np.array([0., 1.6])\n>>> source.dtype\ndtype('float64')\n>>> np.can_cast(source.dtype, target.dtype)\nFalse\n>>> target[:] = source\n>>> target\n[0 1]\n```\nThis has been a known issue in Numpy for a looong time but even though the developers seem to agree it is unfortunate, it will be a while until that behavior can be changed (if ever) in Numpy. See https://github.com/numpy/numpy/issues/7730 and https://github.com/numpy/numpy/issues/8733","author":{"url":"https://github.com/gdementen","@type":"Person","name":"gdementen"},"datePublished":"2026-02-25T12:19:32Z","url":"https://github.com/larray-project/larray/issues/1164"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b90701b1-f724-7370-8c91-39ae489a3361 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D2E:30DBED:2FCA47E:3EDCFAB:6B002127 |
| html-safe-nonce | 32e1d1e7b675a0eecd377684fb05addb672502b12e4c4c08de3936aff53ae660 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDJFOjMwREJFRDoyRkNBNDdFOjNFRENGQUI6NkIwMDIxMjciLCJ2aXNpdG9yX2lkIjoiODg0NDgxMDk4NDA3MDU4NjY2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 89e5c478026df8d02d25cac9ba56e73e9260febe468548d68b55240baa97c44c |
| hovercard-subject-tag | issue:3989145377 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/larray-project/larray/1164/issue_layout |
| twitter:image | https://opengraph.githubassets.com/361e779b630ff22cf9afa076293f2f2765f86c888a575789863fde8e13a53510/larray-project/larray/issues/1164 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/361e779b630ff22cf9afa076293f2f2765f86c888a575789863fde8e13a53510/larray-project/larray/issues/1164 |
| og:image:alt | Unsure if this should be a warning or an error, but doing this silently is clearly not acceptable to me for unsafe conversions. class CS(CheckedSession): v: CheckedArray(a, dtype=int) >>> arr = ndt... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gdementen |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/larray-project/larray git https://github.com/larray-project/larray.git |
| octolytics-dimension-user_id | 26460981 |
| octolytics-dimension-user_login | larray-project |
| octolytics-dimension-repository_id | 16981067 |
| octolytics-dimension-repository_nwo | larray-project/larray |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16981067 |
| octolytics-dimension-repository_network_root_nwo | larray-project/larray |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width