Skip to content

Commit 619bc15

Browse files
authored
Merge pull request RustPython#4004 from youknowone/marshal
redesign marshal
2 parents 5b1e92f + aa58cd2 commit 619bc15

File tree

4 files changed

+237
-232
lines changed

4 files changed

+237
-232
lines changed

Lib/test/test_marshal.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,10 @@ def test_floats(self):
9393
n *= 123.4567
9494

9595
class StringTestCase(unittest.TestCase, HelperMixin):
96-
# TODO: RUSTPYTHON
97-
@unittest.expectedFailure
9896
def test_unicode(self):
9997
for s in ["", "Andr\xe8 Previn", "abc", " "*10000]:
10098
self.helper(marshal.loads(marshal.dumps(s)))
10199

102-
# TODO: RUSTPYTHON
103-
@unittest.expectedFailure
104100
def test_string(self):
105101
for s in ["", "Andr\xe8 Previn", "abc", " "*10000]:
106102
self.helper(s)
@@ -159,13 +155,9 @@ class ContainerTestCase(unittest.TestCase, HelperMixin):
159155
'aunicode': "Andr\xe8 Previn"
160156
}
161157

162-
# TODO: RUSTPYTHON
163-
@unittest.expectedFailure
164158
def test_dict(self):
165159
self.helper(self.d)
166160

167-
# TODO: RUSTPYTHON
168-
@unittest.expectedFailure
169161
def test_list(self):
170162
self.helper(list(self.d.items()))
171163

@@ -178,8 +170,6 @@ def test_sets(self):
178170

179171

180172
class BufferTestCase(unittest.TestCase, HelperMixin):
181-
# TODO: RUSTPYTHON
182-
@unittest.expectedFailure
183173
def test_bytearray(self):
184174
b = bytearray(b"abc")
185175
self.helper(b)
@@ -298,8 +288,6 @@ def test_large_marshal(self):
298288
testString = 'abc' * size
299289
marshal.dumps(testString)
300290

301-
# TODO: RUSTPYTHON
302-
@unittest.expectedFailure
303291
def test_invalid_longs(self):
304292
# Issue #7019: marshal.loads shouldn't produce unnormalized PyLongs
305293
invalid_string = b'l\x02\x00\x00\x00\x00\x00\x00\x00'

vm/src/builtins/dict.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ impl PyDict {
7070
&self.entries
7171
}
7272

73-
pub(crate) fn from_entries(entries: DictContentType) -> Self {
74-
Self { entries }
75-
}
76-
7773
// Used in update and ior.
7874
fn merge_object(
7975
dict: &DictContentType,

vm/src/dictdatatype.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,6 @@ struct DictEntry<T> {
9999
}
100100
static_assertions::assert_eq_size!(DictEntry<PyObjectRef>, Option<DictEntry<PyObjectRef>>);
101101

102-
impl<T: Clone> DictEntry<T> {
103-
pub(crate) fn as_tuple(&self) -> (PyObjectRef, T) {
104-
(self.key.clone(), self.value.clone())
105-
}
106-
}
107-
108-
impl<T: Clone> Dict<T> {
109-
pub(crate) fn as_kvpairs(&self) -> Vec<(PyObjectRef, T)> {
110-
let entries = &self.inner.read().entries;
111-
entries
112-
.iter()
113-
.filter_map(|entry| entry.as_ref().map(|dict_entry| dict_entry.as_tuple()))
114-
.collect()
115-
}
116-
}
117-
118102
#[derive(Debug, PartialEq)]
119103
pub struct DictSize {
120104
indices_size: usize,

0 commit comments

Comments
 (0)