classification
Title: pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2019-11-18 14:35 by vstinner, last changed 2019-11-20 11:19 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17228 merged vstinner, 2019-11-18 14:55
PR 17231 merged vstinner, 2019-11-18 15:40
Messages (5)
msg356870 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-18 14:35
The bpo-29137 removed the fpectl module. But two macros were kept in pyfpe.h:

/* These macros used to do something when Python was built with --with-fpectl,
 * but support for that was dropped in 3.7. We continue to define them though,
 * to avoid breaking API users.
 */

#define PyFPE_START_PROTECT(err_string, leave_stmt)
#define PyFPE_END_PROTECT(v)

I propose to exclude them from the stable API. Maybe at least exclude them from the stable API >= 3.9?

commit 735ae8d139a673b30b321dc10acfd3d14f0d633b
Author: Nathaniel J. Smith <njs@pobox.com>
Date:   Fri Jan 5 23:15:34 2018 -0800

    bpo-29137: Remove fpectl module (#4789)
    
    This module has never been enabled by default, never worked correctly
    on x86-64, and caused ABI problems that caused C extension
    compatibility. See bpo-29137 for details/discussion.
msg356871 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-18 14:40
Python/pyfpe.c still contains two variables (PyFPE_jbuf and PyFPE_counter) and one function (PyFPE_dummy) for ABI compatibility:
---
/* These variables used to be used when Python was built with --with-fpectl,
 * but support for that was dropped in 3.7. We continue to define them,
 * though, because they may be referenced by extensions using the stable ABI.
 */

#include "setjmp.h"

jmp_buf PyFPE_jbuf;
int PyFPE_counter;

double
PyFPE_dummy(void *dummy)
{
    return 1.0;
}
---
msg357021 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-20 01:51
New changeset be143ec99674ba38c5811f34cdb85ef39c2dc8f8 by Victor Stinner in branch 'master':
bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)
https://github.com/python/cpython/commit/be143ec99674ba38c5811f34cdb85ef39c2dc8f8
msg357059 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-20 11:17
New changeset 488d02a24142948bfb1fafd19fa48e61fcbbabc5 by Victor Stinner in branch 'master':
bpo-38835: Exclude PyFPE macros from the stable API (GH-17228)
https://github.com/python/cpython/commit/488d02a24142948bfb1fafd19fa48e61fcbbabc5
msg357060 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-20 11:19
Pablo asked on PR 17231:
> Do you want to left the empty macro in Include/pyfpe.h?

https://github.com/python/cpython/pull/17231#pullrequestreview-319366200

I replied:
> If someone wants to remove them, I would suggest to first deprecate them, and wait at least one Python release before removing them. And do that in a separated issue: https://bugs.python.org/issue38835 title is "pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API", it's not directly related :-)

https://github.com/python/cpython/pull/17231#issuecomment-555732122

In short, I'm not interested to remove it right now :-)

The initial issue has been fixed, so I close the issue. Thanks for your review Pablo ;-)
History
Date User Action Args
2019-11-20 11:19:41vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg357060

stage: patch review -> resolved
2019-11-20 11:17:13vstinnersetmessages: + msg357059
2019-11-20 01:51:33vstinnersetmessages: + msg357021
2019-11-18 15:40:21vstinnersetpull_requests: + pull_request16731
2019-11-18 14:55:58vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request16730
2019-11-18 14:40:05vstinnersetmessages: + msg356871
2019-11-18 14:35:51vstinnercreate