gh-154874: Fix the sign of curses.termattrs() - #154875
Open
fedonman wants to merge 1 commit into
Open
Conversation
termattrs() returns a chtype mask, but it was routed through an int, so a terminal that advertises A_ITALIC came back negative and the result could no longer be passed to the attribute functions.
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.
termattrs()returns achtypemask, but GH-134327 routed it through anintto checkfor
ERR. On a terminal that advertisesA_ITALIC, the topmost bit of a 32-bit mask,the result comes back negative and the attribute functions reject it:
It now returns the mask unsigned, the same way
getattrs(),slk_attr()andterm_attrs()already do.baudrate(), the macro's only other user, really does returna status, so it keeps the
ERRcheck.The test drives
newterm('xterm-256color')over a pseudo-terminal rather than using$TERM, which on CI is usuallylinuxand advertises no italic, so a signed resultwould slip through. It fails without the change.
3.15 has the same bug, so this needs a backport. 3.14 is fine.