Skip to content
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

[FIX] Support numpy 1.22 #5760

Merged
merged 2 commits into from
Jan 4, 2022
Merged

[FIX] Support numpy 1.22 #5760

merged 2 commits into from
Jan 4, 2022

Conversation

markotoplak
Copy link
Member

  • np.frompyfunc does convert outputs to the out type anymore
  • Adapt a locking test for changed numpy internals

@markotoplak markotoplak changed the title Support numpy 1.22 [FIX] Support numpy 1.22 Jan 4, 2022
@markotoplak
Copy link
Member Author

@ales-erjavec, could you please review this?

It seems that np.frompyfunc in numpy 1.22 does not do the conversion to the type of its out= argument anymore. Thus, the modified isnastr will always create an intermediate array. I do not see a clear way to avoid this.

@codecov
Copy link

codecov bot commented Jan 4, 2022

Codecov Report

Merging #5760 (f928f31) into master (300dbba) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #5760   +/-   ##
=======================================
  Coverage   86.15%   86.15%           
=======================================
  Files         315      315           
  Lines       66186    66195    +9     
=======================================
+ Hits        57023    57031    +8     
- Misses       9163     9164    +1     

elif arr.shape != (): # na is an object array
return na.astype(bool)
else: # na is not a numpy array
return na
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just add casting="unsafe" to __isnastr call? Optionally even check np.can_cast('bool', out.dtype)

@markotoplak
Copy link
Member Author

@ales-erjavec, thanks, I did not know about that ufunc argument. I changed added casting="unsafe" to all such calls, so this PR is now very simple.

@markotoplak markotoplak merged commit 06d7f24 into biolab:master Jan 4, 2022
markotoplak added a commit to markotoplak/orange3 that referenced this pull request Jan 7, 2022
@markotoplak markotoplak deleted the numpy122 branch February 28, 2022 11:55
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.

2 participants