Issue #18647: Temporary disable the "nothing to repeat" check to make buildbots happy.
Issue #13612: Fix a buffer overflow in case of a multi-byte encoding.

This is a belated backport of f7b47fb30169; Patch by Serhiy Storchaka.
Issue #18151: Replace remaining Idle 'open...close' pairs with 'with open'.