Hi, after upgrading cython from 0.20 to 0.22 my c++ code fails to compile. I stripped the problem down to the following code.
cdef extern from "<memory>" namespace "std":
cdef cppclass shared_ptr[T]:
pass
cdef extern from "rocksdb/env.h" namespace "rocksdb":
cdef cppclass Logger:
pass
cdef extern from "rocksdb/options.h" namespace "rocksdb":
cdef cppclass Options:
shared_ptr[Logger] info_log
cdef extern from "rocksdb/db.h" namespace "rocksdb":
cdef cppclass DB:
const Options& GetOptions() nogil except+
cdef doit(DB* db):
cdef shared_ptr[Logger] info_log = db.GetOptions().info_log
Cython 0.22 create then following c++ code
rocksdb::Options __pyx_t_1;
std::shared_ptr<rocksdb::Logger> __pyx_t_2;
/* "problem.cython":19
*
* cdef doit(DB* db):
* cdef shared_ptr[Logger] info_log = db.GetOptions().info_log # <<<<<<<<<<<<<<
*/
try {
__pyx_t_1 = __pyx_v_db->GetOptions();
} catch(...) {/* left out. */}
/* THIS GOES WRONG, because __pyx_t_1 is not a pointer. */
__pyx_t_2 = __pyx_t_1->info_log;
As you can see cython does __pyx_t_1->info_log, however this fails during compilation. __pyx_t_1 is not a pointer ......
Cython 0.20 and 0.21 translate it correctly by using __pyx_t_1.info_log
Regards,
Stephan