Skip to content

use only hashable objects #14595

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

Closed

Conversation

mgoacolou
Copy link
Contributor

PR Summary

in some cases (specific projection) we need to add unhasable parameters
this PR skip them in _make_key for robustness

this add no change in API

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v3.2.0 milestone Jun 21, 2019
@tacaswell
Copy link
Member

Can you put this bail point after trying to convert it to a tuple? Currently values that are list or other mutable iterables which are not hashable will be converted to tuples and be included in the key, with this patch they will be skipped.

Would it be better to fallback to id(v) rather than just skipping the input all together?

You probably want to apply the same fixes to fixlist (defined right below) for the same reason.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

There is a subtle behavior change for values of mutable iterables.

Should get a test.

@anntzer
Copy link
Contributor

anntzer commented Jun 21, 2019

FWIW I argued a while ago that _make_key should just serialize everything by dumping them to a pickle format (well, sure, things can be unpicklable but that's much rarer than unhashable).

@tacaswell tacaswell modified the milestones: v3.2.0, v3.3.0 Aug 24, 2019
@QuLogic QuLogic modified the milestones: v3.3.0, v3.4.0 May 2, 2020
@QuLogic
Copy link
Member

QuLogic commented Jan 22, 2021

This hashing is now gone due to #19153.

@QuLogic QuLogic closed this Jan 22, 2021
@QuLogic QuLogic removed this from the v3.4.0 milestone Jan 22, 2021
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