Repository navigation
Fix AttributeError when accessing sh.SignalException_SIGUSR1 / SIGUSR2 - #792
Merged
amoffat merged 2 commits intoJul 23, 2026
Merged
Conversation
…ion_SIGUSR2 The regex `rc_exc_regex` used `SIG[a-zA-Z]+` which does not match digit suffixes. Signal names like SIGUSR1/SIGUSR2 were truncated to "SIGUSR", causing `getattr(signal, 'SIGUSR')` to raise an AttributeError. Extend the character class to `SIG[a-zA-Z0-9]+` so the full name is captured, and add a regression test. References #791.
Copilot
AI
changed the title
[WIP] Fix access exception for sh.SignalException_SIGUSR1 and SIGUSR2
Fix AttributeError when accessing sh.SignalException_SIGUSR1 / SIGUSR2
Jul 23, 2026
amoffat
approved these changes
Jul 23, 2026
amoffat
marked this pull request as ready for review
July 23, 2026 20:55
amoffat
deleted the
copilot/fix-access-exception-signalexception-sigusr1-sigus
branch
July 23, 2026 20:55
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.
Accessing
sh.SignalException_SIGUSR1orsh.SignalException_SIGUSR2raised anAttributeErrorbecause the regex used to parse exception names (SIG[a-zA-Z]+) rejected digit suffixes, truncatingSIGUSR1→SIGUSRbefore thegetattr(signal, ...)lookup.Changes
src/sh/__init__.py: Extendrc_exc_regexcharacter class fromSIG[a-zA-Z]+toSIG[a-zA-Z0-9]+, allowing digit-suffixed signal names to match in full.tests/sh_test.py: Addtest_signal_exception_sigusrregression test asserting bothSignalException_SIGUSR1andSignalException_SIGUSR2are accessible and are subclasses ofSignalException.References #791, which removed these names from the stubs to work around the runtime crash rather than fixing it.