Repository navigation
Fix remaining stubtest errors - #791
Merged
Merged
Conversation
Owner
|
Awesome!! 🎉🎉🎉 We should leave SIGUSR1 and SIGUSR2. It's strange that stubtest was complaining about those, since they should be like the other signals. Otherwise this looks great 🙌 |
Contributor
Author
|
Hmm, I think that's a runtime bug then: >>> import sh
>>> sh.SignalException_SIGKILL
<class 'sh.SignalException_SIGKILL'>
>>> sh.SignalException_SIGUSR1Traceback (most recent call last):
File "/home/joren/Workspace/sh/src/sh/__init__.py", line 390, in get_exc_from_name
return rc_exc_cache[name]
~~~~~~~~~~~~^^^^^^
KeyError: 'SignalException_SIGUSR1'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/joren/Workspace/sh/src/sh/__init__.py", line 399, in get_exc_from_name
rc = -int(rc_or_sig_name)
~~~^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'SIGUSR'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
sh.SignalException_SIGUSR1
File "/home/joren/Workspace/sh/src/sh/__init__.py", line 3742, in __getattr__
return self.__env[name]
~~~~~~~~~~^^^^^^
File "/home/joren/Workspace/sh/src/sh/__init__.py", line 3487, in __getitem__
exc = get_exc_from_name(k)
File "/home/joren/Workspace/sh/src/sh/__init__.py", line 401, in get_exc_from_name
rc = -getattr(signal, rc_or_sig_name)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'signal' has no attribute 'SIGUSR'. Did you mean: 'SIGUSR1'?This seems to be caused by the regex at line 369: Line 369 in 46107ba The |
Copilot AI
added a commit
that referenced
this pull request
Jul 23, 2026
…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.
Owner
|
Ok fixed, you should be good to proceed |
jorenham
force-pushed
the
typing/stubtest-fixes
branch
from
July 23, 2026 20:58
46107ba to
a0b2d5d
Compare
amoffat
approved these changes
Jul 23, 2026
Contributor
Author
|
Thanks, I really appreciate your quick responses :) |
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.
As promised in #790, here's the last PR in the stubtest series, bringing the stubtest errors down to...
(drumroll please)
... 0 🎉!!
Oh, one thing I wasn't really sure about is the removal of
SignalException_SIGUSR1andSignalException_SIGUSR2. Stubtest wanted me to, so I simply did. But I was left wondering whether maybe it was a system-dependent thing that's should stay?Anyway, aftyer this, I plan on working on adding stubtest to the CI pipeline so we can ensure that the stubs stay in sync with the runtime API.