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

Unclear if exception should be set #54266

Closed
jankratochvil mannequin opened this issue Oct 9, 2010 · 3 comments
Closed

Unclear if exception should be set #54266

jankratochvil mannequin opened this issue Oct 9, 2010 · 3 comments
Labels
docs Documentation in the Doc dir

Comments

@jankratochvil
Copy link
Mannequin

jankratochvil mannequin commented Oct 9, 2010

BPO 10057
Nosy @loewis

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 2010-10-09.18:30:37.293>
created_at = <Date 2010-10-09.18:01:58.958>
labels = ['invalid', 'docs']
title = 'Unclear if exception should be set'
updated_at = <Date 2010-10-09.18:30:37.292>
user = 'https://bugs.python.org/jankratochvil'

bugs.python.org fields:

activity = <Date 2010-10-09.18:30:37.292>
actor = 'jankratochvil'
assignee = 'docs@python'
closed = True
closed_date = <Date 2010-10-09.18:30:37.293>
closer = 'jankratochvil'
components = ['Documentation']
creation = <Date 2010-10-09.18:01:58.958>
creator = 'jankratochvil'
dependencies = []
files = []
hgrepos = []
issue_num = 10057
keywords = []
message_count = 3.0
messages = ['118281', '118282', '118283']
nosy_count = 3.0
nosy_names = ['loewis', 'jankratochvil', 'docs@python']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue10057'
versions = ['Python 3.1', 'Python 2.7']

@jankratochvil
Copy link
Mannequin Author

jankratochvil mannequin commented Oct 9, 2010

http://docs.python.org/py3k/c-api/object.html
PyObject_GetItem
Return element [...] or NULL on failure.

Found element => return its pointer.
Found no element => return NULL (with no exception set).

But it is unclear whether the function can also:
Error happened => return NULL with an exception set.

It affects multiple versions of the doc, did not check which all.

@jankratochvil jankratochvil mannequin assigned docspython Oct 9, 2010
@jankratochvil jankratochvil mannequin added the docs Documentation in the Doc dir label Oct 9, 2010
@loewis
Copy link
Mannequin

loewis mannequin commented Oct 9, 2010

I find it quite clear. "failure" not only means that no item was found, but also that the operation failed, i.e. raised an exception. In general, a NULL pointer returned from a function that returns PyObject* *always* means that there is an exception. There is no need to repeat that every time.

@jankratochvil
Copy link
Mannequin Author

jankratochvil mannequin commented Oct 9, 2010

OK, I am not used to Python, thanks.

@jankratochvil jankratochvil mannequin closed this as completed Oct 9, 2010
@jankratochvil jankratochvil mannequin added the invalid label Oct 9, 2010
@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
Projects
None yet
Development

No branches or pull requests

0 participants