diff --git a/Src/IronPython/Modules/_io.cs b/Src/IronPython/Modules/_io.cs index dd61cd3a1..73396b67d 100644 --- a/Src/IronPython/Modules/_io.cs +++ b/Src/IronPython/Modules/_io.cs @@ -55,16 +55,13 @@ public static partial class PythonIOModule { private static int O_EXCL => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 0x400 : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? 0x800 : 0x80; - [PythonHidden(PlatformsAttribute.PlatformFamily.Windows)] [SupportedOSPlatform("linux")] [SupportedOSPlatform("macos")] private static int O_CLOEXEC => RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? 0x1000000 : 0x80000; - [PythonHidden(PlatformsAttribute.PlatformFamily.Unix)] [SupportedOSPlatform("windows")] private static int O_BINARY => 0x8000; - [PythonHidden(PlatformsAttribute.PlatformFamily.Unix)] [SupportedOSPlatform("windows")] private static int O_NOINHERIT => 0x80; diff --git a/Src/Scripts/generate_os_codes.py b/Src/Scripts/generate_os_codes.py index fdc9ccfa7..57719d5ee 100644 --- a/Src/Scripts/generate_os_codes.py +++ b/Src/Scripts/generate_os_codes.py @@ -199,7 +199,7 @@ def generate_O_flags(cw, flagvalues, access): if codes[darwin_idx] is None: hidden_on += ["PlatformID.MacOSX"] supported_on.discard(systems[darwin_idx]) - if hidden_on: + if hidden_on and (access == 'public' or access == 'protected' or access == 'protected internal'): cw.write(f"[PythonHidden({', '.join(hidden_on)})]") if len(supported_on) != len(systems): for s in sorted(supported_on): diff --git a/Tests/test_file.py b/Tests/test_file.py index 001210715..1fb7fa3d9 100644 --- a/Tests/test_file.py +++ b/Tests/test_file.py @@ -2,6 +2,7 @@ # The .NET Foundation licenses this file to you under the Apache 2.0 License. # See the LICENSE file in the project root for more information. +import errno import os import sys import unittest @@ -9,7 +10,7 @@ CP16623_LOCK = _thread.allocate_lock() -from iptest import IronPythonTestCase, is_cli, is_cpython, is_netcoreapp, is_posix, is_linux, is_osx, is_windows, run_test, skipUnlessIronPython +from iptest import IronPythonTestCase, is_cli, is_cpython, is_netcoreapp, is_posix, is_windows, run_test, skipUnlessIronPython class FileTest(IronPythonTestCase): @@ -701,7 +702,7 @@ def test_errors(self): with self.assertRaises(OSError) as cm: open('path_too_long' * 100) - self.assertEqual(cm.exception.errno, (63 if is_osx else 36 if is_linux else 22) if is_netcoreapp and not is_posix or sys.version_info >= (3,6) else 2) + self.assertEqual(cm.exception.errno, (errno.ENAMETOOLONG if is_posix else errno.EINVAL) if is_netcoreapp and not is_posix or sys.version_info >= (3,6) else errno.ENOENT) def test_write_bytes(self): fname = self.temp_file