This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Depreciated MACRO of copysign for MSVC
Type: compile error Stage: resolved
Components: C API, Windows Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: ejguan, miss-islington, paul.moore, ronaldoussoren, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2020-10-22 19:08 by ejguan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23326 merged steve.dower, 2020-11-16 22:42
PR 23330 merged miss-islington, 2020-11-16 23:22
PR 23331 merged miss-islington, 2020-11-16 23:23
Messages (7)
msg379323 - (view) Author: Erjia Guan (ejguan) Date: 2020-10-22 19:08
At
https://github.com/python/cpython/blob/c60394c7fc9cc09b16e9675a3eeb5844b6d8523f/PC/pyconfig.h#L196, the MACRO converts copysign to _copysign. This MACRO is defined 13 years ago and it's really dangerous to define a lower-letter MACRO at this low level.
Currently, MSVC is supporting copysign (https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/copysign-copysignf-copysignl-copysign-copysignf-copysignl?view=vs-2019).
I am requesting to remove this MACRO, as my customized copysign API will also be converted to _copysign on MSVC platform.
msg379325 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-10-22 19:30
Sounds good, but I don't think we can backport it. It's not _our_ public API, but it's still going to impact compiling modules.

Also, looking at the docs link above, copysign() is for floats and _copysign() is for doubles, which means it's an actual functional change. If POSIX/libc copysign() is floats, it's probably fine for a 3.10 change, but if we need to preserve the type then it needs to become _Py_copysign throughout.
msg379570 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-25 10:12
The standard is for copysign to work on doubles, with copysignf as the same functionality for floats.


https://en.cppreference.com/w/c/numeric/math/copysign
msg381174 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-11-16 22:44
Turns out a straight delete is fine, as both names are defined in UCRT. I think it's safe to backport as well, since it's only going to affect other people's code poorly (and they'll need to recompile to see any change anyway).
msg381181 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-11-16 23:22
New changeset 9cc9e277254023c0ca08e1a9e379fd89475ca9c2 by Steve Dower in branch 'master':
bpo-42120: Remove macro defining copysign to _copysign on Windows (GH-23326)
https://github.com/python/cpython/commit/9cc9e277254023c0ca08e1a9e379fd89475ca9c2
msg381186 - (view) Author: miss-islington (miss-islington) Date: 2020-11-16 23:42
New changeset 4f54ca07341c656b763c8c71a051f7f86a2a256c by Miss Islington (bot) in branch '3.8':
bpo-42120: Remove macro defining copysign to _copysign on Windows (GH-23326)
https://github.com/python/cpython/commit/4f54ca07341c656b763c8c71a051f7f86a2a256c
msg381217 - (view) Author: miss-islington (miss-islington) Date: 2020-11-17 07:50
New changeset 2c38e49dba88a39679b2182ca3f5f478d3a3f647 by Miss Islington (bot) in branch '3.9':
[3.9] bpo-42120: Remove macro defining copysign to _copysign on Windows (GH-23326) (GH-23331)
https://github.com/python/cpython/commit/2c38e49dba88a39679b2182ca3f5f478d3a3f647
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86286
2020-11-21 01:10:32steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-11-17 07:50:52miss-islingtonsetmessages: + msg381217
2020-11-16 23:42:57miss-islingtonsetmessages: + msg381186
2020-11-16 23:23:45miss-islingtonsetpull_requests: + pull_request22219
2020-11-16 23:22:58miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request22218
2020-11-16 23:22:50steve.dowersetmessages: + msg381181
2020-11-16 22:44:01steve.dowersetassignee: steve.dower
messages: + msg381174
versions: + Python 3.8, Python 3.9
2020-11-16 22:42:27steve.dowersetkeywords: + patch
stage: patch review
pull_requests: + pull_request22216
2020-10-25 10:12:48ronaldoussorensetnosy: + ronaldoussoren
messages: + msg379570
2020-10-22 19:30:37steve.dowersetmessages: + msg379325
versions: - Python 3.8, Python 3.9
2020-10-22 19:22:25zach.waresetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
components: + Windows
2020-10-22 19:09:58ejguansetversions: + Python 3.9, Python 3.10
2020-10-22 19:08:50ejguancreate