New submission from Matt Hickford: 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 ---------- components: Distutils messages: 251724 nosy: Matt.Hickford, dstufft, eric.araujo priority: normal severity: normal status: open title: AttributeError: 'MSVCCompiler' object has no attribute '_MSVCCompiler__version' type: crash versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25250> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com