@@ -14,7 +14,7 @@ pub(crate) mod _interpreters { |
14 | 14 | AsObject, Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine, |
15 | 15 | builtins::{PyBaseExceptionRef, PyCode, PyDict, PyException, PyFunction, PyModule, PyStr}, |
16 | 16 | class::PyClassImpl, |
17 | | - function::{ArgSpec, FuncArgs}, |
| 17 | + function::{ArgSpec, ArgumentError, DefaultRepr, FromArgs, FuncArgs, Param, ParamKind}, |
18 | 18 | protocol::{BufferMethods, PyBuffer}, |
19 | 19 | types::{AsBuffer, Constructor}, |
20 | 20 | vm::{ |
@@ -395,8 +395,38 @@ pub(crate) mod _interpreters { |
395 | 395 | .into() |
396 | 396 | } |
397 | 397 |
|
| 398 | + struct NewConfigArgs(FuncArgs); |
| 399 | + |
| 400 | + impl FromArgs for NewConfigArgs { |
| 401 | + const PARAMS: Option<&'static [Param]> = Some(&[ |
| 402 | + Param { |
| 403 | + name: "name", |
| 404 | + kind: ParamKind::PositionalOnly, |
| 405 | + default: Some(DefaultRepr::Str("isolated")), |
| 406 | + }, |
| 407 | + Param::var_keyword("overrides"), |
| 408 | + ]); |
| 409 | + |
| 410 | + fn from_args(_vm: &VirtualMachine, args: &mut FuncArgs) -> Result<Self, ArgumentError> { |
| 411 | + Ok(Self(core::mem::take(args))) |
| 412 | + } |
| 413 | + } |
| 414 | + |
| 415 | + struct ListAllArgs(FuncArgs); |
| 416 | + |
| 417 | + impl FromArgs for ListAllArgs { |
| 418 | + const PARAMS: Option<&'static [Param]> = Some(&[Param::keyword_only( |
| 419 | + "require_ready", |
| 420 | + Some(DefaultRepr::Bool(false)), |
| 421 | + )]); |
| 422 | + |
| 423 | + fn from_args(_vm: &VirtualMachine, args: &mut FuncArgs) -> Result<Self, ArgumentError> { |
| 424 | + Ok(Self(core::mem::take(args))) |
| 425 | + } |
| 426 | + } |
| 427 | + |
398 | 428 | #[pyfunction] |
399 | | - fn new_config(args: FuncArgs, vm: &VirtualMachine) -> PyResult { |
| 429 | + fn new_config(NewConfigArgs(args): NewConfigArgs, vm: &VirtualMachine) -> PyResult { |
400 | 430 | const FUNCNAME: &str = "_interpreters.new_config"; |
401 | 431 | if args.args.len() > 1 { |
402 | 432 | return Err(vm.new_type_error(format!( |
@@ -502,7 +532,7 @@ pub(crate) mod _interpreters { |
502 | 532 | } |
503 | 533 |
|
504 | 534 | #[pyfunction] |
505 | | - fn list_all(args: FuncArgs, vm: &VirtualMachine) -> PyResult { |
| 535 | + fn list_all(ListAllArgs(args): ListAllArgs, vm: &VirtualMachine) -> PyResult { |
506 | 536 | let parsed = ArgSpec { |
507 | 537 | fname: "_interpreters.list_all", |
508 | 538 | keywords: &["require_ready"], |
|