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.

Author Matt.Hickford
Recipients Matt.Hickford, dstufft, eric.araujo
Date 2015-09-27.20:24:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443385494.46.0.0275925380659.issue25250@psf.upfronthosting.co.za>
In-reply-to
Content
Hi distutils. I wrote a setup.py that conditions on compiler type, following the guide at [1]. I needed to add an extra include when the compiler is an msvc version older than 9.0 (infamously missing stdint.h [2])

Anyway the code I wrote to do this was:

if self.compiler.compiler_type == "msvc" and int(self.compiler._MSVCCompiler__version) <= 9:

Which worked fine on all Python versions (tested 2.7 through 3.4) UNTIL the recent release of Python 3.5. On Python 3.5 I get the error:

AttributeError: 'MSVCCompiler' object has no attribute '_MSVCCompiler__version'

Oh no. My fault I suppose for relying on a private variable. Can you suggest a more reliable way to test "compiler is msvc <= 9.0"? The test should be compatible all Python versions 2.7 through 3.5 so it can safely go in a setup.py

Can you help?

[1] http://stackoverflow.com/a/5192738/284795
[2] https://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio
History
Date User Action Args
2015-09-27 20:24:54Matt.Hickfordsetrecipients: + Matt.Hickford, eric.araujo, dstufft
2015-09-27 20:24:54Matt.Hickfordsetmessageid: <1443385494.46.0.0275925380659.issue25250@psf.upfronthosting.co.za>
2015-09-27 20:24:54Matt.Hickfordlinkissue25250 messages
2015-09-27 20:24:54Matt.Hickfordcreate