Remove the version checks around add_note() - #170
Open
eda-s-claude-bot[bot] wants to merge 1 commit into
Open
Conversation
…supported Python
'Exception.add_note()' was added in Python 3.11, and this package requires 3.11 or newer
(setup.py: pythonVersions=("3.11", "3.12", "3.13", "3.14")), so 'if version_info >= (3, 11):' is
always true. 36 guards removed, together with the now unused 'from sys import version_info' in two
modules.
'ReportException' also carried a polyfill: under Python <3.11 it declared '__notes__' and implemented
'add_note()' itself. That branch can no longer be taken, so the class is now the plain base-exception
it was meant to be - with the doc-string it never had.
The '# pragma: no cover' markers go with the guards - those lines were never covered, because the
false branch cannot be reached.
Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fixes
All 36
Exception.add_note()call was wrapped inif version_info >= (3, 11):, so the note was attached only onPython 3.11 and newer. This package requires Python 3.11 or newer
(
setup.py:pythonVersions=("3.11", "3.12", "3.13", "3.14")), so the condition is always true and the guard is aleftover from supporting 3.10.
The
# pragma: no covermarkers go with them: those lines were never covered because the false branch cannot bereached, and marking reachable code as uncoverable hides it from the coverage report.
Changes
from sys import version_infois dropped where nothing else used it.ReportExceptionalso carried a polyfill: under Python <3.11 it declared__notes__and implementedadd_note()itself. That branch can no longer be taken, so the class is the plain base-exception it was meant tobe - with the doc-string it never had.
Unit Tests
Related Issues and Pull-Requests
pyTooling(#277),pyEDAA.IPXACTandpyEDAA.ProjectModel, following a review comment inpyTooling#274: "pyTooling is Python 3.11+, so no version check
is required."