Skip to content

Commit 6b85947

Browse files
committed
Only create OSError subclass when two args are used
1 parent c2ef2a2 commit 6b85947

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Src/IronPython/Runtime/Exceptions/PythonExceptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public override string ToString() {
120120

121121
public partial class _OSError {
122122
public static new object __new__(PythonType cls, [ParamDictionary] IDictionary<string, object> kwArgs, params object[] args) {
123-
if (cls == OSError && args.Length >= 1 && args[0] is int errno) {
123+
if (cls == OSError && args.Length >= 2 && args[0] is int errno) {
124124
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
125125
if (args.Length >= 4 && args[3] is int winerror) {
126126
errno = WinErrorToErrno(winerror);
@@ -139,8 +139,8 @@ public object filename {
139139
set { _filename = value; }
140140
}
141141

142-
// TODO: hide property on Unix
143142
private object _winerror = Undefined;
143+
[PythonHidden(PlatformsAttribute.PlatformFamily.Unix)]
144144
public object winerror {
145145
get { return ReferenceEquals(_winerror, Undefined) ? null : _winerror; }
146146
set { _winerror = value; }

0 commit comments

Comments
 (0)