python / typed_ast

Modified fork of CPython's ast module that parses `# type:` comments
Other
227 stars 54 forks source link

MSVC 10.0 build failing for ast27/Python/ast.c #121

Closed vladak closed 5 years ago

vladak commented 5 years ago

The MSVC 10.0 compilation of ast27/Python/ast.c seems to have started failing couple of days ago with:

 c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Iast27/Include -IC:\projects\opengrok\opengrok-tools\target\env\include -IC:\Python34\include -IC:\Python34\include /Tcast27/Python/ast.c /Fobuild\temp.win32-3.4\Release\ast27/Python/ast.obj
    ast.c
    ast27/Python/ast.c(303) : error C2275: 'type_ignore_ty' : illegal use of this type as an expression
            ast27/Include\Python-ast.h(36) : see declaration of 'type_ignore_ty'
    ast27/Python/ast.c(303) : error C2146: syntax error : missing ';' before identifier 'ti'
    ast27/Python/ast.c(303) : error C2065: 'ti' : undeclared identifier
    ast27/Python/ast.c(303) : warning C4047: '=' : 'int' differs in levels of indirection from 'type_ignore_ty'
    ast27/Python/ast.c(304) : error C2065: 'ti' : undeclared identifier
    ast27/Python/ast.c(306) : error C2065: 'ti' : undeclared identifier
    ast27/Python/ast.c(306) : warning C4047: '=' : 'void *' differs in levels of indirection from 'int'
    error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2

see https://ci.appveyor.com/api/buildjobs/80p1fa1y6lompwt8/log for full log.

I see a change has been made to the file via #116 some 2 days ago: https://github.com/python/typed_ast/blame/master/ast27/Python/ast.c#L300 and it looks like MSVC C compiler does not like variable declarations in the middle of a block. In this case it is the type_ignore_ty ti definition.

There have been some related fixups in the past like #47 so this seems to be just another case.

Sorry about not providing a fix, this is happening in our AppVeyor build; normally I don't have access to Windows.

ilevkivskyi commented 5 years ago

Python 3.4 is not supported anymore (reached its EoL), is this also relevant for newer versions of Python?

vladak commented 5 years ago

I don't posses the knowledge of he ecosystem - as long as typed_ast can be compiled with MSVC 10 for newer python versions then this problem still applies.

Dne čt 6. 6. 2019 11:51 uživatel Ivan Levkivskyi notifications@github.com napsal:

Python 3.4 is not supported anymore (reached its EoL), is this also relevant for newer versions of Python?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/python/typed_ast/issues/121?email_source=notifications&email_token=AAWMMDEC3LUAZBSNGGY4NWLPZDMYPA5CNFSM4HU7BBLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXCKXUI#issuecomment-499428305, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWMMDANU5ITJ4DT6VFRWODPZDMYPANCNFSM4HU7BBLA .

ethanhs commented 5 years ago

@vladak Python 3.5+ use the newer VS 14.x compiler, so you probably want to use that.

ilevkivskyi commented 5 years ago

Python 3.5+ use the newer VS 14.x compiler

OK, let's close this then.

andy-maier commented 5 years ago

We also ran into this issue, e.g. see this Appveyor log

Python 3.4 was retired just in march this year. Many people are still using it and many packages still define Python 3.4 as a minimum Python version.

For example, this article (also from march this year) describes how to install Python 3.3, 3.4, 3.5, 3.6 into CentOS 7. RHEL 7 and CentOS 7 are still widely used.

It may be an easy way out not to fix this issue just because Python 3.4 is retired, but it is not very user friendly.