simplify common type sharing code and fix ref-count inconsistency
avoid risk of stale pointers by looking up Cython types module on each request (shouldn't hurt much to do it a couple of times during module initialisation)
add some safety checks to the shared common types import