Exception : org.python.core.PyException: TypeError: unhashable type: 'dict'

Sometime in perspective I have the following error:

org.python.core.PyException: TypeError: unhashable type: 'dict'

but I can’t figure out where it come from. Context in the logger is quite obscure…

Some project script is trying to use (assign) a dictionary as the key in another dictionary. Presumably at the top level, as this appears to be a traceback during script module reload.

1 Like

Did you ever find a solution to this? I get this issue in my project sometimes and its incredibly annoying as my scripting seemingly fail to compile without forcing constant saves. I have not been able to identify the issue. It’s clearly a dictionary attempting to define another dictionary as a key, but I can’t find anywhere where this is happening. Thanks.

It is likely this:

Note that IA's attempt to fix this based on my recommended solution crashed and burned: AB-BA deadlock.

My followup recommendation involves jython's import lock, which would almost certain fix it, but would almost certainly come with serious performance regressions for those whose programming practices include abuse of the import statement. :frowning:

I don't know where this stands within IA.

An alternate fix that use the common Jython import lock has already been in place in 8.3 for the entire public beta period. Nobody's complained yet :person_shrugging:

2 Likes

Fingers crossed. It would be good to backport at some point.

1 Like

Thank you for the information. Will try @pturmel’s fixes as 8.3 is not in the cards for us right now until a stable release has been set.

Be aware that my fix is not--cannot be--complete. As noted in that topic.

It is also vulnerable to uncaught errors between acquire and release. Be paranoid with initialization error handling.

1 Like