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

Skip to content

[FEA]: make == work for resource handles in cuda.bindings. #991

@lowsfer

Description

@lowsfer

Is this a duplicate?

Area

cuda.bindings

Is your feature request related to a problem? Please describe.

In cuda.bindings, seems nothing have __eq__ implemented, so == falls back to 'is'. If a user use something like 'cuda.bindings.runtime.cudaFree(0) == cuda.bindings.runtime.cudaError_t.cudaSuccess', he/she will always get False because of the comparison. While converting them to int before comparison works, it's very counter-intuitive.

Besides error code, other objects suffers from the same problem. For instance, if we call cuCtxGetCurrent() twice, we will get two different objects, and == will give False, even if the underlying C handle is the same.

Describe the solution you'd like

We need __eq__ for all resource handle objects.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-responseFurther information is requestedtriageNeeds the team's attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions