Use some kind of two-stage initialization as described in #975, by being very cautious about when to allow the GIL to be released.