Skip to content

Commit 30f943f

Browse files
committed
Replace str(e) with "%s" % e where possible (fixes #501)
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 25c2fe0 commit 30f943f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def process_control_event(self, e):
562562
self.startup()
563563
except IOError as e:
564564
self.status_bar.message(
565-
_('Executing PYTHONSTARTUP failed: %s') % (str(e)))
565+
_('Executing PYTHONSTARTUP failed: %s') % (e, ))
566566

567567
elif isinstance(e, bpythonevents.UndoEvent):
568568
self.undo(n=e.n)
@@ -1532,7 +1532,7 @@ def show_source(self):
15321532
try:
15331533
source = self.get_source_of_current_name()
15341534
except SourceNotFound as e:
1535-
self.status_bar.message(str(e))
1535+
self.status_bar.message('%s' % (e, ))
15361536
else:
15371537
if self.config.highlight_show_source:
15381538
source = format(PythonLexer().get_tokens(source),

bpython/repl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,11 @@ def get_source_of_current_name(self):
545545
obj = self.get_object(line)
546546
return inspection.get_source_unicode(obj)
547547
except (AttributeError, NameError) as e:
548-
msg = _("Cannot get source: %s") % (str(e), )
548+
msg = _(u"Cannot get source: %s") % (e, )
549549
except IOError as e:
550-
msg = str(e)
550+
msg = u"%s" % (e, )
551551
except TypeError as e:
552-
if "built-in" in str(e):
552+
if "built-in" in u"%s" % (e, ):
553553
msg = _("Cannot access source of %r") % (obj, )
554554
else:
555555
msg = _("No source code found for %s") % (self.current_line, )

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy