3

I have one cpp file like this:

namespace MyNamespace {
        struct MyStruct {                                                                                                                                        
        std::unordered_set<index> field1;                                                                                                                            
        std::unordered_set<index> field2; 
}

I haven't done any wrapping for MyStruct.

Then in Cython file, I try to access field1 of a MyStruct object (returned by some function, details omitted).

However, Cython automatically converts the struct to dict, which actually evaluates to {} (But I'm not sure why).

So is there a way to disable the conversion temporally?

xiaohan2012
  • 9,870
  • 23
  • 67
  • 101
  • 2
    Please add (some of) the omitted details, so we know what you are trying to achieve. See also [mcve]. – ead Mar 01 '18 at 09:16
  • 1
    Your function is probably returning a Python-object and not MyStruct, but without seeing code it is impossible to tell. – ead Mar 01 '18 at 09:17

0 Answers0