Update to pass under the latest flake8-bugbear - #1432
Merged
Merged
Conversation
sirosen
requested review from
MaxTueckeGlobus,
aaschaer,
ada-globus,
derek-globus,
kurtmckee and
m1yag1
as code owners
September 14, 2026 18:58
This comment was marked as off-topic.
This comment was marked as off-topic.
Primarily, flake8-bugbear flags several of our exceptions as being unsafe to stringify, copy, or pickle because they don't pass args to `super()` in the mandated way. (This is the new B042 rule.) In order to pass, most of these cases are simple to update to define and test explicit `str()` and `copy.copy()` calls. Copy is a simpler operation than pickling and exercises the same reducer. For the target error types, defining custom `__reduce__` methods is sufficient. For `GlobusAPIError`, because it's so key to SDK interfaces, no action is taken for now, other than the addition of a TODO comment. New unit tests exercise str and copy.copy on all of the updated errors.
sirosen
force-pushed
the
pass-latest-bugbear
branch
from
September 14, 2026 19:02
4301466 to
1ec5c3a
Compare
Member
Author
|
I believe the codspeed "improvement" is not real, and is an artifact of some other change (e.g., new machine image from GitHub). I can't see any way that making this change would improve performance of that part of the code. My current working theory is that changing the imports in the exception modules is enough to rejigger the layout of some data in memory and this benchmark is so hypersensitive that it detects the difference. That might point at a potential improvement to benchmarks for the future, but I'm not sure what exactly we should be doing to make this more stable. |
kurtmckee
requested changes
Sep 15, 2026
Co-authored-by: Kurt McKee <contactme@kurtmckee.org>
kurtmckee
approved these changes
Sep 15, 2026
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.
Primarily, flake8-bugbear flags several of our exceptions as being
unsafe to stringify, copy, or pickle because they don't pass args to
super()in the mandated way. (This is the new B042 rule.)In order to pass, most of these cases are simple to update to define and
test explicit
str()andcopy.copy()calls. Copy is a simpleroperation than pickling and exercises the same reducer. For the target
error types, defining custom
__reduce__methods is sufficient.For
GlobusAPIError, because it's so key to SDK interfaces, no actionis taken for now, other than the addition of a TODO comment.
New unit tests exercise str and copy.copy on all of the updated errors.