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

Outdated usage str.encode('rot-13') in rot13 codec #65370

Closed
Pix mannequin opened this issue Apr 7, 2014 · 5 comments
Closed

Outdated usage str.encode('rot-13') in rot13 codec #65370

Pix mannequin opened this issue Apr 7, 2014 · 5 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@Pix
Copy link
Mannequin

Pix mannequin commented Apr 7, 2014

BPO 21171
Nosy @malemburg, @terryjreedy, @ncoghlan, @pitrou, @vstinner, @benjaminp, @ezio-melotti, @merwok, @berkerpeksag, @serhiy-storchaka
Files
  • issue21171.diff
  • 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 = None
    closed_at = <Date 2014-04-17.03:33:28.319>
    created_at = <Date 2014-04-07.16:25:51.849>
    labels = ['type-bug', 'library']
    title = "Outdated usage str.encode('rot-13') in rot13 codec"
    updated_at = <Date 2014-04-17.03:33:28.318>
    user = 'https://bugs.python.org/Pix'

    bugs.python.org fields:

    activity = <Date 2014-04-17.03:33:28.318>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-04-17.03:33:28.319>
    closer = 'benjamin.peterson'
    components = ['Library (Lib)']
    creation = <Date 2014-04-07.16:25:51.849>
    creator = 'Pix'
    dependencies = []
    files = ['34757']
    hgrepos = []
    issue_num = 21171
    keywords = ['patch']
    message_count = 5.0
    messages = ['215712', '215733', '215944', '216005', '216017']
    nosy_count = 12.0
    nosy_names = ['lemburg', 'terry.reedy', 'ncoghlan', 'pitrou', 'vstinner', 'benjamin.peterson', 'ezio.melotti', 'eric.araujo', 'python-dev', 'berker.peksag', 'serhiy.storchaka', 'Pix']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue21171'
    versions = ['Python 3.4', 'Python 3.5']

    @Pix
    Copy link
    Mannequin Author

    Pix mannequin commented Apr 7, 2014

    Function rot13 in file "encodings/rot_13.py" throws exception:

    LookupError: 'rot-13' is not a text encoding; use codecs.encode() to handle arbitrary codecs

    @Pix Pix mannequin added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Apr 7, 2014
    @berkerpeksag
    Copy link
    Member

    Here's a patch. I tested it with the following command:

        $ cat LICENSE | ./python -m encodings.rot_13

    @berkerpeksag berkerpeksag added type-bug An unexpected behavior, bug, or error and removed type-feature A feature request or enhancement labels Apr 8, 2014
    @terryjreedy
    Copy link
    Member

    Since rot_13 is a transcoder, not an encoder, the error message is correct, as is the fix for the function. However, since neither the module encodings.rot_13 nor the rot13 function in the module are documented, (not even in 2.7), I wonder if the function and the if __name__; clause are ancient holdovers that should be removed. In other words, I am not sure if Berker's test is currently a supported usage. I remember that there was some discussion on pydev about how much to add back but not the details.

    @serhiy-storchaka
    Copy link
    Member

    LGTM.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 13, 2014

    New changeset a81f0caab279 by Serhiy Storchaka in branch '3.4':
    Issue bpo-21171: Fixed undocumented filter API of the rot13 codec.
    http://hg.python.org/cpython/rev/a81f0caab279

    New changeset f86504da2fcc by Serhiy Storchaka in branch 'default':
    Issue bpo-21171: Fixed undocumented filter API of the rot13 codec.
    http://hg.python.org/cpython/rev/f86504da2fcc

    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants