GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — gh-133895: provide C99 Annex F return values for math's functions by skirpichev · Pull Request #135008 · python/cpython Conversation
|
|
See also #134995 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| PyObject *value = PyFloat_FromDouble(x); | ||
|
|
||
| if (value) { | ||
| PyObject_SetAttrString(exc, "value", value); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This call can fail. Should we do something about it? or should we simply ignore the exception? or maybe chain it?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
or should we simply ignore the exception?
I don't see better option so far. (Ditto for cmath.)
BTW, maybe I should also drop if (value) { clause.
or maybe chain it?
I doubt it's appropriate here. We don't handle ValueError here. This code just alter the raised exception object.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
BTW, maybe I should also drop if (value) { clause.
I don't think you should, otherwise PyObject_SetAttrString will be called with an exception set (and with a NULL value it's the same as deleting the attribute)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
will be called with an exception set
Why it's bad in this case?
and with a NULL value it's the same as deleting the attribute
But we are already ignore errors from the PyObject_SetAttrString :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why it's bad in this case?
Don't we have an assert() somewhere that would fail if the error indicator is set?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I failed to find such case.
Though, we could explicitly call (twice) PyErr_Occurred() in appropriate places.
Looking on other cases of using PyErr_GetRaisedException() - I think that unraisable exceptions should be used here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
See cmath's pr, I did such change: #134995. Does it make sense for you?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Bénédikt Tran <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.