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: Allow python 2.7 to compile with Visual Studio 2013
Type: compile error Stage: resolved
Components: Windows Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zach.ware Nosy List: Zachary.Turner, python-dev, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2014-07-11 17:20 by Zachary.Turner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python.patch Zachary.Turner, 2014-07-11 17:19 Patch review
Messages (6)
msg222766 - (view) Author: Zachary Turner (Zachary.Turner) Date: 2014-07-11 17:19
VS2013 and beyond implement C99 math functions.  Of interest to Python is the function round().  Python conditionally provides its own implementation of round() based on whether or not HAVE_ROUND is defined, but in no case is HAVE_ROUND ever defined.  This leads to a huge spew of warnings when compiling with VS2013, and presumably it also leads to undefined behavior.

The attached patch conditionally defines HAVE_ROUND based on _MSC_VER, and additionally provides a VS2013 port in the form of a set of native VS2013 solution and project files.

This patch is based against tip of 2.7 release branch.  The same fix may or may not still be needed in 3.x
msg222802 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2014-07-11 22:13
The fix is certainly needed in default, though I already have it in my fork for porting to VC14.

I'm okay with the HAVE_ROUND change, but I think the VS2013 project files are better off kept separate. We won't be rebuilding 2.x with a newer compiler, so they don't belong in hg.python.org.
msg222807 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-07-11 22:29
Agreed.
msg222821 - (view) Author: Zachary Turner (Zachary.Turner) Date: 2014-07-12 02:16
That's fine with me, the HAVE_ROUND is the important change anyway.  Do I need to re-upload a new patch, or are you able to just delete the VS2013 project files portion of the patch and apply the HAVE_ROUND portion?  And do I push the patch myself or does someone need to push it on my behalf?

Thanks
msg223990 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-07-25 19:48
New changeset cb2e1b3a395f by Zachary Ware in branch '2.7':
Issue #21958: Define HAVE_ROUND when building with VS 2013 and above.
http://hg.python.org/cpython/rev/cb2e1b3a395f

New changeset 1c35cefd25b7 by Zachary Ware in branch '3.4':
Issue #21958: Define HAVE_ROUND when building with VS 2013 and above.
http://hg.python.org/cpython/rev/1c35cefd25b7

New changeset 1f5e8380f791 by Zachary Ware in branch 'default':
Issue #21958: Merge with 3.4
http://hg.python.org/cpython/rev/1f5e8380f791
msg223991 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-07-25 19:57
Thanks for the patch, I've committed it.  For future reference, the devguide should answer any questions you may have about how to contribute to Python, or you can ask on any of the various mailing lists (where you'll either get an answer or be pointed to a list better suited to the question).  In this particular case, I just removed the VS2013 build files myself, and only particular people (those with a Python logo next to their name on the tracker, like myself or Steve) are allowed to push to hg.python.org.

Also, if you haven't already, please take a moment to sign a contributor agreement (https://www.python.org/psf/contrib/).  In this case, the patch was fairly trivial and almost a direct copy from elsewhere in the source tree, so I went ahead and pushed it.  For larger or more involved patches, the PSF will require a contributor agreement to be on file before your patch can be accepted.

Thanks again for your contribution!
History
Date User Action Args
2022-04-11 14:58:05adminsetgithub: 66157
2014-07-25 19:57:03zach.waresetstatus: open -> closed
versions: + Python 3.4, Python 3.5
messages: + msg223991

assignee: zach.ware
resolution: fixed
stage: resolved
2014-07-25 19:48:47python-devsetnosy: + python-dev
messages: + msg223990
2014-07-12 02:16:23Zachary.Turnersetmessages: + msg222821
2014-07-11 22:29:22zach.waresetmessages: + msg222807
2014-07-11 22:13:04steve.dowersetnosy: + tim.golden, zach.ware
messages: + msg222802
2014-07-11 17:20:04Zachary.Turnercreate