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

Need hash_func for type re.Pattern #1189

Closed
tc87 opened this issue Mar 6, 2020 · 3 comments
Closed

Need hash_func for type re.Pattern #1189

tc87 opened this issue Mar 6, 2020 · 3 comments
Assignees

Comments

@tc87
Copy link

@tc87 tc87 commented Mar 6, 2020

Summary

A community member noticed a "cannot hash of type" issue. More information can be found in this forum discussion.

Full error message

This is the error the community member received:UnhashableType: Cannot hash object of type re.Pattern

@tc87

This comment has been minimized.

Copy link
Author

@tc87 tc87 commented Mar 6, 2020

Additional info from Kevin:

The function cached is:
def get_config(filename=None, appname=‘your name’):

which returns a ConfigParser object. Which I do want cached!

The hash_funcs noop works
@st.cache(hash_funcs={re.Pattern: lambda _: None})

@jrhone

This comment has been minimized.

Copy link
Contributor

@jrhone jrhone commented Mar 17, 2020

import re
pattern = '.*'

p = re.compile(pattern, re.I)
(p.pattern, p.flags) -> ('.*', 34)

p = re.compile(pattern)
(p.pattern, p.flags) -> ('.*', 32)
@tc87

This comment has been minimized.

Copy link
Author

@tc87 tc87 commented Mar 26, 2020

This issue has been fixed in 1232 and will now be closed.

@tc87 tc87 closed this Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.