twisted / twisted/twisted

t.c.i.i.ServerProtocol.selectGraphicRendition doesn't comply with interface

Open
#6,497 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug conch new priority-normal
Dominant language
Python
Stars
6k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
10

Description

twm's avatar @twm reported
Trac ID trac#6497
Type defect
Created 2013-04-29 23:42:48Z

ITerminalTransport.selectGraphicRendition is documented as accepting the constants NORMAL, BOLD, etc. from the same module. However, those constance produce TypeError if passed, as they are ints rather than strings.

It looks like a call to str() is missing in the implementation:

class ServerProtocol(protocol.Protocol):
    [...]

    def selectGraphicRendition(self, *attributes):
        attrs = []
        for a in attributes:
            attrs.append(a)
        self.write('\x1b[%sm' % (';'.join(attrs),))

The copying of attriutes is also a bit silly.

Searchable metadata
trac-id__6497 6497
type__defect defect
reporter__twm twm
priority__normal normal
milestone__ 
branch__ 
branch_author__ 
status__new new
resolution__None None
component__conch conch
keywords__ 
time__1367278968000000 1367278968000000
changetime__1367280549000000 1367280549000000
version__None None
owner__ 
cc__z3p

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ServerProtocol.selectGraphicRendition and compare its argument handling with the ITerminalTransport interface documentation and constants. Verify that passing NORMAL, BOLD, and the other documented constants no longer raises TypeError, while the generated terminal escape sequence remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.