Skip to content

fix: unhashable type c_ubyte in Systec exception mapping#2078

Open
fazalpsinfo-cmyk wants to merge 1 commit into
hardbyte:mainfrom
fazalpsinfo-cmyk:fix/unhashable-type-systec-exception
Open

fix: unhashable type c_ubyte in Systec exception mapping#2078
fazalpsinfo-cmyk wants to merge 1 commit into
hardbyte:mainfrom
fazalpsinfo-cmyk:fix/unhashable-type-systec-exception

Conversation

@fazalpsinfo-cmyk

Copy link
Copy Markdown

Fix

The result parameter in UcanException.__init__ can be a ctypes.c_ubyte object (from UcanWriteCanMsgEx via check_result), which is unhashable and cannot be used as a dict key, causing:

TypeError: unhashable type

This swallows the actual error message and prevents troubleshooting.

Change

Use result.value to get the underlying integer value, which is hashable and matches the ReturnCode IntEnum keys in the error message mapping.

Fixes #2077


Support my open source work: https://buymeacoffee.com/muhamedfazalps

The result parameter in UcanException.__init__ can be a ctypes.c_ubyte
object (from UcanWriteCanMsgEx), which is unhashable and cannot be used
as a dict key. Use result.value to get the underlying int instead.

Fixes hardbyte#2077
@mergify

mergify Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

Unhashable type for Systec interface errors

1 participant