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

Error in documentation for "compile" built-in function #70589

Closed
RalNezdeArenas mannequin opened this issue Feb 21, 2016 · 10 comments
Closed

Error in documentation for "compile" built-in function #70589

RalNezdeArenas mannequin opened this issue Feb 21, 2016 · 10 comments
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@RalNezdeArenas
Copy link
Mannequin

RalNezdeArenas mannequin commented Feb 21, 2016

BPO 26401
Nosy @berkerpeksag
Files
  • issue26401.diff
  • issue26401_2.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 2016-02-21.20:01:40.741>
    created_at = <Date 2016-02-21.15:35:43.611>
    labels = ['type-feature', 'docs']
    title = 'Error in documentation for "compile" built-in function'
    updated_at = <Date 2016-02-21.20:17:03.760>
    user = 'https://bugs.python.org/RalNezdeArenas'

    bugs.python.org fields:

    activity = <Date 2016-02-21.20:17:03.760>
    actor = 'Ra\xc3\xbal N\xc3\xba\xc3\xb1ez de Arenas'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2016-02-21.20:01:40.741>
    closer = 'berker.peksag'
    components = ['Documentation']
    creation = <Date 2016-02-21.15:35:43.611>
    creator = 'Ra\xc3\xbal N\xc3\xba\xc3\xb1ez de Arenas'
    dependencies = []
    files = ['41985', '41989']
    hgrepos = []
    issue_num = 26401
    keywords = ['patch']
    message_count = 10.0
    messages = ['260613', '260615', '260625', '260626', '260627', '260628', '260630', '260634', '260635', '260637']
    nosy_count = 5.0
    nosy_names = ['SilentGhost', 'docs@python', 'python-dev', 'berker.peksag', 'Ra\xc3\xbal N\xc3\xba\xc3\xb1ez de Arenas']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue26401'
    versions = ['Python 3.5', 'Python 3.6']

    @RalNezdeArenas
    Copy link
    Mannequin Author

    RalNezdeArenas mannequin commented Feb 21, 2016

    According to the documentation, if the 'compile' built-in function encounters NUL bytes in the compiled source, it raises TypeError, but this is not true:

    >>> source = '\u0000'
    >>> compile(source, '', 'single')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: source code string cannot contain null bytes

    It raises ValueError, not TypeError. And IMHO, it's the proper exception to raise...

    @RalNezdeArenas RalNezdeArenas mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Feb 21, 2016
    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Feb 21, 2016

    Here is the patch.

    @berkerpeksag
    Copy link
    Member

    It would be good to add a versionchanged note. Something like:

    .. versionchanged:: 3.5
    Previously, a :exc:`TypeError` was raised [...]

    @RalNezdeArenas
    Copy link
    Mannequin Author

    RalNezdeArenas mannequin commented Feb 21, 2016

    I checked the sources at github and the change was introduced back in 2010, if I recall correctly, so maybe this change happened in 3.2? I can check again and try to determine the exact date and if at all possible the version.

    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Feb 21, 2016

    TypeError is raised in 3.4

    @RalNezdeArenas
    Copy link
    Mannequin Author

    RalNezdeArenas mannequin commented Feb 21, 2016

    I checked the Mercurial repository directly, and the change was introduced in 2014: http://bugs.python.org/issue22215

    So, yes, looks like a 3.5 change and the versionchanged note suggested by Berker is a great idea!

    @SilentGhost
    Copy link
    Mannequin

    SilentGhost mannequin commented Feb 21, 2016

    Updated patch.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 21, 2016

    New changeset 0cfac9efd895 by Berker Peksag in branch '3.5':
    Issue bpo-26401: Fix compile() documentation
    https://hg.python.org/cpython/rev/0cfac9efd895

    New changeset 45cf82f424ce by Berker Peksag in branch 'default':
    Issue bpo-26401: Fix compile() documentation
    https://hg.python.org/cpython/rev/45cf82f424ce

    @berkerpeksag
    Copy link
    Member

    Thanks!

    @RalNezdeArenas
    Copy link
    Mannequin Author

    RalNezdeArenas mannequin commented Feb 21, 2016

    Thanks to you, Berker, and SilentGhost, for applying and preparing the patch!

    @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
    docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant