Skip to content
Myr

Fixed unicode behavior for exceptions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent ebcbef9 · Browse files · 2 files+12 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−3 removed

  • other:+12 added−3 removed

2 files+12 added−3 removed

modified:click/exceptions.py+9 added-3 removed
7 unmodified lines
8 #: The exit code for this exception9 exit_code = 11011 def __init__(self, message):12 if PY2:13 if message is not None:14 message = message.encode('utf-8')12 Exception.__init__(self, message)13 self.message = message1415 def format_message(self):16 return self.message1718 def __str__(self):19 return self.message2021 if PY2:22 __unicode__ = __str__2324 def __str__(self):25 return self.message.encode('utf-8')2627 def show(self, file=None):28 if file is None:29 file = get_text_stderr()30 echo('Error: %s' % self.format_message(), file=file)
177 unmodified lines
modified:CHANGES+3 added
12 unmodified lines
13- Fix bug in test runner when calling ``sys.exit`` with ``None``. See #739.14- Fix crash on Windows console, see #744.15- Fix bashcompletion on chained commands. See #754.16- Fix option naming routine to match documentation. See #79317- Fixed the behavior of click error messages with regards to unicode on 2.x18 and 3.x respectively. Message is now always unicode and the str and unicode19 special methods work as you expect on that platform.2021Version 6.722-----------23
343 unmodified lines