Skip to content

Commit 5971fc3

Browse files
rename PyObjectPayload2 to PyValue
1 parent e2e13af commit 5971fc3

28 files changed

+70
-76
lines changed

vm/src/frame.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ use crate::obj::objslice::PySlice;
2222
use crate::obj::objstr;
2323
use crate::obj::objtype;
2424
use crate::pyobject::{
25-
DictProtocol, IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef,
26-
PyResult, TryFromObject, TypeProtocol,
25+
DictProtocol, IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue,
26+
TryFromObject, TypeProtocol,
2727
};
2828
use crate::vm::VirtualMachine;
2929

@@ -181,7 +181,7 @@ pub struct Frame {
181181
pub lasti: RefCell<usize>, // index of last instruction ran
182182
}
183183

184-
impl PyObjectPayload2 for Frame {
184+
impl PyValue for Frame {
185185
fn required_type(ctx: &PyContext) -> PyObjectRef {
186186
ctx.frame_type()
187187
}

vm/src/obj/objbuiltinfunc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use std::fmt;
22

3-
use crate::pyobject::{PyContext, PyNativeFunc, PyObjectPayload2, PyObjectRef};
3+
use crate::pyobject::{PyContext, PyNativeFunc, PyObjectRef, PyValue};
44

55
pub struct PyBuiltinFunction {
66
// TODO: shouldn't be public
77
pub value: PyNativeFunc,
88
}
99

10-
impl PyObjectPayload2 for PyBuiltinFunction {
10+
impl PyValue for PyBuiltinFunction {
1111
fn required_type(ctx: &PyContext) -> PyObjectRef {
1212
ctx.builtin_function_or_method_type()
1313
}

vm/src/obj/objbytearray.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::fmt::Write;
55
use std::ops::{Deref, DerefMut};
66

77
use crate::pyobject::{
8-
PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
8+
PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
99
};
1010

1111
use super::objint;
@@ -28,7 +28,7 @@ impl PyByteArray {
2828
}
2929
}
3030

31-
impl PyObjectPayload2 for PyByteArray {
31+
impl PyValue for PyByteArray {
3232
fn required_type(ctx: &PyContext) -> PyObjectRef {
3333
ctx.bytearray_type()
3434
}

vm/src/obj/objbytes.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use std::ops::Deref;
55
use super::objint;
66
use super::objtype;
77
use crate::pyobject::{
8-
PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectPayload2, PyObjectRef, PyResult,
9-
TypeProtocol,
8+
PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
109
};
1110
use crate::vm::VirtualMachine;
1211
use num_traits::ToPrimitive;
@@ -30,7 +29,7 @@ impl Deref for PyBytes {
3029
}
3130
}
3231

33-
impl PyObjectPayload2 for PyBytes {
32+
impl PyValue for PyBytes {
3433
fn required_type(ctx: &PyContext) -> PyObjectRef {
3534
ctx.bytes_type()
3635
}

vm/src/obj/objcode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use crate::bytecode;
66
use crate::pyobject::{
7-
IdProtocol, PyContext, PyFuncArgs, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
7+
IdProtocol, PyContext, PyFuncArgs, PyObjectRef, PyResult, PyValue, TypeProtocol,
88
};
99
use crate::vm::VirtualMachine;
1010
use std::fmt;
@@ -25,7 +25,7 @@ impl fmt::Debug for PyCode {
2525
}
2626
}
2727

28-
impl PyObjectPayload2 for PyCode {
28+
impl PyValue for PyCode {
2929
fn required_type(ctx: &PyContext) -> PyObjectRef {
3030
ctx.code_type()
3131
}

vm/src/obj/objcomplex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::objfloat;
22
use super::objint;
33
use super::objtype;
44
use crate::pyobject::{
5-
PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
5+
PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
66
};
77
use crate::vm::VirtualMachine;
88
use num_complex::Complex64;
@@ -13,7 +13,7 @@ pub struct PyComplex {
1313
value: Complex64,
1414
}
1515

16-
impl PyObjectPayload2 for PyComplex {
16+
impl PyValue for PyComplex {
1717
fn required_type(ctx: &PyContext) -> PyObjectRef {
1818
ctx.complex_type()
1919
}

vm/src/obj/objdict.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::collections::HashMap;
33
use std::ops::{Deref, DerefMut};
44

55
use crate::pyobject::{
6-
PyAttributes, PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectPayload2, PyObjectRef,
7-
PyRef, PyResult, TypeProtocol,
6+
PyAttributes, PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectRef, PyRef, PyResult,
7+
PyValue, TypeProtocol,
88
};
99
use crate::vm::{ReprGuard, VirtualMachine};
1010

@@ -21,7 +21,7 @@ pub struct PyDict {
2121
}
2222
pub type PyDictRef = PyRef<PyDict>;
2323

24-
impl PyObjectPayload2 for PyDict {
24+
impl PyValue for PyDict {
2525
fn required_type(ctx: &PyContext) -> PyObjectRef {
2626
ctx.dict_type()
2727
}

vm/src/obj/objenumerate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::ops::AddAssign;
44
use super::objint;
55
use super::objiter;
66
use crate::pyobject::{
7-
PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
7+
PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
88
};
99
use crate::vm::VirtualMachine;
1010
use num_bigint::BigInt;
@@ -16,7 +16,7 @@ pub struct PyEnumerate {
1616
iterator: PyObjectRef,
1717
}
1818

19-
impl PyObjectPayload2 for PyEnumerate {
19+
impl PyValue for PyEnumerate {
2020
fn required_type(ctx: &PyContext) -> PyObjectRef {
2121
ctx.enumerate_type()
2222
}

vm/src/obj/objfilter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::pyobject::{
2-
IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef, PyResult,
3-
TypeProtocol,
2+
IdProtocol, PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
43
};
54
use crate::vm::VirtualMachine; // Required for arg_check! to use isinstance
65

@@ -13,7 +12,7 @@ pub struct PyFilter {
1312
iterator: PyObjectRef,
1413
}
1514

16-
impl PyObjectPayload2 for PyFilter {
15+
impl PyValue for PyFilter {
1716
fn required_type(ctx: &PyContext) -> PyObjectRef {
1817
ctx.filter_type()
1918
}

vm/src/obj/objfloat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::objint;
33
use super::objstr;
44
use super::objtype;
55
use crate::pyobject::{
6-
IntoPyObject, PyContext, PyObject, PyObjectPayload2, PyObjectRef, PyRef, PyResult, TypeProtocol,
6+
IntoPyObject, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
77
};
88
use crate::vm::VirtualMachine;
99
use num_bigint::ToBigInt;
@@ -15,7 +15,7 @@ pub struct PyFloat {
1515
value: f64,
1616
}
1717

18-
impl PyObjectPayload2 for PyFloat {
18+
impl PyValue for PyFloat {
1919
fn required_type(ctx: &PyContext) -> PyObjectRef {
2020
ctx.float_type()
2121
}

vm/src/obj/objfunction.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::frame::Scope;
22
use crate::pyobject::{
3-
AttributeProtocol, IdProtocol, PyContext, PyFuncArgs, PyObjectPayload2, PyObjectRef, PyResult,
3+
AttributeProtocol, IdProtocol, PyContext, PyFuncArgs, PyObjectRef, PyResult, PyValue,
44
TypeProtocol,
55
};
66
use crate::vm::VirtualMachine;
@@ -23,7 +23,7 @@ impl PyFunction {
2323
}
2424
}
2525

26-
impl PyObjectPayload2 for PyFunction {
26+
impl PyValue for PyFunction {
2727
fn required_type(ctx: &PyContext) -> PyObjectRef {
2828
ctx.function_type()
2929
}
@@ -42,7 +42,7 @@ impl PyMethod {
4242
}
4343
}
4444

45-
impl PyObjectPayload2 for PyMethod {
45+
impl PyValue for PyMethod {
4646
fn required_type(ctx: &PyContext) -> PyObjectRef {
4747
ctx.bound_method_type()
4848
}

vm/src/obj/objgenerator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use crate::frame::{ExecutionResult, Frame};
66
use crate::pyobject::{
7-
PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
7+
PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
88
};
99
use crate::vm::VirtualMachine;
1010

@@ -13,7 +13,7 @@ pub struct PyGenerator {
1313
frame: PyObjectRef,
1414
}
1515

16-
impl PyObjectPayload2 for PyGenerator {
16+
impl PyValue for PyGenerator {
1717
fn required_type(ctx: &PyContext) -> PyObjectRef {
1818
ctx.generator_type()
1919
}

vm/src/obj/objint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use num_traits::{Pow, Signed, ToPrimitive, Zero};
66

77
use crate::format::FormatSpec;
88
use crate::pyobject::{
9-
FromPyObjectRef, IntoPyObject, PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef,
10-
PyRef, PyResult, TryFromObject, TypeProtocol,
9+
FromPyObjectRef, IntoPyObject, PyContext, PyFuncArgs, PyObject, PyObjectRef, PyRef, PyResult,
10+
PyValue, TryFromObject, TypeProtocol,
1111
};
1212
use crate::vm::VirtualMachine;
1313

@@ -31,7 +31,7 @@ impl PyInt {
3131
}
3232
}
3333

34-
impl PyObjectPayload2 for PyInt {
34+
impl PyValue for PyInt {
3535
fn required_type(ctx: &PyContext) -> PyObjectRef {
3636
ctx.int_type()
3737
}

vm/src/obj/objlist.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use super::objsequence::{
99
use super::objstr;
1010
use super::objtype;
1111
use crate::pyobject::{
12-
IdProtocol, OptionalArg, PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectPayload2,
13-
PyObjectRef, PyRef, PyResult, TypeProtocol,
12+
IdProtocol, OptionalArg, PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectRef, PyRef,
13+
PyResult, PyValue, TypeProtocol,
1414
};
1515
use crate::vm::{ReprGuard, VirtualMachine};
1616
use num_traits::ToPrimitive;
@@ -29,7 +29,7 @@ impl From<Vec<PyObjectRef>> for PyList {
2929
}
3030
}
3131

32-
impl PyObjectPayload2 for PyList {
32+
impl PyValue for PyList {
3333
fn required_type(ctx: &PyContext) -> PyObjectRef {
3434
ctx.list_type()
3535
}

vm/src/obj/objmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::pyobject::{
2-
PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
2+
PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
33
};
44
use crate::vm::VirtualMachine;
55

@@ -11,7 +11,7 @@ pub struct PyMap {
1111
iterators: Vec<PyObjectRef>,
1212
}
1313

14-
impl PyObjectPayload2 for PyMap {
14+
impl PyValue for PyMap {
1515
fn required_type(ctx: &PyContext) -> PyObjectRef {
1616
ctx.map_type()
1717
}

vm/src/obj/objmemory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::pyobject::{
2-
PyContext, PyFuncArgs, PyObject, PyObjectPayload2, PyObjectRef, PyResult, TypeProtocol,
2+
PyContext, PyFuncArgs, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
33
};
44
use crate::vm::VirtualMachine;
55

@@ -8,7 +8,7 @@ pub struct PyMemoryView {
88
obj: PyObjectRef,
99
}
1010

11-
impl PyObjectPayload2 for PyMemoryView {
11+
impl PyValue for PyMemoryView {
1212
fn required_type(ctx: &PyContext) -> PyObjectRef {
1313
ctx.memoryview_type()
1414
}

vm/src/obj/objmodule.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::pyobject::{DictProtocol, PyContext, PyObjectPayload2, PyObjectRef, PyRef, PyResult};
1+
use crate::pyobject::{DictProtocol, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
22
use crate::vm::VirtualMachine;
33

44
#[derive(Clone, Debug)]
@@ -8,7 +8,7 @@ pub struct PyModule {
88
}
99
pub type PyModuleRef = PyRef<PyModule>;
1010

11-
impl PyObjectPayload2 for PyModule {
11+
impl PyValue for PyModule {
1212
fn required_type(ctx: &PyContext) -> PyObjectRef {
1313
ctx.module_type()
1414
}

vm/src/obj/objnone.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
use crate::pyobject::{
2-
IntoPyObject, PyContext, PyFuncArgs, PyObjectPayload2, PyObjectRef, PyRef, PyResult,
3-
TypeProtocol,
2+
IntoPyObject, PyContext, PyFuncArgs, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol,
43
};
54
use crate::vm::VirtualMachine;
65

76
#[derive(Clone, Debug)]
87
pub struct PyNone;
98
pub type PyNoneRef = PyRef<PyNone>;
109

11-
impl PyObjectPayload2 for PyNone {
10+
impl PyValue for PyNone {
1211
fn required_type(ctx: &PyContext) -> PyObjectRef {
1312
ctx.none().typ()
1413
}

vm/src/obj/objproperty.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use std::marker::PhantomData;
77
use crate::obj::objstr::PyStringRef;
88
use crate::obj::objtype::PyClassRef;
99
use crate::pyobject::{
10-
IntoPyNativeFunc, OptionalArg, PyContext, PyObject, PyObjectPayload2, PyObjectRef, PyRef,
11-
PyResult,
10+
IntoPyNativeFunc, OptionalArg, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue,
1211
};
1312
use crate::VirtualMachine;
1413

@@ -18,7 +17,7 @@ pub struct PyReadOnlyProperty {
1817
getter: PyObjectRef,
1918
}
2019

21-
impl PyObjectPayload2 for PyReadOnlyProperty {
20+
impl PyValue for PyReadOnlyProperty {
2221
fn required_type(ctx: &PyContext) -> PyObjectRef {
2322
ctx.readonly_property_type()
2423
}
@@ -40,7 +39,7 @@ pub struct PyProperty {
4039
deleter: Option<PyObjectRef>,
4140
}
4241

43-
impl PyObjectPayload2 for PyProperty {
42+
impl PyValue for PyProperty {
4443
fn required_type(ctx: &PyContext) -> PyObjectRef {
4544
ctx.property_type()
4645
}

vm/src/obj/objrange.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use num_integer::Integer;
66
use num_traits::{One, Signed, ToPrimitive, Zero};
77

88
use crate::pyobject::{
9-
PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectPayload2, PyObjectRef, PyResult,
10-
TypeProtocol,
9+
PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
1110
};
1211
use crate::vm::VirtualMachine;
1312

@@ -24,7 +23,7 @@ pub struct PyRange {
2423
pub step: BigInt,
2524
}
2625

27-
impl PyObjectPayload2 for PyRange {
26+
impl PyValue for PyRange {
2827
fn required_type(ctx: &PyContext) -> PyObjectRef {
2928
ctx.range_type()
3029
}

vm/src/obj/objset.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use super::objiter;
1313
use super::objstr;
1414
use super::objtype;
1515
use crate::pyobject::{
16-
PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectPayload2, PyObjectRef, PyResult,
17-
TypeProtocol,
16+
PyContext, PyFuncArgs, PyIteratorValue, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol,
1817
};
1918
use crate::vm::{ReprGuard, VirtualMachine};
2019

@@ -23,7 +22,7 @@ pub struct PySet {
2322
elements: RefCell<HashMap<u64, PyObjectRef>>,
2423
}
2524

26-
impl PyObjectPayload2 for PySet {
25+
impl PyValue for PySet {
2726
fn required_type(ctx: &PyContext) -> PyObjectRef {
2827
ctx.set_type()
2928
}

0 commit comments

Comments
 (0)