-
Notifications
You must be signed in to change notification settings - Fork 143
Fix failure with narrowing of ssize_t to int in macos #1602
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
Conversation
9d781fe
to
87cb6d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a compilation failure on macOS by standardizing variable types from platform-specific types to npy_intp
. The issue occurred because ssize_t
is a long
on macOS, which couldn't be safely narrowed to int
array initializers.
- Replaces all
ssize_t
andint
declarations withnpy_intp
for consistency with NumPy array shape/stride types - Updates loop iterator variables to use
npy_intp
instead ofint
- Increments C code cache version numbers to reflect the type changes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
pytensor/tensor/elemwise_cgen.py | Changes stride, jump, and iterator variable declarations from ssize_t /int to npy_intp |
pytensor/tensor/elemwise.py | Updates C code cache version numbers to reflect the type changes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1602 +/- ##
=======================================
Coverage 81.71% 81.71%
=======================================
Files 230 230
Lines 52924 52925 +1
Branches 9402 9402
=======================================
+ Hits 43248 43249 +1
Misses 7244 7244
Partials 2432 2432
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Everything is
npy_intp
now which is the type of numpy array shape and strides anyway.CI started failing recently in the macos test, because there the old ssize_t was a long, and we were trying to initialize an int array out of it.
📚 Documentation preview 📚: https://pytensor--1602.org.readthedocs.build/en/1602/