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

Add RawFD constructors as an alternative to fd #55028

Closed
wants to merge 4 commits into from

Conversation

LilithHafner
Copy link
Member

@LilithHafner LilithHafner commented Jul 4, 2024

This provides an alternative to fd for getting the raw file descriptor of a File or IOStream. This is important because fd returns an Int which is a poor choice of return type in the presence of Base.RawFD. I copped most of the docstring and implementation from fd.

This allows folks to write RawFD(::File) instead of RawFD(fd(::File)::Int), and eventually may enable us to deprecate fd.

See also: #51710

@ViralBShah ViralBShah added the docs This change adds or pertains to documentation label Jul 9, 2024
Copy link
Contributor

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Looks sensible to me. Would it make sense to backport this to 1.11 (then the docstring of course needs to be adjusted)

@fingolfin fingolfin added the merge me PR is reviewed. Merge when all tests are passing label Jul 31, 2024
@LilithHafner
Copy link
Member Author

fd no longer returns Int since #55080, making this less necessary, though still possibly a good idea.

@KristofferC
Copy link
Sponsor Member

error during bootstrap:
LoadError("sysimg.jl", 3, LoadError("Base.jl", 408, LoadError("libc.jl", 38, UndefVarError(:IOStream, Base.Libc))))
ijl_undefined_var_error at /cache/build/tester-amdci4-15/julialang/julia-master/src/rtutils.c:152
jl_eval_globalref at /cache/build/tester-amdci4-15/julialang/julia-master/src/interpreter.c:159 [inlined]
eval_value at /cache/build/tester-amdci4-15/julialang/julia-master/src/interpreter.c:202
eval_stmt_value at /cache/build/tester-amdci4-15/julialang/julia-master/src/interpreter.c:175 [inlined]

@DilumAluthge
Copy link
Member

Removing the "merge me" label because the CI failures seem like they may be related to the contents of the PR.

@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Aug 25, 2024
@LilithHafner
Copy link
Member Author

@whomever, feel free to re-open if you want to see this through. I'm going to close because I no longer think it's necessary.

@LilithHafner LilithHafner deleted the lh/RawFD-constructors branch August 25, 2024 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants