Skip to content

Commit

Permalink
Update Python test file (#901)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Jul 19, 2024
1 parent 529deb7 commit e3c12f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions source/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -3680,9 +3680,11 @@ python.Execution = class {
}
return undefined;
});
this.registerFunction('dill._dill._create_type', (/* typeobj */) => {
// return execution.invoke(typeobj, Array.from(arguments).slice(1));
throw new python.Error("'dill._dill._create_type' not implemented.");
this.registerFunction('dill._dill._create_type', (typeobj, ...args) => {
const [name, bases, dict] = args;
const type = class extends bases[0] {};
const identifier = dict.__module__ ? `${dict.__module__}.${name}` : name;
return self.registerType(identifier, Object.assign(type, dict));
});
this.registerFunction('dill._dill._eval_repr');
this.registerFunction('dill._dill._get_attr', (self, name) => {
Expand Down
2 changes: 1 addition & 1 deletion test/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -4757,7 +4757,7 @@
"target": "dill_custom_class.pkl",
"source": "https://github.com/lutzroeder/netron/files/13035743/dill_custom_class.pkl.zip[dill_custom_class.pkl]",
"format": "Pickle",
"error": "'dill._dill._create_type' not implemented.\nUnknown type name '__builtin__.__main__'.",
"error": "Unknown type name '__builtin__.__main__'.\nUnsupported Pickle type '__main__.CustomClass'.",
"link": "https://github.com/lutzroeder/netron/issues/901"
},
{
Expand Down

0 comments on commit e3c12f7

Please sign in to comment.