IronLanguages / ironpython3

Implementation of Python 3.x for .NET Framework that is built on top of the Dynamic Language Runtime.
Apache License 2.0
2.48k stars 287 forks source link

Improve handling of NUL file on Windows #1712

Closed BCSharp closed 1 year ago

BCSharp commented 1 year ago

NUL file is now stat-able. The special handling of /dev/null is removed since this system file is supported by the OS and can be treated like any other file.

BCSharp commented 1 year ago

StatStream is kind of an odd pattern (or I'm just not used to seeing it in C#) but it's private so I guess it's fine.

With a public API I would have been more careful (I hope) and probably opted for something like bool TryStatStream(Stream stream, [NotNullWhen(true)] out stat_result? res) but with local functions the habit is to write as few lines of code as possible 😃