diff options
| -rw-r--r-- | .github/workflows/test.yml | 2 | ||||
| -rw-r--r-- | .pre-commit-config.yaml | 2 | ||||
| -rw-r--r-- | CHANGES.rst | 5 | ||||
| -rw-r--r-- | debian/changelog | 8 | ||||
| -rw-r--r-- | debian/control | 2 | ||||
| -rw-r--r-- | pyproject.toml | 6 | ||||
| -rw-r--r-- | src/exceptiongroup/_formatting.py | 2 | ||||
| -rw-r--r-- | tests/test_formatting.py | 38 |
8 files changed, 48 insertions, 17 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aec0aa3..1f6745e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", pypy-3.10] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", pypy-3.10] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e78267..8f9f3c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.7 + rev: v0.5.0 hooks: - id: ruff args: [--fix, --show-fixes] diff --git a/CHANGES.rst b/CHANGES.rst index ea8cbea..a9c19c5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,6 +3,11 @@ Version history This library adheres to `Semantic Versioning 2.0 <http://semver.org/>`_. +**1.2.2** + +- Removed an ``assert`` in ``exceptiongroup._formatting`` that caused compatibility + issues with Sentry (`#123 <https://github.com/agronholm/exceptiongroup/issues/123>`_) + **1.2.1** - Updated the copying of ``__notes__`` to match CPython behavior (PR by CF Bolz-Tereick) diff --git a/debian/changelog b/debian/changelog index 9edd227..e71cebb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-exceptiongroup (1.2.2-1) unstable; urgency=medium + + * Team upload. + * New upstream release. + * Standards-Version: 4.7.0 (no changes required). + + -- Colin Watson <cjwatson@debian.org> Mon, 15 Jul 2024 11:14:53 +0100 + python-exceptiongroup (1.2.1-1) unstable; urgency=medium * Team upload. diff --git a/debian/control b/debian/control index 7d6132b..d676b63 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Build-Depends: python3-all, python3-flit-scm, python3-pytest <!nocheck>, -Standards-Version: 4.6.2 +Standards-Version: 4.7.0 Testsuite: autopkgtest-pkg-pybuild Vcs-Git: https://salsa.debian.org/python-team/packages/python-exceptiongroup.git Vcs-Browser: https://salsa.debian.org/python-team/packages/python-exceptiongroup diff --git a/pyproject.toml b/pyproject.toml index aa47cdc..8416650 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,13 +46,13 @@ local_scheme = "dirty-tag" write_to = "src/exceptiongroup/_version.py" [tool.ruff.lint] -select = [ - "E", "F", "W", # default flake-8 +extend-select = [ "I", # isort "ISC", # flake8-implicit-str-concat "PGH", # pygrep-hooks "RUF100", # unused noqa (yesqa) "UP", # pyupgrade + "W", # pycodestyle warnings ] [tool.ruff.lint.pyupgrade] @@ -87,7 +87,7 @@ warn_unused_ignores = true [tool.tox] legacy_tox_ini = """ [tox] -envlist = py37, py38, py39, py310, py311, py312, pypy3 +envlist = py37, py38, py39, py310, py311, py312, py313, pypy3 labels = typing = py{310,311,312}-typing skip_missing_interpreters = true diff --git a/src/exceptiongroup/_formatting.py b/src/exceptiongroup/_formatting.py index e3835e4..4c52d77 100644 --- a/src/exceptiongroup/_formatting.py +++ b/src/exceptiongroup/_formatting.py @@ -391,8 +391,6 @@ if getattr(sys.excepthook, "__name__", None) in ( import apport_python_hook - assert sys.excepthook is apport_python_hook.apport_excepthook - # monkeypatch the sys module that apport has imported fake_sys = ModuleType("exceptiongroup_fake_sys") fake_sys.__dict__.update(sys.__dict__) diff --git a/tests/test_formatting.py b/tests/test_formatting.py index f6b9bc2..557fcc8 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -64,12 +64,15 @@ def test_exceptionhook(capsys: CaptureFixture) -> None: local_lineno = test_exceptionhook.__code__.co_firstlineno lineno = raise_excgroup.__code__.co_firstlineno module_prefix = "" if sys.version_info >= (3, 11) else "exceptiongroup." + underline_suffix = ( + "" if sys.version_info < (3, 13) else "\n | ~~~~~~~~~~~~~~^^" + ) output = capsys.readouterr().err assert output == ( f"""\ + Exception Group Traceback (most recent call last): | File "{__file__}", line {local_lineno + 2}, in test_exceptionhook - | raise_excgroup() + | raise_excgroup(){underline_suffix} | File "{__file__}", line {lineno + 15}, in raise_excgroup | raise exc | {module_prefix}ExceptionGroup: test message (2 sub-exceptions) @@ -163,13 +166,16 @@ def test_exceptionhook_format_exception_only(capsys: CaptureFixture) -> None: local_lineno = test_exceptionhook_format_exception_only.__code__.co_firstlineno lineno = raise_excgroup.__code__.co_firstlineno module_prefix = "" if sys.version_info >= (3, 11) else "exceptiongroup." + underline_suffix = ( + "" if sys.version_info < (3, 13) else "\n | ~~~~~~~~~~~~~~^^" + ) output = capsys.readouterr().err assert output == ( f"""\ + Exception Group Traceback (most recent call last): | File "{__file__}", line {local_lineno + 2}, in \ test_exceptionhook_format_exception_only - | raise_excgroup() + | raise_excgroup(){underline_suffix} | File "{__file__}", line {lineno + 15}, in raise_excgroup | raise exc | {module_prefix}ExceptionGroup: test message (2 sub-exceptions) @@ -204,13 +210,14 @@ def test_formatting_syntax_error(capsys: CaptureFixture) -> None: underline = "\n ^" lineno = test_formatting_syntax_error.__code__.co_firstlineno + underline_suffix = "" if sys.version_info < (3, 13) else "\n ~~~~^^^^^^^^^^^^" output = capsys.readouterr().err assert output == ( f"""\ Traceback (most recent call last): File "{__file__}", line {lineno + 2}, \ in test_formatting_syntax_error - exec("//serser") + exec("//serser"){underline_suffix} File "<string>", line 1 //serser{underline} SyntaxError: invalid syntax @@ -254,11 +261,14 @@ def test_format_exception( lineno = raise_excgroup.__code__.co_firstlineno assert isinstance(lines, list) module_prefix = "" if sys.version_info >= (3, 11) else "exceptiongroup." + underline_suffix = ( + "" if sys.version_info < (3, 13) else "\n | ~~~~~~~~~~~~~~^^" + ) assert "".join(lines) == ( f"""\ + Exception Group Traceback (most recent call last): | File "{__file__}", line {local_lineno + 25}, in test_format_exception - | raise_excgroup() + | raise_excgroup(){underline_suffix} | File "{__file__}", line {lineno + 15}, in raise_excgroup | raise exc | {module_prefix}ExceptionGroup: test message (2 sub-exceptions) @@ -303,6 +313,10 @@ def test_format_nested(monkeypatch: MonkeyPatch) -> None: except Exception as exc: lines = format_exception(type(exc), exc, exc.__traceback__) + underline_suffix1 = ( + "" if sys.version_info < (3, 13) else "\n ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^" + ) + underline_suffix2 = "" if sys.version_info < (3, 13) else "\n ~~~~~~~~~^^^" local_lineno = test_format_nested.__code__.co_firstlineno + 20 raise_exc_lineno1 = raise_exc.__code__.co_firstlineno + 2 raise_exc_lineno2 = raise_exc.__code__.co_firstlineno + 5 @@ -312,7 +326,7 @@ def test_format_nested(monkeypatch: MonkeyPatch) -> None: f"""\ Traceback (most recent call last): File "{__file__}", line {raise_exc_lineno2}, in raise_exc - raise_exc(max_level, level + 1) + raise_exc(max_level, level + 1){underline_suffix1} File "{__file__}", line {raise_exc_lineno1}, in raise_exc raise Exception(f"LEVEL_{{level}}") Exception: LEVEL_3 @@ -321,7 +335,7 @@ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "{__file__}", line {raise_exc_lineno2}, in raise_exc - raise_exc(max_level, level + 1) + raise_exc(max_level, level + 1){underline_suffix1} File "{__file__}", line {raise_exc_lineno3}, in raise_exc raise Exception(f"LEVEL_{{level}}") Exception: LEVEL_2 @@ -330,7 +344,7 @@ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "{__file__}", line {local_lineno}, in test_format_nested - raise_exc(3) + raise_exc(3){underline_suffix2} File "{__file__}", line {raise_exc_lineno3}, in raise_exc raise Exception(f"LEVEL_{{level}}") Exception: LEVEL_1 @@ -388,12 +402,15 @@ def test_print_exception( local_lineno = test_print_exception.__code__.co_firstlineno lineno = raise_excgroup.__code__.co_firstlineno module_prefix = "" if sys.version_info >= (3, 11) else "exceptiongroup." + underline_suffix = ( + "" if sys.version_info < (3, 13) else "\n | ~~~~~~~~~~~~~~^^" + ) output = capsys.readouterr().err assert output == ( f"""\ + Exception Group Traceback (most recent call last): | File "{__file__}", line {local_lineno + 13}, in test_print_exception - | raise_excgroup() + | raise_excgroup(){underline_suffix} | File "{__file__}", line {lineno + 15}, in raise_excgroup | raise exc | {module_prefix}ExceptionGroup: test message (2 sub-exceptions) @@ -433,12 +450,15 @@ def test_print_exc( local_lineno = test_print_exc.__code__.co_firstlineno lineno = raise_excgroup.__code__.co_firstlineno module_prefix = "" if sys.version_info >= (3, 11) else "exceptiongroup." + underline_suffix = ( + "" if sys.version_info < (3, 13) else "\n | ~~~~~~~~~~~~~~^^" + ) output = capsys.readouterr().err assert output == ( f"""\ + Exception Group Traceback (most recent call last): | File "{__file__}", line {local_lineno + 13}, in test_print_exc - | raise_excgroup() + | raise_excgroup(){underline_suffix} | File "{__file__}", line {lineno + 15}, in raise_excgroup | raise exc | {module_prefix}ExceptionGroup: test message (2 sub-exceptions) |
