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

bpo-33106: change dbm key deletion error for readonly file from KeyError to dbm.error #6295

Merged
merged 6 commits into from
Dec 12, 2018

Conversation

zhangyangyu
Copy link
Member

@zhangyangyu zhangyangyu commented Mar 28, 2018

@zhangyangyu
Copy link
Member Author

zhangyangyu commented Mar 28, 2018

Something weird is on Mac the manual tells:

The dbm_delete(db, key) function deletes the entry for key. The dbm_delete() function normally returns zero but returns 1 if there was no entry with key in the database or
returns -1 and sets errno if there were any errors.

But it seems not right:

Python 3.6.4 (default, Mar  9 2018, 23:15:03)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbm.ndbm
>>> f = dbm.ndbm.open('abc', 'c')
>>> f[b'key'] = b'value'
>>> f.close()
>>> f = dbm.ndbm.open('abc', 'w')
>>> del f[b'not exist']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: b'not exist'

http://pubs.opengroup.org/onlinepubs/009695399/functions/dbm_delete.html

…gument.

_io.IncrementalNewlineDecoder's initializer possibly assigns out-of-range
value to the bitwise struct field.
@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Dec 9, 2018
@zhangyangyu zhangyangyu merged commit 4fb0b8b into python:master Dec 12, 2018
@bedevere-bot
Copy link

@zhangyangyu: Please replace # with GH- in the commit message next time. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants