-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: read-only values in cython funcs #37613
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
Changes from all commits
cf89507
eb5b6e9
192231a
dbe99c5
8d41c44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1025,9 +1025,8 @@ def _addsub_object_array(self, other: np.ndarray, op): | |
result : same class as self | ||
""" | ||
assert op in [operator.add, operator.sub] | ||
if len(other) == 1: | ||
if len(other) == 1 and self.ndim == 1: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jbrockmendel do you recall if tests were failing without this change, or unrelated to the tests added here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, a test failed without this change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. on the backport tests fail with and without this change. with this change, we get an additional 13 performance warnings. without this change, we don't get performance warnings in 3 tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Probably the same three I saw on master that motivated this edit. I just checked out the backport branch locally, will try to troubleshoot. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. im not wild about not-having a better solution, but i think the immediate issue can be addressed by making the condiiton There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @jbrockmendel for looking into this. I have updated the backport PR with this change for now, pending further discussion there on best approach. #37633 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the suggested update applied to the backport still failed. 458e0ce There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jbrockmendel I'm struggling with this. (working on 1.1x so maybe differences with master) can you justify this change other than tests were failing. somethings changed in the internals dispatch where other in the _addsub_object_array call is now a scalar (in a 2d array with shape 1,1) for the failing so not raising a performance warning makes sense if other is now a 'scalar' (also the repr fails for a 2d timedelta array) on 1.1.x
with the patch applied ( #37633)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I never did manage to track down the underlying source of the problem that made this particular edit necessary. Its still early-ish afternoon for me so I can spend some more time today trying again if you think its a priority.
FWIW that was fixed in #37164 |
||
# If both 1D then broadcasting is unambiguous | ||
# TODO(EA2D): require self.ndim == other.ndim here | ||
return op(self, other[0]) | ||
|
||
warnings.warn( | ||
|
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.
maybe these need const?
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.
we can't use
const join_t
until cython3