Skip to content

Commit 4ae5a1f

Browse files
authored
Fix ImportError fields (#6079)
1 parent 93eacda commit 4ae5a1f

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

Lib/importlib/metadata/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ def name(self):
5656
(name,) = self.args
5757
return name
5858

59-
# TODO: RUSTPYTHON; the entire setter is added to avoid errors
60-
@name.setter
61-
def name(self, value):
62-
import sys
63-
sys.stderr.write("set value to PackageNotFoundError ignored\n")
64-
6559

6660
class Sectioned:
6761
"""

vm/src/exceptions.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,6 @@ impl ExceptionZoo {
923923

924924
extend_exception!(PyImportError, ctx, excs.import_error, {
925925
"msg" => ctx.new_readonly_getset("msg", excs.import_error, make_arg_getter(0)),
926-
"name" => ctx.none(),
927-
"path" => ctx.none(),
928926
});
929927
extend_exception!(PyModuleNotFoundError, ctx, excs.module_not_found_error);
930928

@@ -1364,8 +1362,9 @@ pub(super) mod types {
13641362
)));
13651363
}
13661364

1367-
zelf.set_attr("name", vm.unwrap_or_none(name), vm)?;
1368-
zelf.set_attr("path", vm.unwrap_or_none(path), vm)?;
1365+
let dict = zelf.dict().unwrap();
1366+
dict.set_item("name", vm.unwrap_or_none(name), vm)?;
1367+
dict.set_item("path", vm.unwrap_or_none(path), vm)?;
13691368
PyBaseException::slot_init(zelf, args, vm)
13701369
}
13711370
#[pymethod]

0 commit comments

Comments
 (0)