exception handling for rare string bug in Py3 shell.py module