Under Python3, librosie can hang or abort during GC
The Python 3.6 garbage collector will try to free rplx objects (compiled patterns) after already freeing the engine they depend upon. A race condition occurs in librosie because each engine is protected by a mutex. Depending on the race, either librosie hangs waiting to access a destroyed engine (so that it can free an rplx for that engine) OR librosie aborts because the lock protecting that engine has been destroyed.
One solution is to have an engine pool in librosie, but I would prefer to see that in client code, and only when needed.
Another solution is to be sure that the rplx object in Python contains a reference to its engine, so that the engine cannot be destroyed until after the rplx objects have been destroyed.