Michael Sander <michael.san...@gmail.com> added the comment:

Couldn't this be fixed in a backwards compatible way by clearing the cache when 
this type of error occurs? We can do this by wrapping the offending line with a 
try/except, then checking to see if the cache is corrupted. If it is, then we 
clear the cache and try again.

try:
  if not s.rstrip(safe):
    return s
except UnicodeDecodeError:
  # Make sure the cache is okay, if not, try again.
  if any([not isinstance(s2, str) for q2, s2 in _safe_quoters.values()])
    # Cache is corrupted, clear it and try again.
     _safe_quoters = {}
    # Recursive call to try again
    return quote(s, safe)
  raise

----------
nosy: +Michael Sander

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue23885>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to