Issue #28485: Merge single-threading fix from 3.5 into 3.6