Skip to content

Commit b4706df

Browse files
committed
additional intern_static_str
1 parent 33fccbe commit b4706df

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

derive-impl/src/pymodule.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ impl ModuleItem for ClassItem {
571571
let set_attr = match py_names.len() {
572572
0 => quote! {
573573
let _ = new_class; // suppress warning
574-
let _ = vm.ctx.intern_str(#class_name);
574+
let _ = vm.ctx.intern_str(#class_name); // TODO: intern_static_str
575575
},
576576
1 => {
577577
let py_name = &py_names[0];

vm/src/builtins/dict.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl PyDict {
6868
Err(other) => other,
6969
};
7070
let dict = &self.entries;
71-
if let Some(keys) = vm.get_method(other.clone(), vm.ctx.intern_str("keys")) {
71+
if let Some(keys) = vm.get_method(other.clone(), vm.ctx.interned_str("keys").unwrap()) {
7272
let keys = keys?.call((), vm)?.get_iter(vm)?;
7373
while let PyIterReturn::Return(key) = keys.next(vm)? {
7474
let val = other.get_item(&*key, vm)?;
@@ -509,7 +509,7 @@ impl Representable for PyDict {
509509

510510
vm.ctx.new_str(format!("{{{}}}", str_parts.join(", ")))
511511
} else {
512-
vm.ctx.intern_str("{...}").to_owned()
512+
vm.ctx.intern_static_str("{...}").to_owned()
513513
};
514514
Ok(s)
515515
}
@@ -797,7 +797,7 @@ macro_rules! dict_view {
797797
vm.ctx
798798
.new_str(format!("{}([{}])", Self::NAME, str_parts.join(", ")))
799799
} else {
800-
vm.ctx.intern_str("{...}").to_owned()
800+
vm.ctx.intern_static_str("{...}").to_owned()
801801
};
802802
Ok(s)
803803
}

vm/src/builtins/frame.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Representable for Frame {
2222
#[inline]
2323
fn repr(_zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyStrRef> {
2424
const REPR: &str = "<frame object at .. >";
25-
Ok(vm.ctx.intern_str(REPR).to_owned())
25+
Ok(vm.ctx.intern_static_str(REPR).to_owned())
2626
}
2727

2828
#[cold]

vm/src/builtins/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl<'a> AsPyStr<'a> for &'a PyStrRef {
251251
impl AsPyStr<'static> for &'static str {
252252
#[inline]
253253
fn as_pystr(self, ctx: &Context) -> &'static Py<PyStr> {
254-
ctx.intern_str(self)
254+
ctx.intern_static_str(self)
255255
}
256256
}
257257

vm/src/warn.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ fn setup_context(
397397
let (globals, filename, lineno) = if let Some(f) = f {
398398
(f.globals.clone(), f.code.source_path, f.f_lineno())
399399
} else {
400-
(vm.current_globals().clone(), vm.ctx.intern_str("sys"), 1)
400+
(
401+
vm.current_globals().clone(),
402+
vm.ctx.interned_str("sys").unwrap(),
403+
1,
404+
)
401405
};
402406

403407
let registry = if let Ok(registry) = globals.get_item(__warningregistry__, vm) {

0 commit comments

Comments
 (0)