| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 92bb90a commit bb8b1cb
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4106,7 +4106,7 @@ def create_decimal_from_float(self, f): | |||
| 4106 | 4106 | >>> context.create_decimal_from_float(3.1415926535897932) | |
| 4107 | 4107 | Traceback (most recent call last): | |
| 4108 | 4108 | ... | |
| 4109 | - decimal.Inexact | ||
| 4109 | + decimal.Inexact: None | ||
| 4110 | 4110 | ||
| 4111 | 4111 | """ | |
| 4112 | 4112 | d = Decimal.from_float(f) # An exact conversion | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ | |||
| 19 | 19 | test_tb = namedtuple('tb', ['tb_frame', 'tb_lineno', 'tb_next']) | |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | - class SyntaxTracebackCases(unittest.TestCase): | ||
| 22 | + class TracebackCases(unittest.TestCase): | ||
| 23 | 23 | # For now, a very minimal set of tests. I want to be sure that | |
| 24 | 24 | # formatting of SyntaxErrors works based on changes for 2.1. | |
| 25 | 25 | ||
@@ -106,10 +106,6 @@ def __str__(self): | |||
| 106 | 106 | str_name = '.'.join([X.__module__, X.__qualname__]) | |
| 107 | 107 | self.assertEqual(err[0], "%s: %s\n" % (str_name, str_value)) | |
| 108 | 108 | ||
| 109 | - def test_without_exception(self): | ||
| 110 | - err = traceback.format_exception_only(None, None) | ||
| 111 | - self.assertEqual(err, ['None\n']) | ||
| 112 | - | ||
| 113 | 109 | def test_encoded_file(self): | |
| 114 | 110 | # Test that tracebacks are correctly printed for encoded source files: | |
| 115 | 111 | # - correct line number (Issue2384) | |
@@ -456,6 +452,17 @@ def e(): | |||
| 456 | 452 | msg = self.get_report(e).splitlines() | |
| 457 | 453 | self.assertEqual(msg[-2], ' ^') | |
| 458 | 454 | ||
| 455 | + def test_message_none(self): | ||
| 456 | + # A message that looks like "None" should not be treated specially | ||
| 457 | + err = self.get_report(Exception(None)) | ||
| 458 | + self.assertIn('Exception: None\n', err) | ||
| 459 | + err = self.get_report(Exception('None')) | ||
| 460 | + self.assertIn('Exception: None\n', err) | ||
| 461 | + err = self.get_report(Exception()) | ||
| 462 | + self.assertIn('Exception\n', err) | ||
| 463 | + err = self.get_report(Exception('')) | ||
| 464 | + self.assertIn('Exception\n', err) | ||
| 465 | + | ||
| 459 | 466 | ||
| 460 | 467 | class PyExcReportingTests(BaseExceptionReportingTests, unittest.TestCase): | |
| 461 | 468 | # | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -140,7 +140,7 @@ def format_exception_only(etype, value): | |||
| 140 | 140 | ||
| 141 | 141 | def _format_final_exc_line(etype, value): | |
| 142 | 142 | valuestr = _some_str(value) | |
| 143 | - if value == 'None' or value is None or not valuestr: | ||
| 143 | + if value is None or not valuestr: | ||
| 144 | 144 | line = "%s\n" % etype | |
| 145 | 145 | else: | |
| 146 | 146 | line = "%s: %s\n" % (etype, valuestr) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,6 +77,10 @@ Core and Builtins | |||
| 77 | 77 | Library | |
| 78 | 78 | ------- | |
| 79 | 79 | ||
| 80 | + - Issue #27348: In the traceback module, restore the formatting of exception | ||
| 81 | + messages like "Exception: None". This fixes a regression introduced in | ||
| 82 | + 3.5a2. | ||
| 83 | + | ||
| 80 | 84 | - Issue #25651: Allow falsy values to be used for msg parameter of subTest(). | |
| 81 | 85 | ||
| 82 | 86 | - Issue #27932: Prevent memory leak in win32_ver(). | |
| Back | FazBrowse Home | New Git URL |
0 commit comments