Skip to content

[Don't Merge] Debug str repr alternatives#1397

Closed
davidism wants to merge 3 commits intomasterfrom
debug-str-repr
Closed

[Don't Merge] Debug str repr alternatives#1397
davidism wants to merge 3 commits intomasterfrom
debug-str-repr

Conversation

@davidism
Copy link
Copy Markdown
Member

@davidism davidism commented Nov 16, 2018

This offers two alternatives to #1393. The solution there was to restrict string repr to strictly the string types, excluding subclasses. Making a separate PR for discussion, if we decide on one of these I'll add it to the original PR.

5685cd6 adds "Markup(" as a recognized prefix. The debugger will remove it and not append it, since it will be handled by the subclass info. The downside is that this doesn't really solve the issue, any other string subclasses that have a non-standard repr will still look weird.

screen shot 2018-11-16 at 07 19 01

76320cb takes a different approach. Rather than truncating the obj then taking the repr, it truncates the repr. Then it only adds subclass info if the start of the repr looks like Python's standard repr, with the assumption that a non-standard prefix already distinguishes the subclass.

screen shot 2018-11-16 at 07 18 19

Both options add support for the Python 3 "b" prefix.

@davidism davidism requested a review from ThiefMaster November 16, 2018 15:20
@davidism davidism changed the title Debug str repr alternatives [Don't Merge] Debug str repr alternatives Nov 16, 2018
@davidism davidism removed the request for review from ThiefMaster November 16, 2018 15:31
@davidism davidism closed this Nov 16, 2018
@davidism davidism deleted the debug-str-repr branch November 16, 2018 15:57
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants