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

specialize cconvert instead of unsafe_convert #51

Merged
merged 1 commit into from
May 2, 2024
Merged

specialize cconvert instead of unsafe_convert #51

merged 1 commit into from
May 2, 2024

Conversation

nsajko
Copy link
Collaborator

@nsajko nsajko commented May 1, 2024

JuliaLang/julia#51962 (comment)

It is generally best to implement cconvert (since it is not unsafe),
and generally required to call both functions as well (mimicking the
behavior defined for ccall)

JuliaLang/julia#51962 (comment)

> It is generally best to implement cconvert (since it is not unsafe),
> and generally required to call both functions as well (mimicking the
> behavior defined for ccall)
Copy link

codecov bot commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.26%. Comparing base (c102065) to head (5ea2a1c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #51   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files           1        1           
  Lines         173      173           
=======================================
  Hits          170      170           
  Misses          3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@giordano giordano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the interface documentation says to implement unsafe_convert, no? Maybe that should be fixed?

src/FixedSizeArrays.jl Show resolved Hide resolved
@nsajko
Copy link
Collaborator Author

nsajko commented May 1, 2024

But the interface documentation says to implement unsafe_convert, no? Maybe that should be fixed?

Posted a comment at the Julia issue linked above.

Copy link
Collaborator

@giordano giordano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, yes, now I start to remember the discussion: MakieOrg/Makie.jl#3661 (comment). The unsafe_convert method is indeed "wrong", but the interface documentation doesn't match that. Also, I see cconvert is allowed not to return an object of type equal to the first argument: https://docs.julialang.org/en/v1/base/c/#Base.cconvert

@nsajko nsajko merged commit e1c3b34 into JuliaArrays:main May 2, 2024
8 checks passed
@nsajko nsajko deleted the cconvert branch May 2, 2024 00:04
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.

2 participants