Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The reprlib.Repr type should permit the “fillvalue” to be set by the user #83730

Closed
fish2000 mannequin opened this issue Feb 4, 2020 · 2 comments
Closed

The reprlib.Repr type should permit the “fillvalue” to be set by the user #83730

fish2000 mannequin opened this issue Feb 4, 2020 · 2 comments
Assignees
Labels
3.9 only security fixes stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@fish2000
Copy link
Mannequin

fish2000 mannequin commented Feb 4, 2020

BPO 39549
Nosy @rhettinger, @fish2000
PRs
  • bpo-39549: reprlib.Repr uses a “fillvalue” attribute #18343
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/rhettinger'
    closed_at = <Date 2021-09-22.20:46:31.194>
    created_at = <Date 2020-02-04.01:07:30.074>
    labels = ['tests', 'type-bug', 'library', '3.9']
    title = 'The reprlib.Repr type should permit the \xe2\x80\x9cfillvalue\xe2\x80\x9d to be set by the user'
    updated_at = <Date 2021-09-22.20:46:31.194>
    user = 'https://github.com/fish2000'

    bugs.python.org fields:

    activity = <Date 2021-09-22.20:46:31.194>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2021-09-22.20:46:31.194>
    closer = 'rhettinger'
    components = ['Library (Lib)', 'Tests']
    creation = <Date 2020-02-04.01:07:30.074>
    creator = 'fish2000'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39549
    keywords = ['patch']
    message_count = 2.0
    messages = ['361334', '402471']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'fish2000']
    pr_nums = ['18343']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue39549'
    versions = ['Python 3.9']

    @fish2000
    Copy link
    Mannequin Author

    fish2000 mannequin commented Feb 4, 2020

    Currently, the reprlib.recursive_repr(…) decorator allows a “fillvalue” parameter to be specified by the user. This is a string value that is used as a placeholder when calculating an objects’ repr – in the case of recursive_repr(…) the “fillvalue” defaults to '...' and may be set by the user to a string of any length.

    There is no such user-defined “fillvalue” on the reprlib.Repr type, although the '...' string is hardcoded in its implementation and used throughout.

    I propose that the hardcoded use of the '...' string in the code for the reprlib.Repr implementation should be replaced by a “fillvalue” attribute, set on the class in its __init__(…) method – and therefore overridable in subclasses, like the existing myriad “max*” instance attributes.

    PR to follow in short order.

    @fish2000 fish2000 mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir labels Feb 4, 2020
    @csabella csabella removed 3.7 (EOL) end of life 3.8 only security fixes labels Feb 6, 2020
    @rhettinger
    Copy link
    Contributor

    New changeset 8c21941 by Alexander Böhn in branch 'main':
    bpo-39549: reprlib.Repr uses a “fillvalue” attribute (GH-18343)
    8c21941

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants