Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/derive-impl/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub(crate) fn impl_pyclass_impl(attr: PunctuatedNestedMeta, item: Item) -> Resul
},
parse_quote! {
fn __extend_py_class(
ctx: &::rustpython_vm::Context,
ctx: &'static ::rustpython_vm::Context,
class: &'static ::rustpython_vm::Py<::rustpython_vm::builtins::PyType>,
) {
#getset_impl
Expand Down Expand Up @@ -222,7 +222,7 @@ pub(crate) fn impl_pyclass_impl(attr: PunctuatedNestedMeta, item: Item) -> Resul
const TP_FLAGS: ::rustpython_vm::types::PyTypeFlags = #flags;

fn impl_extend_class(
ctx: &::rustpython_vm::Context,
ctx: &'static ::rustpython_vm::Context,
class: &'static ::rustpython_vm::Py<::rustpython_vm::builtins::PyType>,
) {
#impl_ty::__extend_py_class(ctx, class);
Expand Down Expand Up @@ -284,7 +284,7 @@ pub(crate) fn impl_pyclass_impl(attr: PunctuatedNestedMeta, item: Item) -> Resul
},
parse_quote! {
fn __extend_py_class(
ctx: &::rustpython_vm::Context,
ctx: &'static ::rustpython_vm::Context,
class: &'static ::rustpython_vm::Py<::rustpython_vm::builtins::PyType>,
) {
#getset_impl
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/asyncgenerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ impl Drop for PyAsyncGen {
}
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
PyAsyncGen::extend_class(ctx, ctx.types.async_generator);
PyAsyncGenASend::extend_class(ctx, ctx.types.async_generator_asend);
PyAsyncGenAThrow::extend_class(ctx, ctx.types.async_generator_athrow);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl Representable for PyBool {
}
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyBool::extend_class(context, context.types.bool_type);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/builtin_func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl fmt::Debug for PyNativeMethod {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyNativeFunction::extend_class(context, context.types.builtin_function_or_method_type);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/bytearray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl PyPayload for PyByteArray {
}

/// Fill bytearray class methods dictionary.
pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyByteArray::extend_class(context, context.types.bytearray_type);
PyByteArrayIterator::extend_class(context, context.types.bytearray_iterator_type);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl PyPayload for PyBytes {
}
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyBytes::extend_class(context, context.types.bytes_type);
PyBytesIterator::extend_class(context, context.types.bytes_iterator_type);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ impl Representable for PyCapsule {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyCapsule::extend_class(context, context.types.capsule_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/classmethod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,6 @@ impl Representable for PyClassMethod {
}
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyClassMethod::extend_class(context, context.types.classmethod_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,6 @@ impl<'a> LineTableReader<'a> {
}
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
PyCode::extend_class(ctx, ctx.types.code_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl PyObjectRef {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyComplex::extend_class(context, context.types.complex_type);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/coroutine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl Drop for PyCoroutine {
}
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
PyCoroutine::extend_class(ctx, ctx.types.coroutine_type);
PyCoroutineWrapper::extend_class(ctx, ctx.types.coroutine_wrapper_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ impl GetDescriptor for PyMemberDescriptor {
}
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
PyMemberDescriptor::extend_class(ctx, ctx.types.member_descriptor_type);
PyMethodDescriptor::extend_class(ctx, ctx.types.method_descriptor_type);
PyWrapper::extend_class(ctx, ctx.types.wrapper_descriptor_type);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ fn set_inner_number_or(a: &PyObject, b: &PyObject, vm: &VirtualMachine) -> PyRes
set_inner_number_op(a, b, |a, b| a.union(b, vm), vm)
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyDict::extend_class(context, context.types.dict_type);
PyDictKeys::extend_class(context, context.types.dict_keys_type);
PyDictKeyIterator::extend_class(context, context.types.dict_keyiterator_type);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/enumerate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl IterNext for PyReverseSequenceIterator {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyEnumerate::extend_class(context, context.types.enumerate_type);
PyReverseSequenceIterator::extend_class(context, context.types.reverse_iter_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ impl IterNext for PyFilter {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyFilter::extend_class(context, context.types.filter_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,6 @@ pub(crate) fn get_value(obj: &PyObject) -> f64 {
}

#[rustfmt::skip] // to avoid line splitting
pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyFloat::extend_class(context, context.types.float_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pub(crate) mod stack_analysis {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
Frame::extend_class(context, context.types.frame_type);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ impl PyCell {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyFunction::extend_class(context, context.types.function_type);
PyBoundMethod::extend_class(context, context.types.bound_method_type);
PyCell::extend_class(context, context.types.cell_type);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@ impl Drop for PyGenerator {
}
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
PyGenerator::extend_class(ctx, ctx.types.generator_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/genericalias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ pub fn subscript_generic(type_params: PyObjectRef, vm: &VirtualMachine) -> PyRes
generic_alias_class.call((generic_type, args.to_pyobject(vm)), vm)
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyGenericAlias::extend_class(context, context.types.generic_alias_type);
PyGenericAliasIterator::extend_class(context, context.types.generic_alias_iterator_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/getset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ impl Representable for PyGetSet {
}
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyGetSet::extend_class(context, context.types.getset_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,6 @@ pub fn try_to_float(int: &BigInt, vm: &VirtualMachine) -> PyResult<f64> {
.ok_or_else(|| vm.new_overflow_error("int too large to convert to float"))
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyInt::extend_class(context, context.types.int_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/interpolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,6 @@ impl Representable for PyInterpolation {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyInterpolation::extend_class(context, context.types.interpolation_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ impl IterNext for PyCallableIterator {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PySequenceIterator::extend_class(context, context.types.iter_type);
PyCallableIterator::extend_class(context, context.types.callable_iterator);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ impl IterNext for PyListReverseIterator {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
let list_type = &context.types.list_type;
PyList::extend_class(context, list_type);

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ impl IterNext for PyMap {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyMap::extend_class(context, context.types.map_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/mappingproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,6 @@ impl Representable for PyMappingProxy {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyMappingProxy::extend_class(context, context.types.mappingproxy_type)
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@ impl Representable for PyMemoryView {
}
}

pub(crate) fn init(ctx: &Context) {
pub(crate) fn init(ctx: &'static Context) {
PyMemoryView::extend_class(ctx, ctx.types.memoryview_type);
PyMemoryViewIterator::extend_class(ctx, ctx.types.memoryviewiterator_type);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ impl Representable for PyModule {
}
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyModule::extend_class(context, context.types.module_type);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ impl Representable for PyNamespace {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyNamespace::extend_class(context, context.types.namespace_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ pub fn object_set_dict(obj: PyObjectRef, dict: PyDictRef, vm: &VirtualMachine) -
.map_err(|_| vm.new_attribute_error("This object has no __dict__"))
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
// Manually set init slot - derive macro doesn't generate extend_slots
// for trait impl that overrides #[pyslot] method
ctx.types
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ impl Initializer for PyProperty {
}
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyProperty::extend_class(context, context.types.property_type);

// This is a bit unfortunate, but this instance attribute overlaps with the
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl PyRange {
// obj.downcast_ref::<PyRange>().unwrap().clone()
// }

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyRange::extend_class(context, context.types.range_type);
PyLongRangeIterator::extend_class(context, context.types.long_range_iterator_type);
PyRangeIterator::extend_class(context, context.types.range_iterator_type);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ impl IterNext for PySetIterator {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PySet::extend_class(context, context.types.set_type);
PyFrozenSet::extend_class(context, context.types.frozenset_type);
PySetIterator::extend_class(context, context.types.set_iterator_type);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/singletons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl Representable for PyNotImplemented {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyNone::extend_class(context, context.types.none_type);
PyNotImplemented::extend_class(context, context.types.not_implemented_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl Representable for PyEllipsis {
}
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
PySlice::extend_class(ctx, ctx.types.slice_type);
PyEllipsis::extend_class(ctx, ctx.types.ellipsis_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/staticmethod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,6 @@ impl Representable for PyStaticMethod {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyStaticMethod::extend_class(context, context.types.staticmethod_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,7 @@ struct ReplaceArgs {
count: isize,
}

pub fn init(ctx: &Context) {
pub fn init(ctx: &'static Context) {
PyStr::extend_class(ctx, ctx.types.str_type);

PyStrIterator::extend_class(ctx, ctx.types.str_iterator_type);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/super.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn super_check(ty: PyTypeRef, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult
)))
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
let super_type = &context.types.super_type;
PySuper::extend_class(context, super_type);

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl IterNext for PyTemplateIter {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyTemplate::extend_class(context, context.types.template_type);
PyTemplateIter::extend_class(context, context.types.template_iter_type);
}
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/traceback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl PyTracebackRef {
}
}

pub fn init(context: &Context) {
pub fn init(context: &'static Context) {
PyTraceback::extend_class(context, context.types.traceback_type);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ impl IterNext for PyTupleIterator {
}
}

pub(crate) fn init(context: &Context) {
pub(crate) fn init(context: &'static Context) {
PyTuple::extend_class(context, context.types.tuple_type);
PyTupleIterator::extend_class(context, context.types.tuple_iterator_type);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2103,7 +2103,7 @@ fn subtype_set_dict(obj: PyObjectRef, value: PyObjectRef, vm: &VirtualMachine) -
* The magical type type
*/

pub(crate) fn init(ctx: &Context) {
pub(crate) fn init(ctx: &'static Context) {
PyType::extend_class(ctx, ctx.types.type_type);
}

Expand Down
Loading
Loading