Skip to content

Commit 5922c5d

Browse files
authored
Fix issues after merge (#1823)
* Fix issues after merge * Disable test on Mono
1 parent 3245f33 commit 5922c5d

File tree

4 files changed

+59
-50
lines changed

4 files changed

+59
-50
lines changed

Src/IronPython.Modules/_operator.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace IronPython.Modules {
2323
public static class PythonOperator {
2424
public const string __doc__ = "Provides programmatic access to various operators (addition, accessing members, etc...)";
2525

26+
[PythonType]
2627
public sealed class attrgetter : ICodeFormattable {
2728
private readonly object[] _names;
2829

@@ -40,31 +41,32 @@ public attrgetter([NotNone] params object[] attrs) {
4041
public PythonTuple __reduce__() => PythonTuple.MakeTuple(DynamicHelpers.GetPythonType(this), PythonTuple.MakeTuple(_names));
4142

4243
[SpecialName]
43-
public object Call(CodeContext context, object param) {
44+
public object? Call(CodeContext context, object? param) {
4445
if (_names.Length == 1) {
4546
return GetOneAttr(context, param, _names[0]);
4647
}
4748

48-
object[] res = new object[_names.Length];
49+
object?[] res = new object[_names.Length];
4950
for (int i = 0; i < _names.Length; i++) {
5051
res[i] = GetOneAttr(context, param, _names[i]);
5152
}
5253
return PythonTuple.MakeTuple(res);
5354
}
5455

55-
private static object GetOneAttr(CodeContext context, object param, object val) {
56+
private static object? GetOneAttr(CodeContext context, object? param, object val) {
5657
if (val is not string s) {
5758
throw PythonOps.TypeError("attribute name must be string");
5859
}
5960
int dotPos = s.IndexOf('.');
6061
if (dotPos >= 0) {
61-
object nextParam = GetOneAttr(context, param, s.Substring(0, dotPos));
62+
object? nextParam = GetOneAttr(context, param, s.Substring(0, dotPos));
6263
return GetOneAttr(context, nextParam, s.Substring(dotPos + 1));
6364
}
6465
return PythonOps.GetBoundAttr(context, param, s);
6566
}
6667
}
6768

69+
[PythonType]
6870
public sealed class itemgetter : ICodeFormattable {
6971
private readonly object?[] _items;
7072

@@ -82,7 +84,7 @@ public itemgetter([NotNone] params object?[] items) {
8284
public PythonTuple __reduce__() => PythonTuple.MakeTuple(DynamicHelpers.GetPythonType(this), PythonTuple.MakeTuple(_items));
8385

8486
[SpecialName]
85-
public object Call(CodeContext/*!*/ context, object param) {
87+
public object? Call(CodeContext/*!*/ context, object? param) {
8688
if (_items.Length == 1) {
8789
return PythonOps.GetIndex(context, param, _items[0]);
8890
}

Src/IronPythonTest/Cases/CPythonCasesManifest.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,6 @@ Ignore=true
181181
Ignore=true
182182
Reason=ImportError: No module named audioop
183183

184-
[CPython.test_base64] # IronPython.test_base64_stdlib
185-
Ignore=true
186-
187184
[CPython.test_bdb] # new in 3.6
188185
Ignore=true
189186

Tests/test_base64_stdlib.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

Tests/test_io_stdlib.py

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,20 @@ def load_tests(loader, standard_tests, pattern):
2222
test.test_io.CIOTest('test_TextIOBase_destructor'), # AssertionError: Lists differ: [1, 2, 3, 2] != [1, 2, 3]
2323
test.test_io.CIOTest('test_destructor'), # AssertionError: Lists differ: [2, 3, 1, 2] != [1, 2, 3]
2424
test.test_io.CIOTest('test_flush_error_on_close'), # AssertionError: OSError not raised by close
25-
test.test_io.CIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
2625
test.test_io.CIOTest('test_invalid_operations'), # OSError: can't do nonzero cur-relative seeks
27-
test.test_io.CIOTest('test_open_handles_NUL_chars'), # ValueError: Illegal characters in path.
28-
test.test_io.PyIOTest('test_destructor'), # AssertionError: Lists differ: [2, 3, 1, 2] != [1, 2, 3]
29-
test.test_io.PyIOTest('test_flush_error_on_close'), # AssertionError: OSError not raised by close
30-
test.test_io.PyIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
31-
test.test_io.PyIOTest('test_open_handles_NUL_chars'), # ValueError: Illegal characters in path.
3226
test.test_io.CBufferedReaderTest('test_args_error'), # AssertionError: "BufferedReader" does not match "__init__() takes at most 2 arguments (4 given)"
3327
test.test_io.CBufferedReaderTest('test_buffering'), # TypeError: BufferedReader() takes at least 0 arguments (2 given)
3428
test.test_io.CBufferedReaderTest('test_close_error_on_close'), # AssertionError: None is not an instance of <class 'OSError'>
35-
test.test_io.CBufferedReaderTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
3629
test.test_io.CBufferedReaderTest('test_initialization'), # AssertionError: ValueError not raised by read
3730
test.test_io.CBufferedReaderTest('test_misbehaved_io_read'), # AssertionError: OSError not raised by read
3831
test.test_io.CBufferedReaderTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of <class 'NameError'>
39-
test.test_io.CBufferedReaderTest('test_override_destructor'), # AssertionError: Lists differ: [1, 2, 3, 2] != [1, 2, 3]
4032
test.test_io.CBufferedReaderTest('test_read_non_blocking'), # AssertionError: b'' is not None
4133
test.test_io.CBufferedReaderTest('test_read_on_closed'), # AssertionError: ValueError not raised by read1
4234
test.test_io.CBufferedReaderTest('test_readonly_attributes'), # AssertionError: AttributeError not raised
4335
test.test_io.CBufferedReaderTest('test_uninitialized'), # AssertionError: (<class 'ValueError'>, <class 'AttributeError'>) not raised by read
4436
test.test_io.PyBufferedReaderTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of <class 'NameError'>
4537
test.test_io.PyBufferedReaderTest('test_read_on_closed'), # AssertionError: ValueError not raised by read1
4638
test.test_io.CBufferedWriterTest('test_close_error_on_close'), # AssertionError: None is not an instance of <class 'OSError'>
47-
test.test_io.CBufferedWriterTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
4839
test.test_io.CBufferedWriterTest('test_initialization'), # AssertionError: ValueError not raised by write
4940
test.test_io.CBufferedWriterTest('test_max_buffer_size_removal'), # AssertionError: TypeError not raised
5041
test.test_io.CBufferedWriterTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of <class 'NameError'>
@@ -58,7 +49,6 @@ def load_tests(loader, standard_tests, pattern):
5849
test.test_io.CBufferedRWPairTest('test_uninitialized'), # TypeError: BufferedRWPair() takes at least 2 arguments (0 given)
5950
test.test_io.PyBufferedRWPairTest('test_reader_writer_close_error_on_close'), # AssertionError: None is not an instance of <class 'NameError'>
6051
test.test_io.CBufferedRandomTest('test_close_error_on_close'), # AssertionError: None is not an instance of <class 'OSError'>
61-
test.test_io.CBufferedRandomTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
6252
test.test_io.CBufferedRandomTest('test_max_buffer_size_removal'), # AssertionError: TypeError not raised
6353
test.test_io.CBufferedRandomTest('test_nonnormalized_close_error_on_close'), # AssertionError: None is not an instance of <class 'NameError'>
6454
test.test_io.CBufferedRandomTest('test_read_non_blocking'), # AssertionError: b'' is not None
@@ -74,7 +64,6 @@ def load_tests(loader, standard_tests, pattern):
7464
test.test_io.CTextIOWrapperTest('test_close_error_on_close'), # AssertionError: OSError not raised
7565
test.test_io.CTextIOWrapperTest('test_encoded_writes'), # UnicodeEncodeError
7666
test.test_io.CTextIOWrapperTest('test_flush_error_on_close'), # AssertionError: OSError not raised by close
77-
test.test_io.CTextIOWrapperTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
7867
test.test_io.CTextIOWrapperTest('test_initialization'), # AssertionError: ValueError not raised by read
7968
test.test_io.CTextIOWrapperTest('test_non_text_encoding_codecs_are_rejected'), # AssertionError: LookupError not raised
8069
test.test_io.CTextIOWrapperTest('test_nonnormalized_close_error_on_close'), # AssertionError: NameError not raised
@@ -93,25 +82,74 @@ def load_tests(loader, standard_tests, pattern):
9382
test.test_io.CMiscIOTest('test_readinto_buffer_overflow'), # IndexError: Index was outside the bounds of the array.
9483
test.test_io.CMiscIOTest('test_warn_on_dealloc'), # AssertionError: ResourceWarning not triggered
9584
test.test_io.CMiscIOTest('test_warn_on_dealloc_fd'), # AssertionError: ResourceWarning not triggered
96-
test.test_io.PyMiscIOTest('test_io_after_close'), # AttributeError: 'FileIO' object has no attribute 'read1'
9785
test.test_io.PyMiscIOTest('test_nonblock_pipe_write_bigbuf'), # AttributeError: 'module' object has no attribute 'fcntl'
9886
test.test_io.PyMiscIOTest('test_nonblock_pipe_write_smallbuf'), # AttributeError: 'module' object has no attribute 'fcntl'
99-
test.test_io.PyMiscIOTest('test_pickling'), # AssertionError: TypeError not raised by _dumps
10087
test.test_io.PyMiscIOTest('test_warn_on_dealloc'), # AssertionError: ResourceWarning not triggered
10188
test.test_io.PyMiscIOTest('test_warn_on_dealloc_fd'), # AssertionError: ResourceWarning not triggered
89+
90+
# BufferError: memoryview: invalid buffer exported from object of type EmptyStruct
91+
test.test_io.CIOTest('test_buffered_file_io'),
92+
test.test_io.CIOTest('test_raw_bytes_io'),
93+
test.test_io.CIOTest('test_raw_file_io'),
94+
test.test_io.PyIOTest('test_buffered_file_io'),
95+
test.test_io.PyIOTest('test_raw_bytes_io'),
96+
test.test_io.PyIOTest('test_raw_file_io'),
97+
test.test_io.CBufferedRWPairTest('test_readinto'),
98+
test.test_io.PyBufferedRWPairTest('test_readinto'),
99+
100+
# TODO: these are new in 3.6
101+
test.test_io.CIOTest('test_BufferedIOBase_readinto'),
102+
test.test_io.CIOTest('test_buffered_readinto_mixin'),
103+
test.test_io.CIOTest('test_next_nonsizeable'),
104+
test.test_io.CIOTest('test_optional_abilities'),
105+
test.test_io.PyIOTest('test_buffered_readinto_mixin'),
106+
test.test_io.PyIOTest('test_optional_abilities'),
107+
test.test_io.APIMismatchTest('test_RawIOBase_io_in_pyio_match'),
108+
test.test_io.APIMismatchTest('test_RawIOBase_pyio_in_io_match'),
109+
test.test_io.CBufferedReaderTest('test_readinto1'),
110+
test.test_io.CBufferedReaderTest('test_readinto1_array'),
111+
test.test_io.CBufferedReaderTest('test_readinto_array'),
112+
test.test_io.CBufferedRandomTest('test_readinto1'),
113+
test.test_io.CBufferedRandomTest('test_readinto1_array'),
114+
test.test_io.CBufferedRandomTest('test_readinto_array'),
115+
test.test_io.CTextIOWrapperTest('test_illegal_encoder'),
116+
test.test_io.CTextIOWrapperTest('test_issue25862'),
117+
test.test_io.CTextIOWrapperTest('test_read_byteslike'),
118+
test.test_io.PyTextIOWrapperTest('test_illegal_encoder'),
119+
test.test_io.PyTextIOWrapperTest('test_read_byteslike'),
102120
]
103121

104122
if is_mono:
105123
failing_tests += [
106-
test.test_io.CBufferedRandomTest('test_destructor'), # IndexError: index out of range: 0
124+
test.test_io.PyMiscIOTest('test_create_fail'),
107125
]
108126

109127
skip_tests = [
128+
test.test_io.CBufferedReaderTest('test_override_destructor'), # StackOverflowException
110129
test.test_io.CBufferedWriterTest('test_override_destructor'), # StackOverflowException
111130
test.test_io.CBufferedRandomTest('test_override_destructor'), # StackOverflowException
112131
test.test_io.CTextIOWrapperTest('test_bufio_write_through'), # StackOverflowException
113132
test.test_io.CTextIOWrapperTest('test_override_destructor'), # StackOverflowException
114133

134+
# failure prevents files from closing
135+
test.test_io.CIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
136+
test.test_io.PyIOTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
137+
test.test_io.CBufferedReaderTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
138+
test.test_io.CBufferedWriterTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
139+
test.test_io.CBufferedRandomTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
140+
test.test_io.CTextIOWrapperTest('test_garbage_collection'), # AssertionError: filter ('', ResourceWarning) did not catch any warning
141+
test.test_io.PyIOTest('test_destructor'), # AssertionError: Lists differ: [2, 3, 1, 2] != [1, 2, 3]
142+
143+
# StackOverflowException
144+
test.test_io.CBufferedReaderTest('test_recursive_repr'),
145+
test.test_io.PyBufferedReaderTest('test_recursive_repr'),
146+
test.test_io.CBufferedWriterTest('test_recursive_repr'),
147+
test.test_io.PyBufferedWriterTest('test_recursive_repr'),
148+
test.test_io.CBufferedRandomTest('test_recursive_repr'),
149+
test.test_io.PyBufferedRandomTest('test_recursive_repr'),
150+
test.test_io.CTextIOWrapperTest('test_recursive_repr'),
151+
test.test_io.PyTextIOWrapperTest('test_recursive_repr'),
152+
115153
# __del__ not getting called on shutdown?
116154
test.test_io.CTextIOWrapperTest('test_create_at_shutdown_with_encoding'),
117155
test.test_io.CTextIOWrapperTest('test_create_at_shutdown_without_encoding'),

0 commit comments

Comments
 (0)