Skip to content

Commit 58b3bda

Browse files
authored
Add ParamDictionary argument to nt.access (#966)
1 parent 4cfbe5f commit 58b3bda

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Src/IronPython.Modules/nt.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,24 @@ public static void abort() {
8888
/// F_OK: Check to see if the file exists
8989
/// R_OK | W_OK | X_OK: Check for the specific permissions. Only W_OK is respected.
9090
/// </summary>
91-
public static bool access(CodeContext/*!*/ context, string path, int mode) {
91+
public static bool access(CodeContext/*!*/ context, [NotNull] string path, int mode, [ParamDictionary, NotNull] IDictionary<string, object> dict) {
9292
if (path == null) throw PythonOps.TypeError("expected string, got None");
9393

94+
foreach (var pair in dict) {
95+
switch (pair.Key) {
96+
case "dir_fd":
97+
case "follow_symlinks":
98+
// TODO: implement these!
99+
break;
100+
case "effective_ids":
101+
if (PythonOps.IsTrue(pair.Value))
102+
throw PythonOps.NotImplementedError("access: effective_ids unavailable on this platform");
103+
break;
104+
default:
105+
throw PythonOps.TypeError("'{0}' is an invalid keyword argument for this function", pair.Key);
106+
}
107+
}
108+
94109
#if FEATURE_FILESYSTEM
95110
try {
96111
FileAttributes fa = File.GetAttributes(path);

Src/IronPythonTest/Cases/CPythonCasesManifest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ Ignore=true
11651165
Ignore=true
11661166

11671167
[CPython.unittest.test_assertions]
1168-
Ignore=true
1168+
Ignore=true # blocked by https://github.com/IronLanguages/ironpython3/issues/11
11691169

11701170
[CPython.unittest.test_break]
11711171
Ignore=true

0 commit comments

Comments
 (0)