classification
Title: Generate correct error check for PyFloat_AsDouble
Type: behavior Stage: resolved
Components: Argument Clinic Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: larry, rhettinger, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-08-24 19:09 by rhettinger, last changed 2019-08-25 09:41 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 15470 merged rhettinger, 2019-08-24 19:13
PR 15480 merged rhettinger, 2019-08-25 02:25
Messages (5)
msg350395 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-24 19:09
The API for PyFloat_AsDouble() returns -1.0 to indicate an error.  PyErr_Occurred() should only be called if there is a -1.0 return code.  This is the normal practice for those calls and it is a bit faster because it avoids unnecessary external call.
msg350397 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-24 19:18
Note, the argument clinic is already generating code like this for return values in "class double_return_converter".  For example,

    _return_value = _statistics__normal_dist_inv_cdf_impl(module, p, mu, sigma);
    if ((_return_value == -1.0) && PyErr_Occurred()) {
	goto exit;
    }
msg350419 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-25 02:10
New changeset aef9ad82f7f667cd001a7112d3bc636e918626f7 by Raymond Hettinger in branch 'master':
bpo-37942: Improve argument clinic float converter (GH-15470)
https://github.com/python/cpython/commit/aef9ad82f7f667cd001a7112d3bc636e918626f7
msg350422 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-08-25 02:45
New changeset 21161d73d979012ec3b7247261178b3aa1555486 by Raymond Hettinger in branch '3.8':
[3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)
https://github.com/python/cpython/commit/21161d73d979012ec3b7247261178b3aa1555486
msg350443 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-08-25 09:41
How large is benefit from special casing exact floats?
History
Date User Action Args
2019-08-25 09:41:06serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg350443
2019-08-25 02:45:37rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-08-25 02:45:15rhettingersetmessages: + msg350422
2019-08-25 02:25:46rhettingersetpull_requests: + pull_request15166
2019-08-25 02:10:42rhettingersetmessages: + msg350419
2019-08-24 19:18:05rhettingersetmessages: + msg350397
2019-08-24 19:13:30rhettingersetkeywords: + patch
stage: patch review
pull_requests: + pull_request15161
2019-08-24 19:09:51rhettingercreate