Add an assertion for inconsistent StackContexts when used with generators.