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

dbm errors should contain file names #78429

Closed
sam-s mannequin opened this issue Jul 27, 2018 · 6 comments
Closed

dbm errors should contain file names #78429

sam-s mannequin opened this issue Jul 27, 2018 · 6 comments
Labels
3.8 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@sam-s
Copy link
Mannequin

sam-s mannequin commented Jul 27, 2018

BPO 34248
Nosy @csernazs, @berkerpeksag, @sam-s
PRs
  • bpo-34248: add filename to DbmError at gdbm_open() #8590
  • Files
  • patch.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 2018-09-27.19:55:04.419>
    created_at = <Date 2018-07-27.13:33:58.279>
    labels = ['extension-modules', 'type-feature', '3.8']
    title = 'dbm errors should contain file names'
    updated_at = <Date 2018-09-27.19:55:04.418>
    user = 'https://github.com/sam-s'

    bugs.python.org fields:

    activity = <Date 2018-09-27.19:55:04.418>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-09-27.19:55:04.419>
    closer = 'berker.peksag'
    components = ['Extension Modules']
    creation = <Date 2018-07-27.13:33:58.279>
    creator = 'sam-s'
    dependencies = []
    files = ['47724']
    hgrepos = []
    issue_num = 34248
    keywords = ['patch']
    message_count = 6.0
    messages = ['322492', '322815', '322816', '322821', '323178', '326590']
    nosy_count = 3.0
    nosy_names = ['csernazs', 'berker.peksag', 'sam-s']
    pr_nums = ['8590']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue34248'
    versions = ['Python 3.8']

    @sam-s
    Copy link
    Mannequin Author

    sam-s mannequin commented Jul 27, 2018

    dbm errors should contain file names when appropriate, just like OSError.
    E.g.:

    >>> open("fooooo")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    FileNotFoundError: [Errno 2] No such file or directory: 'fooooo'
    >>> import dbm.gnu
    >>> dbm.gnu.open("fooooo")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    _gdbm.error: [Errno 2] No such file or directory
    

    the _gdbm.error should report the file name 'fooooo' just like FileNotFoundError does (and exn.args should contain the file name too!)

    @sam-s sam-s mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life extension-modules C modules in the Modules dir labels Jul 27, 2018
    @csernazs
    Copy link
    Mannequin

    csernazs mannequin commented Jul 31, 2018

    I've made a patch which works for me.

    >>> dbm.gnu.open("/tmp/zzzzz")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    _gdbm.error: [Errno 2] No such file or directory: '/tmp/zzzzz'
    >>> 

    Could you please give it a try?

    @sam-s
    Copy link
    Mannequin Author

    sam-s mannequin commented Jul 31, 2018

    thanks for the patch.
    alas, I do not build python myself, so I cannot try it.

    @csernazs
    Copy link
    Mannequin

    csernazs mannequin commented Jul 31, 2018

    Alright, I created a PR for this. We will see if this can be merged to upstream or not.

    @berkerpeksag
    Copy link
    Member

    PR 8590 only changes dbm.gnu. If we do this, we should update dbm.ndbm as well:

    https://github.com/python/cpython/blob/4a745333406a4b9c5b0194bdac4a77d9fadd5457/Modules/_dbmmodule.c#L65
    

    @berkerpeksag berkerpeksag added type-feature A feature request or enhancement and removed 3.7 (EOL) end of life labels Aug 6, 2018
    @berkerpeksag
    Copy link
    Member

    New changeset 9df346b by Berker Peksag (Zsolt Cserna) in branch 'master':
    bpo-34248: Add filename to error raised in {gnu,ndbm}.open() (GH-8590)
    9df346b

    @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.8 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant