Skip to content

Commit 66b6a06

Browse files
committed
PyValue -> PyPayload
1 parent 71acc6c commit 66b6a06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+305
-303
lines changed

derive/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ mod doc;
1717
mod from_args;
1818
mod pyclass;
1919
mod pymodule;
20+
mod pypayload;
2021
mod pystructseq;
21-
mod pyvalue;
2222

2323
use error::{extract_spans, Diagnostic};
2424
use proc_macro2::TokenStream;
@@ -120,8 +120,8 @@ pub fn py_freeze(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
120120
result_to_tokens(compile_bytecode::impl_py_freeze(input.into()))
121121
}
122122

123-
#[proc_macro_derive(PyValue)]
124-
pub fn pyvalue(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
123+
#[proc_macro_derive(PyPayload)]
124+
pub fn pypayload(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
125125
let input = parse_macro_input!(input as DeriveInput);
126-
result_to_tokens(pyvalue::impl_pyvalue(input))
126+
result_to_tokens(pypayload::impl_pypayload(input))
127127
}

derive/src/pyclass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ pub(crate) fn impl_define_exception(exc_def: PyExceptionDef) -> Result<TokenStre
364364
pub struct #class_name {}
365365

366366
// We need this to make extend mechanism work:
367-
impl ::rustpython_vm::PyValue for #class_name {
367+
impl ::rustpython_vm::PyPayload for #class_name {
368368
fn class(vm: &::rustpython_vm::VirtualMachine) -> &::rustpython_vm::builtins::PyTypeRef {
369369
&vm.ctx.exceptions.#ctx_name
370370
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use proc_macro2::TokenStream;
22
use quote::quote;
33
use syn::{DeriveInput, Result};
44

5-
pub(crate) fn impl_pyvalue(input: DeriveInput) -> Result<TokenStream> {
5+
pub(crate) fn impl_pypayload(input: DeriveInput) -> Result<TokenStream> {
66
let ty = &input.ident;
77

88
let ret = quote! {
9-
impl ::rustpython_vm::PyValue for #ty {
9+
impl ::rustpython_vm::PyPayload for #ty {
1010
fn class(_vm: &::rustpython_vm::VirtualMachine) -> &rustpython_vm::builtins::PyTypeRef {
1111
<Self as ::rustpython_vm::pyclass::StaticType>::static_type()
1212
}

stdlib/src/array.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ mod array {
3131
AsBuffer, AsMapping, Comparable, Constructor, IterNext, IterNextIterable, Iterable,
3232
PyComparisonOp,
3333
},
34-
AsObject, PyObject, PyObjectRef, PyObjectView, PyRef, PyResult, PyValue,
34+
AsObject, PyObject, PyObjectRef, PyObjectView, PyPayload, PyRef, PyResult,
3535
VirtualMachine,
3636
},
3737
};
@@ -583,7 +583,7 @@ mod array {
583583

584584
#[pyattr]
585585
#[pyclass(name = "array")]
586-
#[derive(Debug, PyValue)]
586+
#[derive(Debug, PyPayload)]
587587
pub struct PyArray {
588588
array: PyRwLock<ArrayContentType>,
589589
exports: AtomicUsize,
@@ -1280,7 +1280,7 @@ mod array {
12801280

12811281
#[pyattr]
12821282
#[pyclass(name = "array_iterator")]
1283-
#[derive(Debug, PyValue)]
1283+
#[derive(Debug, PyPayload)]
12841284
pub struct PyArrayIter {
12851285
position: AtomicUsize,
12861286
array: PyArrayRef,

stdlib/src/contextvars.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ pub(crate) use _contextvars::make_module;
44
mod _contextvars {
55
use rustpython_vm::builtins::{PyFunction, PyStrRef, PyTypeRef};
66
use rustpython_vm::function::{ArgCallable, FuncArgs, OptionalArg};
7-
use rustpython_vm::{PyObjectRef, PyRef, PyResult, PyValue, VirtualMachine};
7+
use rustpython_vm::{PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine};
88

99
#[pyattr]
1010
#[pyclass(name)]
11-
#[derive(Debug, PyValue)]
11+
#[derive(Debug, PyPayload)]
1212
struct Context {}
1313

1414
#[pyimpl]
@@ -75,7 +75,7 @@ mod _contextvars {
7575

7676
#[pyattr]
7777
#[pyclass(name)]
78-
#[derive(Debug, PyValue)]
78+
#[derive(Debug, PyPayload)]
7979
struct ContextVar {
8080
#[allow(dead_code)] // TODO: RUSTPYTHON
8181
name: String,
@@ -147,7 +147,7 @@ mod _contextvars {
147147

148148
#[pyattr]
149149
#[pyclass(name = "Token")]
150-
#[derive(Debug, PyValue)]
150+
#[derive(Debug, PyPayload)]
151151
struct ContextToken {}
152152

153153
#[derive(FromArgs)]

stdlib/src/csv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod _csv {
99
match_class,
1010
protocol::{PyIter, PyIterReturn},
1111
types::{IterNext, IterNextIterable},
12-
AsObject, PyObjectRef, PyObjectView, PyResult, PyValue, TryFromObject, VirtualMachine,
12+
AsObject, PyObjectRef, PyObjectView, PyPayload, PyResult, TryFromObject, VirtualMachine,
1313
};
1414
use itertools::{self, Itertools};
1515
use std::fmt;
@@ -153,7 +153,7 @@ mod _csv {
153153
}
154154

155155
#[pyclass(noattr, module = "_csv", name = "reader")]
156-
#[derive(PyValue)]
156+
#[derive(PyPayload)]
157157
pub(super) struct Reader {
158158
iter: PyIter,
159159
state: PyMutex<ReadState>,
@@ -243,7 +243,7 @@ mod _csv {
243243
}
244244

245245
#[pyclass(noattr, module = "_csv", name = "writer")]
246-
#[derive(PyValue)]
246+
#[derive(PyPayload)]
247247
pub(super) struct Writer {
248248
write: PyObjectRef,
249249
state: PyMutex<WriteState>,

stdlib/src/hashlib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod hashlib {
66
use crate::vm::{
77
builtins::{PyBytes, PyBytesRef, PyStrRef, PyTypeRef},
88
function::{FuncArgs, OptionalArg},
9-
PyResult, PyValue, VirtualMachine,
9+
PyPayload, PyResult, VirtualMachine,
1010
};
1111
use blake2::{Blake2b512, Blake2s256};
1212
use digest::DynDigest;
@@ -46,7 +46,7 @@ mod hashlib {
4646

4747
#[pyattr]
4848
#[pyclass(module = "hashlib", name = "hasher")]
49-
#[derive(PyValue)]
49+
#[derive(PyPayload)]
5050
struct PyHasher {
5151
name: String,
5252
buffer: PyRwLock<HashWrapper>,

stdlib/src/json.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ mod _json {
1010
function::OptionalArg,
1111
protocol::PyIterReturn,
1212
types::{Callable, Constructor},
13-
AsObject, PyObjectRef, PyObjectView, PyResult, PyValue, VirtualMachine,
13+
AsObject, PyObjectRef, PyObjectView, PyPayload, PyResult, VirtualMachine,
1414
};
1515
use num_bigint::BigInt;
1616
use std::str::FromStr;
1717

1818
#[pyattr(name = "make_scanner")]
1919
#[pyclass(name = "Scanner")]
20-
#[derive(Debug, PyValue)]
20+
#[derive(Debug, PyPayload)]
2121
struct JsonScanner {
2222
strict: bool,
2323
object_hook: Option<PyObjectRef>,

stdlib/src/pyexpat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mod _pyexpat {
3535
builtins::{PyStr, PyStrRef, PyTypeRef},
3636
function::ArgBytesLike,
3737
function::{IntoFuncArgs, OptionalArg},
38-
PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, VirtualMachine,
38+
PyContext, PyObjectRef, PyPayload, PyRef, PyResult, TryFromObject, VirtualMachine,
3939
};
4040
use rustpython_common::lock::PyRwLock;
4141
use std::io::Cursor;
@@ -44,7 +44,7 @@ mod _pyexpat {
4444

4545
#[pyattr]
4646
#[pyclass(name = "xmlparser", module = false)]
47-
#[derive(Debug, PyValue)]
47+
#[derive(Debug, PyPayload)]
4848
pub struct PyExpatLikeXmlParser {
4949
start_element: MutableObject,
5050
end_element: MutableObject,

stdlib/src/pystruct.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) mod _struct {
1616
match_class,
1717
protocol::PyIterReturn,
1818
types::{Constructor, IterNext, IterNextIterable},
19-
AsObject, PyObjectRef, PyObjectView, PyResult, PyValue, TryFromObject, VirtualMachine,
19+
AsObject, PyObjectRef, PyObjectView, PyPayload, PyResult, TryFromObject, VirtualMachine,
2020
};
2121
use crossbeam_utils::atomic::AtomicCell;
2222

@@ -161,7 +161,7 @@ pub(crate) mod _struct {
161161

162162
#[pyattr]
163163
#[pyclass(name = "unpack_iterator")]
164-
#[derive(Debug, PyValue)]
164+
#[derive(Debug, PyPayload)]
165165
struct UnpackIterator {
166166
format_spec: FormatSpec,
167167
buffer: ArgBytesLike,
@@ -238,7 +238,7 @@ pub(crate) mod _struct {
238238

239239
#[pyattr]
240240
#[pyclass(name = "Struct")]
241-
#[derive(Debug, PyValue)]
241+
#[derive(Debug, PyPayload)]
242242
struct PyStruct {
243243
spec: FormatSpec,
244244
format: PyStrRef,

0 commit comments

Comments
 (0)