Open gamendez98 opened 4 months ago
I am new here, but what I thing is, that is not an error in Mojo here. I made small changes (StringLiteral and getattr):
fn attribute_accesor[chain_len: Int, *attr_chain: StringLiteral](owned obj :PythonObject) raises -> PythonObject:
let py = Python.import_module('builtins')
for i in range(chain_len):
obj = obj.__getattr__(attr_chain[i])
return obj
and it gives me this: 6409445096646039388 (I do now know what it is :) )
Thanks! @RtyLiu It worked like a charm, I am still confused that it does not fail in compile time since parametrization is supopse to happen then
@RtyLiu Do you know why the fix worked? Do you have some principled explanation as why the original code with py.getattr
didn't work, or you simply tried different things?
Sorry, new here :). Suppose something about PythonObject (wrapper, mojo struct) vs python object. The path from version 0.7 to 1.0 will be not easy.
Bug description
I get a segmentation fault core dumped when I run code that imports a python module. this is the backtrace:
Steps to reproduce
Run the file:
with
mojo spacy_test.mojo
System information