Skip to content

Commit 69e1f69

Browse files
committed
additional intern_static_str
1 parent 10f08e0 commit 69e1f69

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

derive-impl/src/pymodule.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl PyDict {
7171
Err(other) => other,
7272
};
7373
let dict = &self.entries;
74-
if let Some(keys) = vm.get_method(other.clone(), vm.ctx.intern_str("keys")) {
74+
if let Some(keys) = vm.get_method(other.clone(), vm.ctx.interned_str("keys").unwrap()) {
7575
let keys = keys?.call((), vm)?.get_iter(vm)?;
7676
while let PyIterReturn::Return(key) = keys.next(vm)? {
7777
let val = other.get_item(&*key, vm)?;
@@ -525,7 +525,7 @@ impl Representable for PyDict {
525525

526526
vm.ctx.new_str(format!("{{{}}}", str_parts.join(", ")))
527527
} else {
528-
vm.ctx.intern_str("{...}").to_owned()
528+
vm.ctx.intern_static_str("{...}").to_owned()
529529
};
530530
Ok(s)
531531
}
@@ -815,7 +815,7 @@ macro_rules! dict_view {
815815
vm.ctx
816816
.new_str(format!("{}([{}])", Self::NAME, str_parts.join(", ")))
817817
} else {
818-
vm.ctx.intern_str("{...}").to_owned()
818+
vm.ctx.intern_static_str("{...}").to_owned()
819819
};
820820
Ok(s)
821821
}

vm/src/builtins/frame.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<'a> AsPyStr<'a> for &'a PyStrRef {
174174
impl AsPyStr<'static> for &'static str {
175175
#[inline]
176176
fn as_pystr(self, ctx: &Context) -> &'static Py<PyStr> {
177-
ctx.intern_str(self)
177+
ctx.intern_static_str(self)
178178
}
179179
}
180180

vm/src/warn.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ fn setup_context(
330330
let (globals, filename, lineno) = if let Some(f) = f {
331331
(f.globals.clone(), f.code.source_path, f.f_lineno())
332332
} else {
333-
(vm.current_globals().clone(), vm.ctx.intern_str("sys"), 1)
333+
(
334+
vm.current_globals().clone(),
335+
vm.ctx.interned_str("sys").unwrap(),
336+
1,
337+
)
334338
};
335339

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

0 commit comments

Comments
 (0)