GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Expose two interpreter configuration signatures (#9609) · RustPython/RustPython@bcd0a67

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • crates/vm/src/stdlib
    • _interpreters.rs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎crates/vm/src/stdlib/_interpreters.rs‎

Copy file name to clipboardExpand all lines: crates/vm/src/stdlib/_interpreters.rs
+33-3Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(crate) mod _interpreters {
1414
AsObject, Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
1515
builtins::{PyBaseExceptionRef, PyCode, PyDict, PyException, PyFunction, PyModule, PyStr},
1616
class::PyClassImpl,
17-
function::{ArgSpec, FuncArgs},
17+
function::{ArgSpec, ArgumentError, DefaultRepr, FromArgs, FuncArgs, Param, ParamKind},
1818
protocol::{BufferMethods, PyBuffer},
1919
types::{AsBuffer, Constructor},
2020
vm::{
@@ -395,8 +395,38 @@ pub(crate) mod _interpreters {
395395
.into()
396396
}
397397

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+
398428
#[pyfunction]
399-
fn new_config(args: FuncArgs, vm: &VirtualMachine) -> PyResult {
429+
fn new_config(NewConfigArgs(args): NewConfigArgs, vm: &VirtualMachine) -> PyResult {
400430
const FUNCNAME: &str = "_interpreters.new_config";
401431
if args.args.len() > 1 {
402432
return Err(vm.new_type_error(format!(
@@ -502,7 +532,7 @@ pub(crate) mod _interpreters {
502532
}
503533

504534
#[pyfunction]
505-
fn list_all(args: FuncArgs, vm: &VirtualMachine) -> PyResult {
535+
fn list_all(ListAllArgs(args): ListAllArgs, vm: &VirtualMachine) -> PyResult {
506536
let parsed = ArgSpec {
507537
fname: "_interpreters.list_all",
508538
keywords: &["require_ready"],

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.