Skip to content

Commit 9b9c749

Browse files
authored
make_class -> make_static_type (#7331)
* Remove unsafe ctx cast in make_class Use Context::genesis() directly in make_class to obtain &'static Context, eliminating the raw pointer cast. * make_class -> make_static_type
1 parent be0c3ca commit 9b9c749

File tree

10 files changed

+167
-170
lines changed

10 files changed

+167
-170
lines changed

crates/derive-impl/src/pymodule.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ impl ModuleItem for ClassItem {
753753
class_meta.class_name()?
754754
};
755755
let class_new = quote_spanned!(ident.span() =>
756-
let new_class = <#ident as ::rustpython_vm::class::PyClassImpl>::make_class(ctx);
756+
let new_class = <#ident as ::rustpython_vm::class::PyClassImpl>::make_static_type();
757757
// Only set __module__ string if the class doesn't already have a
758758
// getset descriptor for __module__ (which provides instance-level
759759
// module resolution, e.g. TypeAliasType)
@@ -850,7 +850,7 @@ impl ModuleItem for StructSequenceItem {
850850

851851
// Generate the class creation code
852852
let class_new = quote_spanned!(pytype_ident.span() =>
853-
let new_class = <#pytype_ident as ::rustpython_vm::class::PyClassImpl>::make_class(ctx);
853+
let new_class = <#pytype_ident as ::rustpython_vm::class::PyClassImpl>::make_static_type();
854854
{
855855
let module_key = rustpython_vm::identifier!(ctx, __module__);
856856
let has_module_getset = new_class.attributes.read()

crates/stdlib/src/select.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ mod decl {
223223
#[cfg(unix)]
224224
{
225225
use crate::vm::class::PyClassImpl;
226-
poll::PyPoll::make_class(&vm.ctx);
226+
poll::PyPoll::make_static_type();
227227
}
228228

229229
__module_exec(vm, module);
@@ -527,9 +527,9 @@ mod decl {
527527

528528
#[cfg(any(target_os = "linux", target_os = "android", target_os = "redox"))]
529529
#[pyattr(name = "epoll", once)]
530-
fn epoll(vm: &VirtualMachine) -> PyTypeRef {
530+
fn epoll(_vm: &VirtualMachine) -> PyTypeRef {
531531
use crate::vm::class::PyClassImpl;
532-
epoll::PyEpoll::make_class(&vm.ctx)
532+
epoll::PyEpoll::make_static_type()
533533
}
534534

535535
#[cfg(any(target_os = "linux", target_os = "android", target_os = "redox"))]

crates/vm/src/class.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,13 @@ pub trait PyClassImpl: PyClassDef {
206206
class.extend_methods(class.slots.methods, ctx);
207207
}
208208

209-
fn make_class(ctx: &Context) -> PyTypeRef
209+
fn make_static_type() -> PyTypeRef
210210
where
211211
Self: StaticType + Sized,
212212
{
213213
(*Self::static_cell().get_or_init(|| {
214214
let typ = Self::create_static_type();
215-
// SAFETY: Context is heap-allocated via PyRc and stored in a static cell
216-
// (Context::genesis), so it lives for 'static.
217-
let ctx: &'static Context = unsafe { &*(ctx as *const Context) };
218-
Self::extend_class(ctx, unsafe {
215+
Self::extend_class(Context::genesis(), unsafe {
219216
// typ will be saved in static_cell
220217
let r: &Py<PyType> = &typ;
221218
let r: &'static Py<PyType> = core::mem::transmute(r);

crates/vm/src/stdlib/ast.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,15 @@ fn node_add_location(
301301
}
302302

303303
/// Return the expected AST mod type class for a compile() mode string.
304-
pub(crate) fn mode_type_and_name(
305-
ctx: &Context,
306-
mode: &str,
307-
) -> Option<(PyRef<PyType>, &'static str)> {
304+
pub(crate) fn mode_type_and_name(mode: &str) -> Option<(PyRef<PyType>, &'static str)> {
308305
match mode {
309-
"exec" => Some((pyast::NodeModModule::make_class(ctx), "Module")),
310-
"eval" => Some((pyast::NodeModExpression::make_class(ctx), "Expression")),
311-
"single" => Some((pyast::NodeModInteractive::make_class(ctx), "Interactive")),
312-
"func_type" => Some((pyast::NodeModFunctionType::make_class(ctx), "FunctionType")),
306+
"exec" => Some((pyast::NodeModModule::make_static_type(), "Module")),
307+
"eval" => Some((pyast::NodeModExpression::make_static_type(), "Expression")),
308+
"single" => Some((pyast::NodeModInteractive::make_static_type(), "Interactive")),
309+
"func_type" => Some((
310+
pyast::NodeModFunctionType::make_static_type(),
311+
"FunctionType",
312+
)),
313313
_ => None,
314314
}
315315
}

crates/vm/src/stdlib/ast/pyast.rs

Lines changed: 126 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,132 +1523,132 @@ const FIELD_TYPES: &[(&str, &[(&str, FieldType)])] = &[
15231523

15241524
pub fn extend_module_nodes(vm: &VirtualMachine, module: &Py<PyModule>) {
15251525
extend_module!(vm, module, {
1526-
"AST" => NodeAst::make_class(&vm.ctx),
1527-
"mod" => NodeMod::make_class(&vm.ctx),
1528-
"Module" => NodeModModule::make_class(&vm.ctx),
1529-
"Interactive" => NodeModInteractive::make_class(&vm.ctx),
1530-
"Expression" => NodeModExpression::make_class(&vm.ctx),
1531-
"FunctionType" => NodeModFunctionType::make_class(&vm.ctx),
1532-
"stmt" => NodeStmt::make_class(&vm.ctx),
1533-
"FunctionDef" => NodeStmtFunctionDef::make_class(&vm.ctx),
1534-
"AsyncFunctionDef" => NodeStmtAsyncFunctionDef::make_class(&vm.ctx),
1535-
"ClassDef" => NodeStmtClassDef::make_class(&vm.ctx),
1536-
"Return" => NodeStmtReturn::make_class(&vm.ctx),
1537-
"Delete" => NodeStmtDelete::make_class(&vm.ctx),
1538-
"Assign" => NodeStmtAssign::make_class(&vm.ctx),
1539-
"TypeAlias" => NodeStmtTypeAlias::make_class(&vm.ctx),
1540-
"AugAssign" => NodeStmtAugAssign::make_class(&vm.ctx),
1541-
"AnnAssign" => NodeStmtAnnAssign::make_class(&vm.ctx),
1542-
"For" => NodeStmtFor::make_class(&vm.ctx),
1543-
"AsyncFor" => NodeStmtAsyncFor::make_class(&vm.ctx),
1544-
"While" => NodeStmtWhile::make_class(&vm.ctx),
1545-
"If" => NodeStmtIf::make_class(&vm.ctx),
1546-
"With" => NodeStmtWith::make_class(&vm.ctx),
1547-
"AsyncWith" => NodeStmtAsyncWith::make_class(&vm.ctx),
1548-
"Match" => NodeStmtMatch::make_class(&vm.ctx),
1549-
"Raise" => NodeStmtRaise::make_class(&vm.ctx),
1550-
"Try" => NodeStmtTry::make_class(&vm.ctx),
1551-
"TryStar" => NodeStmtTryStar::make_class(&vm.ctx),
1552-
"Assert" => NodeStmtAssert::make_class(&vm.ctx),
1553-
"Import" => NodeStmtImport::make_class(&vm.ctx),
1554-
"ImportFrom" => NodeStmtImportFrom::make_class(&vm.ctx),
1555-
"Global" => NodeStmtGlobal::make_class(&vm.ctx),
1556-
"Nonlocal" => NodeStmtNonlocal::make_class(&vm.ctx),
1557-
"Expr" => NodeStmtExpr::make_class(&vm.ctx),
1558-
"Pass" => NodeStmtPass::make_class(&vm.ctx),
1559-
"Break" => NodeStmtBreak::make_class(&vm.ctx),
1560-
"Continue" => NodeStmtContinue::make_class(&vm.ctx),
1561-
"expr" => NodeExpr::make_class(&vm.ctx),
1562-
"BoolOp" => NodeExprBoolOp::make_class(&vm.ctx),
1563-
"NamedExpr" => NodeExprNamedExpr::make_class(&vm.ctx),
1564-
"BinOp" => NodeExprBinOp::make_class(&vm.ctx),
1565-
"UnaryOp" => NodeExprUnaryOp::make_class(&vm.ctx),
1566-
"Lambda" => NodeExprLambda::make_class(&vm.ctx),
1567-
"IfExp" => NodeExprIfExp::make_class(&vm.ctx),
1568-
"Dict" => NodeExprDict::make_class(&vm.ctx),
1569-
"Set" => NodeExprSet::make_class(&vm.ctx),
1570-
"ListComp" => NodeExprListComp::make_class(&vm.ctx),
1571-
"SetComp" => NodeExprSetComp::make_class(&vm.ctx),
1572-
"DictComp" => NodeExprDictComp::make_class(&vm.ctx),
1573-
"GeneratorExp" => NodeExprGeneratorExp::make_class(&vm.ctx),
1574-
"Await" => NodeExprAwait::make_class(&vm.ctx),
1575-
"Yield" => NodeExprYield::make_class(&vm.ctx),
1576-
"YieldFrom" => NodeExprYieldFrom::make_class(&vm.ctx),
1577-
"Compare" => NodeExprCompare::make_class(&vm.ctx),
1578-
"Call" => NodeExprCall::make_class(&vm.ctx),
1579-
"FormattedValue" => NodeExprFormattedValue::make_class(&vm.ctx),
1580-
"JoinedStr" => NodeExprJoinedStr::make_class(&vm.ctx),
1581-
"TemplateStr" => NodeExprTemplateStr::make_class(&vm.ctx),
1582-
"Interpolation" => NodeExprInterpolation::make_class(&vm.ctx),
1583-
"Constant" => NodeExprConstant::make_class(&vm.ctx),
1584-
"Attribute" => NodeExprAttribute::make_class(&vm.ctx),
1585-
"Subscript" => NodeExprSubscript::make_class(&vm.ctx),
1586-
"Starred" => NodeExprStarred::make_class(&vm.ctx),
1587-
"Name" => NodeExprName::make_class(&vm.ctx),
1588-
"List" => NodeExprList::make_class(&vm.ctx),
1589-
"Tuple" => NodeExprTuple::make_class(&vm.ctx),
1590-
"Slice" => NodeExprSlice::make_class(&vm.ctx),
1591-
"expr_context" => NodeExprContext::make_class(&vm.ctx),
1592-
"Load" => NodeExprContextLoad::make_class(&vm.ctx),
1593-
"Store" => NodeExprContextStore::make_class(&vm.ctx),
1594-
"Del" => NodeExprContextDel::make_class(&vm.ctx),
1595-
"boolop" => NodeBoolOp::make_class(&vm.ctx),
1596-
"And" => NodeBoolOpAnd::make_class(&vm.ctx),
1597-
"Or" => NodeBoolOpOr::make_class(&vm.ctx),
1598-
"operator" => NodeOperator::make_class(&vm.ctx),
1599-
"Add" => NodeOperatorAdd::make_class(&vm.ctx),
1600-
"Sub" => NodeOperatorSub::make_class(&vm.ctx),
1601-
"Mult" => NodeOperatorMult::make_class(&vm.ctx),
1602-
"MatMult" => NodeOperatorMatMult::make_class(&vm.ctx),
1603-
"Div" => NodeOperatorDiv::make_class(&vm.ctx),
1604-
"Mod" => NodeOperatorMod::make_class(&vm.ctx),
1605-
"Pow" => NodeOperatorPow::make_class(&vm.ctx),
1606-
"LShift" => NodeOperatorLShift::make_class(&vm.ctx),
1607-
"RShift" => NodeOperatorRShift::make_class(&vm.ctx),
1608-
"BitOr" => NodeOperatorBitOr::make_class(&vm.ctx),
1609-
"BitXor" => NodeOperatorBitXor::make_class(&vm.ctx),
1610-
"BitAnd" => NodeOperatorBitAnd::make_class(&vm.ctx),
1611-
"FloorDiv" => NodeOperatorFloorDiv::make_class(&vm.ctx),
1612-
"unaryop" => NodeUnaryOp::make_class(&vm.ctx),
1613-
"Invert" => NodeUnaryOpInvert::make_class(&vm.ctx),
1614-
"Not" => NodeUnaryOpNot::make_class(&vm.ctx),
1615-
"UAdd" => NodeUnaryOpUAdd::make_class(&vm.ctx),
1616-
"USub" => NodeUnaryOpUSub::make_class(&vm.ctx),
1617-
"cmpop" => NodeCmpOp::make_class(&vm.ctx),
1618-
"Eq" => NodeCmpOpEq::make_class(&vm.ctx),
1619-
"NotEq" => NodeCmpOpNotEq::make_class(&vm.ctx),
1620-
"Lt" => NodeCmpOpLt::make_class(&vm.ctx),
1621-
"LtE" => NodeCmpOpLtE::make_class(&vm.ctx),
1622-
"Gt" => NodeCmpOpGt::make_class(&vm.ctx),
1623-
"GtE" => NodeCmpOpGtE::make_class(&vm.ctx),
1624-
"Is" => NodeCmpOpIs::make_class(&vm.ctx),
1625-
"IsNot" => NodeCmpOpIsNot::make_class(&vm.ctx),
1626-
"In" => NodeCmpOpIn::make_class(&vm.ctx),
1627-
"NotIn" => NodeCmpOpNotIn::make_class(&vm.ctx),
1628-
"comprehension" => NodeComprehension::make_class(&vm.ctx),
1629-
"excepthandler" => NodeExceptHandler::make_class(&vm.ctx),
1630-
"ExceptHandler" => NodeExceptHandlerExceptHandler::make_class(&vm.ctx),
1631-
"arguments" => NodeArguments::make_class(&vm.ctx),
1632-
"arg" => NodeArg::make_class(&vm.ctx),
1633-
"keyword" => NodeKeyword::make_class(&vm.ctx),
1634-
"alias" => NodeAlias::make_class(&vm.ctx),
1635-
"withitem" => NodeWithItem::make_class(&vm.ctx),
1636-
"match_case" => NodeMatchCase::make_class(&vm.ctx),
1637-
"pattern" => NodePattern::make_class(&vm.ctx),
1638-
"MatchValue" => NodePatternMatchValue::make_class(&vm.ctx),
1639-
"MatchSingleton" => NodePatternMatchSingleton::make_class(&vm.ctx),
1640-
"MatchSequence" => NodePatternMatchSequence::make_class(&vm.ctx),
1641-
"MatchMapping" => NodePatternMatchMapping::make_class(&vm.ctx),
1642-
"MatchClass" => NodePatternMatchClass::make_class(&vm.ctx),
1643-
"MatchStar" => NodePatternMatchStar::make_class(&vm.ctx),
1644-
"MatchAs" => NodePatternMatchAs::make_class(&vm.ctx),
1645-
"MatchOr" => NodePatternMatchOr::make_class(&vm.ctx),
1646-
"type_ignore" => NodeTypeIgnore::make_class(&vm.ctx),
1647-
"TypeIgnore" => NodeTypeIgnoreTypeIgnore::make_class(&vm.ctx),
1648-
"type_param" => NodeTypeParam::make_class(&vm.ctx),
1649-
"TypeVar" => NodeTypeParamTypeVar::make_class(&vm.ctx),
1650-
"ParamSpec" => NodeTypeParamParamSpec::make_class(&vm.ctx),
1651-
"TypeVarTuple" => NodeTypeParamTypeVarTuple::make_class(&vm.ctx),
1526+
"AST" => NodeAst::make_static_type(),
1527+
"mod" => NodeMod::make_static_type(),
1528+
"Module" => NodeModModule::make_static_type(),
1529+
"Interactive" => NodeModInteractive::make_static_type(),
1530+
"Expression" => NodeModExpression::make_static_type(),
1531+
"FunctionType" => NodeModFunctionType::make_static_type(),
1532+
"stmt" => NodeStmt::make_static_type(),
1533+
"FunctionDef" => NodeStmtFunctionDef::make_static_type(),
1534+
"AsyncFunctionDef" => NodeStmtAsyncFunctionDef::make_static_type(),
1535+
"ClassDef" => NodeStmtClassDef::make_static_type(),
1536+
"Return" => NodeStmtReturn::make_static_type(),
1537+
"Delete" => NodeStmtDelete::make_static_type(),
1538+
"Assign" => NodeStmtAssign::make_static_type(),
1539+
"TypeAlias" => NodeStmtTypeAlias::make_static_type(),
1540+
"AugAssign" => NodeStmtAugAssign::make_static_type(),
1541+
"AnnAssign" => NodeStmtAnnAssign::make_static_type(),
1542+
"For" => NodeStmtFor::make_static_type(),
1543+
"AsyncFor" => NodeStmtAsyncFor::make_static_type(),
1544+
"While" => NodeStmtWhile::make_static_type(),
1545+
"If" => NodeStmtIf::make_static_type(),
1546+
"With" => NodeStmtWith::make_static_type(),
1547+
"AsyncWith" => NodeStmtAsyncWith::make_static_type(),
1548+
"Match" => NodeStmtMatch::make_static_type(),
1549+
"Raise" => NodeStmtRaise::make_static_type(),
1550+
"Try" => NodeStmtTry::make_static_type(),
1551+
"TryStar" => NodeStmtTryStar::make_static_type(),
1552+
"Assert" => NodeStmtAssert::make_static_type(),
1553+
"Import" => NodeStmtImport::make_static_type(),
1554+
"ImportFrom" => NodeStmtImportFrom::make_static_type(),
1555+
"Global" => NodeStmtGlobal::make_static_type(),
1556+
"Nonlocal" => NodeStmtNonlocal::make_static_type(),
1557+
"Expr" => NodeStmtExpr::make_static_type(),
1558+
"Pass" => NodeStmtPass::make_static_type(),
1559+
"Break" => NodeStmtBreak::make_static_type(),
1560+
"Continue" => NodeStmtContinue::make_static_type(),
1561+
"expr" => NodeExpr::make_static_type(),
1562+
"BoolOp" => NodeExprBoolOp::make_static_type(),
1563+
"NamedExpr" => NodeExprNamedExpr::make_static_type(),
1564+
"BinOp" => NodeExprBinOp::make_static_type(),
1565+
"UnaryOp" => NodeExprUnaryOp::make_static_type(),
1566+
"Lambda" => NodeExprLambda::make_static_type(),
1567+
"IfExp" => NodeExprIfExp::make_static_type(),
1568+
"Dict" => NodeExprDict::make_static_type(),
1569+
"Set" => NodeExprSet::make_static_type(),
1570+
"ListComp" => NodeExprListComp::make_static_type(),
1571+
"SetComp" => NodeExprSetComp::make_static_type(),
1572+
"DictComp" => NodeExprDictComp::make_static_type(),
1573+
"GeneratorExp" => NodeExprGeneratorExp::make_static_type(),
1574+
"Await" => NodeExprAwait::make_static_type(),
1575+
"Yield" => NodeExprYield::make_static_type(),
1576+
"YieldFrom" => NodeExprYieldFrom::make_static_type(),
1577+
"Compare" => NodeExprCompare::make_static_type(),
1578+
"Call" => NodeExprCall::make_static_type(),
1579+
"FormattedValue" => NodeExprFormattedValue::make_static_type(),
1580+
"JoinedStr" => NodeExprJoinedStr::make_static_type(),
1581+
"TemplateStr" => NodeExprTemplateStr::make_static_type(),
1582+
"Interpolation" => NodeExprInterpolation::make_static_type(),
1583+
"Constant" => NodeExprConstant::make_static_type(),
1584+
"Attribute" => NodeExprAttribute::make_static_type(),
1585+
"Subscript" => NodeExprSubscript::make_static_type(),
1586+
"Starred" => NodeExprStarred::make_static_type(),
1587+
"Name" => NodeExprName::make_static_type(),
1588+
"List" => NodeExprList::make_static_type(),
1589+
"Tuple" => NodeExprTuple::make_static_type(),
1590+
"Slice" => NodeExprSlice::make_static_type(),
1591+
"expr_context" => NodeExprContext::make_static_type(),
1592+
"Load" => NodeExprContextLoad::make_static_type(),
1593+
"Store" => NodeExprContextStore::make_static_type(),
1594+
"Del" => NodeExprContextDel::make_static_type(),
1595+
"boolop" => NodeBoolOp::make_static_type(),
1596+
"And" => NodeBoolOpAnd::make_static_type(),
1597+
"Or" => NodeBoolOpOr::make_static_type(),
1598+
"operator" => NodeOperator::make_static_type(),
1599+
"Add" => NodeOperatorAdd::make_static_type(),
1600+
"Sub" => NodeOperatorSub::make_static_type(),
1601+
"Mult" => NodeOperatorMult::make_static_type(),
1602+
"MatMult" => NodeOperatorMatMult::make_static_type(),
1603+
"Div" => NodeOperatorDiv::make_static_type(),
1604+
"Mod" => NodeOperatorMod::make_static_type(),
1605+
"Pow" => NodeOperatorPow::make_static_type(),
1606+
"LShift" => NodeOperatorLShift::make_static_type(),
1607+
"RShift" => NodeOperatorRShift::make_static_type(),
1608+
"BitOr" => NodeOperatorBitOr::make_static_type(),
1609+
"BitXor" => NodeOperatorBitXor::make_static_type(),
1610+
"BitAnd" => NodeOperatorBitAnd::make_static_type(),
1611+
"FloorDiv" => NodeOperatorFloorDiv::make_static_type(),
1612+
"unaryop" => NodeUnaryOp::make_static_type(),
1613+
"Invert" => NodeUnaryOpInvert::make_static_type(),
1614+
"Not" => NodeUnaryOpNot::make_static_type(),
1615+
"UAdd" => NodeUnaryOpUAdd::make_static_type(),
1616+
"USub" => NodeUnaryOpUSub::make_static_type(),
1617+
"cmpop" => NodeCmpOp::make_static_type(),
1618+
"Eq" => NodeCmpOpEq::make_static_type(),
1619+
"NotEq" => NodeCmpOpNotEq::make_static_type(),
1620+
"Lt" => NodeCmpOpLt::make_static_type(),
1621+
"LtE" => NodeCmpOpLtE::make_static_type(),
1622+
"Gt" => NodeCmpOpGt::make_static_type(),
1623+
"GtE" => NodeCmpOpGtE::make_static_type(),
1624+
"Is" => NodeCmpOpIs::make_static_type(),
1625+
"IsNot" => NodeCmpOpIsNot::make_static_type(),
1626+
"In" => NodeCmpOpIn::make_static_type(),
1627+
"NotIn" => NodeCmpOpNotIn::make_static_type(),
1628+
"comprehension" => NodeComprehension::make_static_type(),
1629+
"excepthandler" => NodeExceptHandler::make_static_type(),
1630+
"ExceptHandler" => NodeExceptHandlerExceptHandler::make_static_type(),
1631+
"arguments" => NodeArguments::make_static_type(),
1632+
"arg" => NodeArg::make_static_type(),
1633+
"keyword" => NodeKeyword::make_static_type(),
1634+
"alias" => NodeAlias::make_static_type(),
1635+
"withitem" => NodeWithItem::make_static_type(),
1636+
"match_case" => NodeMatchCase::make_static_type(),
1637+
"pattern" => NodePattern::make_static_type(),
1638+
"MatchValue" => NodePatternMatchValue::make_static_type(),
1639+
"MatchSingleton" => NodePatternMatchSingleton::make_static_type(),
1640+
"MatchSequence" => NodePatternMatchSequence::make_static_type(),
1641+
"MatchMapping" => NodePatternMatchMapping::make_static_type(),
1642+
"MatchClass" => NodePatternMatchClass::make_static_type(),
1643+
"MatchStar" => NodePatternMatchStar::make_static_type(),
1644+
"MatchAs" => NodePatternMatchAs::make_static_type(),
1645+
"MatchOr" => NodePatternMatchOr::make_static_type(),
1646+
"type_ignore" => NodeTypeIgnore::make_static_type(),
1647+
"TypeIgnore" => NodeTypeIgnoreTypeIgnore::make_static_type(),
1648+
"type_param" => NodeTypeParam::make_static_type(),
1649+
"TypeVar" => NodeTypeParamTypeVar::make_static_type(),
1650+
"ParamSpec" => NodeTypeParamParamSpec::make_static_type(),
1651+
"TypeVarTuple" => NodeTypeParamTypeVarTuple::make_static_type(),
16521652
});
16531653

16541654
// Populate _field_types with real Python type objects

crates/vm/src/stdlib/ast/python.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ Support for arbitrary keyword arguments is deprecated and will be removed in Pyt
366366
field_types.map(|ft| ft.downcast::<crate::builtins::PyDict>())
367367
{
368368
let expr_ctx_type: PyObjectRef =
369-
super::super::pyast::NodeExprContext::make_class(&vm.ctx).into();
369+
super::super::pyast::NodeExprContext::make_static_type().into();
370370

371371
for field in &fields {
372372
if set_fields.contains(field.as_str()) {
@@ -382,7 +382,7 @@ Support for arbitrary keyword arguments is deprecated and will be removed in Pyt
382382
} else if ftype.is(&expr_ctx_type) {
383383
// expr_context — default to Load()
384384
let load_type =
385-
super::super::pyast::NodeExprContextLoad::make_class(&vm.ctx);
385+
super::super::pyast::NodeExprContextLoad::make_static_type();
386386
let load_instance = load_type
387387
.get_attr(vm.ctx.intern_str("_instance"))
388388
.unwrap_or_else(|| {

0 commit comments

Comments
 (0)