8000 more typing by youknowone · Pull Request #5840 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content

more typing #5840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
rename typing
  • Loading branch information
youknowone committed Jun 26, 2025
commit bea50950259e345548b7e643d1ede8772bdf1ef1
14 changes: 7 additions & 7 deletions vm/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
protocol::{PyIter, PyIterReturn},
scope::Scope,
source::SourceLocation,
stdlib::{builtins, typing::_typing},
stdlib::{builtins, typing},
vm::{Context, PyMethod},
};
use indexmap::IndexMap;
Expand Down Expand Up @@ -1234,7 +1234,7 @@ impl ExecutingFrame<'_> {
bytecode::Instruction::TypeVar => {
let type_name = self.pop_value();
let type_var: PyObjectRef =
_typing::make_typevar(vm, type_name.clone(), vm.ctx.none(), vm.ctx.none())
typing::make_typevar(vm, type_name.clone(), vm.ctx.none(), vm.ctx.none())
.into_ref(&vm.ctx)
.into();
self.push_value(type_var);
Expand All @@ -1244,7 +1244,7 @@ impl ExecutingFrame<'_> {
let type_name = self.pop_value();
let bound = self.pop_value();
let type_var: PyObjectRef =
_typing::make_typevar(vm, type_name.clone(), bound, vm.ctx.none())
typing::make_typevar(vm, type_name.clone(), bound, vm.ctx.none())
.into_ref(&vm.ctx)
.into();
self.push_value(type_var);
Expand All @@ -1254,7 +1254,7 @@ impl ExecutingFrame<'_> {
let type_name = self.pop_value();
let constraint = self.pop_value();
let type_var: PyObjectRef =
_typing::make_typevar(vm, type_name.clone(), vm.ctx.none(), constraint)
typing::make_typevar(vm, type_name.clone(), vm.ctx.none(), constraint)
.into_ref(&vm.ctx)
.into();
self.push_value(type_var);
Expand All @@ -1267,13 +1267,13 @@ impl ExecutingFrame<'_> {
.downcast()
.map_err(|_| vm.new_type_error("Type params must be a tuple."))?;
let value = self.pop_value();
let type_alias = _typing::TypeAliasType::new(name, type_params, value);
let type_alias = typing::TypeAliasType::new(name, type_params, value);
self.push_value(type_alias.into_ref(&vm.ctx).into());
Ok(None)
}
bytecode::Instruction::ParamSpec => {
let param_spec_name = self.pop_value();
let param_spec: PyObjectRef = _typing::make_paramspec(param_spec_name.clone())
let param_spec: PyObjectRef = typing::make_paramspec(param_spec_name.clone())
.into_ref(&vm.ctx)
.into();
self.push_value(param_spec);
Expand All @@ -1282,7 +1282,7 @@ impl ExecutingFrame<'_> {
bytecode::Instruction::TypeVarTuple => {
let type_var_tuple_name = self.pop_value();
let type_var_tuple: PyObjectRef =
_typing::make_typevartuple(type_var_tuple_name.clone(), vm)
typing::make_typevartuple(type_var_tuple_name.clone(), vm)
.into_ref(&vm.ctx)
.into();
self.push_value(type_var_tuple);
Expand Down
8 changes: 4 additions & 4 deletions vm/src/stdlib/typing.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use crate::{PyRef, VirtualMachine, stdlib::PyModule};

pub(crate) use _typing::NoDefault;
pub(crate) use decl::*;

pub(crate) fn make_module(vm: &VirtualMachine) -> PyRef<PyModule> {
let module = _typing::make_module(vm);
let module = decl::make_module(vm);
extend_module!(vm, &module, {
"NoDefault" => vm.ctx.typing_no_default.clone(),
});
module
}

#[pymodule]
pub(crate) mod _typing {
#[pymodule(name = "_typing")]
pub(crate) mod decl {
use crate::{
AsObject, PyObjectRef, PyPayload, PyResult, VirtualMachine,
builtins::{PyGenericAlias, PyTupleRef, PyTypeRef, pystr::AsPyStr},
Expand Down
0