Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Provided value of bytes pass through encode_raw() #439

Closed
@sveinse

Description

@sveinse

objectdictionary.__init__.ODVariable.encode_raw() converts native datatypes to bytes.

https://github.com/christiansandberg/canopen/blob/54ebbd45a8084f664c21be270fae0f7a1a658355/canopen/objectdictionary/__init__.py#L403-L404

What is the use-case for this logic? It means that when a value of bytes is passed, it will bypass the encoding and use the user provided bytes value rather than raising TypeError. Do you remember the intention @christiansandberg?

I'm currently working on adding the missing datatypes, and I encountered this code and is curious of its use case. The unittests pass if this is commented out, so we don't have a test case for it either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions