Skip to content

Commit

Permalink
Get some tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier committed Dec 27, 2024
1 parent 3c46528 commit cdd8997
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 35 deletions.
8 changes: 6 additions & 2 deletions Src/IronPython/Runtime/DictionaryOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ public static object setdefault(PythonDictionary self, object key, object defaul

public static void update(CodeContext/*!*/ context, PythonDictionary/*!*/ self, object other) {
if (other is PythonDictionary pyDict) {
pyDict._storage.CopyTo(ref self._storage);
if (pyDict.TreatAsMapping) {
SlowUpdate(context, self, other);
} else {
pyDict._storage.CopyTo(ref self._storage);
}
} else {
SlowUpdate(context, self, other);
}
Expand All @@ -129,7 +133,7 @@ public static void update(CodeContext/*!*/ context, PythonDictionary/*!*/ self,
private static void SlowUpdate(CodeContext/*!*/ context, PythonDictionary/*!*/ self, object other) {
if (other is MappingProxy proxy) {
update(context, self, proxy.GetDictionary(context));
} else if (other is IDictionary dict) {
} else if (other is IDictionary dict && other is not PythonDictionary) {
IDictionaryEnumerator e = dict.GetEnumerator();
while (e.MoveNext()) {
self._storage.Add(ref self._storage, e.Key, e.Value);
Expand Down
2 changes: 2 additions & 0 deletions Src/IronPython/Runtime/Operations/PythonOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2614,6 +2614,8 @@ public static PythonDictionary UserMappingToPythonDictionary(CodeContext/*!*/ co
}

public static PythonDictionary CopyAndVerifyPythonDictionary(PythonFunction function, PythonDictionary dict) {
if (dict.TreatAsMapping) return CopyAndVerifyUserMapping(function, dict);

if (dict._storage.HasNonStringAttributes()) {
throw TypeError("{0}() keywords must be strings", function.__name__);
}
Expand Down
5 changes: 5 additions & 0 deletions Src/IronPython/Runtime/PythonDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,11 @@ internal bool TryRemoveValue(object key, out object value) {
return _storage.TryRemoveValue(ref _storage, key, out value);
}

/// <summary>
/// If __iter__ is overridden then we should treat the dict as a mapping.
/// </summary>
internal bool TreatAsMapping => GetType() != typeof(PythonDictionary) && ((Func<object>)__iter__).Method.DeclaringType != typeof(PythonDictionary);

#region Debugger View

internal class DebugProxy {
Expand Down
3 changes: 0 additions & 3 deletions Src/IronPythonTest/Cases/CPythonCasesManifest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ Ignore=true
RunCondition=$(IS_DEBUG) # https://github.com/IronLanguages/ironpython3/issues/1067
Timeout=600000 # 10 minute timeout

[CPython.test_call] # IronPython.test_call_stdlib
Ignore=true

[CPython.test_capi]
Ignore=true
Reason=ImportError: No module named _testcapi
Expand Down
28 changes: 0 additions & 28 deletions Tests/test_call_stdlib.py

This file was deleted.

2 changes: 0 additions & 2 deletions Tests/test_functools_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ def load_tests(loader, standard_tests, pattern):
]

skip_tests = [
test.test_functools.TestLRUC('test_kwargs_order'), # intermittent failures - https://github.com/IronLanguages/ironpython3/issues/1460
test.test_functools.TestLRUC('test_lru_cache_threaded2'), # intermittent failures
test.test_functools.TestLRUC('test_lru_cache_threaded3'), # intermittent failures
test.test_functools.TestLRUPy('test_kwargs_order'), # intermittent failures - https://github.com/IronLanguages/ironpython3/issues/1460
test.test_functools.TestLRUPy('test_lru_cache_threaded2'), # intermittent failures
test.test_functools.TestLRUPy('test_lru_cache_threaded3'), # intermittent failures
test.test_functools.TestPartialC('test_recursive_pickle'), # StackOverflowException
Expand Down

0 comments on commit cdd8997

Please sign in to comment.