[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2021-05-26 Thread STINNER Victor
STINNER Victor added the comment: Moreover, graminit.h was removed in Python 3.10. -- ___ Python tracker ___ ___ Python-bugs-list m

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2021-05-26 Thread STINNER Victor
STINNER Victor added the comment: Issue fixed in bpo-43244. I moved the evil public Python-ast.h header file into the internal C API as Include/internal/pycore_ast.h. It doesn't define "Yield" anymore: "_PyAST_Yield" must be used instead. -- resolution: -> duplicate stage: -> reso

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2019-05-14 Thread STINNER Victor
STINNER Victor added the comment: Another common issue with Python-ast.h, I just saw it on Windows: compile.c c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winbase.h(102): warning C4005: 'Yield': macro redefinition [C:\vstinner\python\master\PCbuild\pythoncore .vcxproj]

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread STINNER Victor
STINNER Victor added the comment: > It can be used by the code that works directly with CST instead of AST: (...) Sorry, I don't know this part of CPython. Is the CST exposed in any way outside CPython internals? If no, I see no reason to expose graminit.h in the public C API. -- _

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It can be used by the code that works directly with CST instead of AST: these constants are used as values of the n_type field of the node structure. -- ___ Python tracker __

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: >Do you know if it's used outside CPython? Although not a complete view, all of the mentions I can find in GitHub is in copies of CPython/forks/vendoring of Cpython: https://github.com/search?l=C&p=13&q=graminit.h&type=Code -- __

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread STINNER Victor
STINNER Victor added the comment: > I think it would be better to exclude graminit.h from the set of distributed > headers. It is internal generated file, it should not be used by any user > code. I'm fine with moving it to Include/internal/. Do you know if it's used outside CPython? -

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: graminit.h is included in few files, and not always its inclusion is necessary. Here is a patch that minimizes its inclusion. It is not ready for merging, it is just a demo. -- keywords: +patch Added file: https://bugs.python.org/file47916/include-

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it would be better to exclude graminit.h from the set of distributed headers. It is internal generated file, it should not be used by any user code. Some constants are duplicated as a part of public API in compile.h. -- nosy: +serhiy.storch

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: +pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread STINNER Victor
STINNER Victor added the comment: Current workaround in ast.c: /* This is done here, so defines like "test" don't interfere with AST use above. */ #include "grammar.h" #include "parsetok.h" #include "graminit.h" This code is in the "middle" of ast.c. --

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread STINNER Victor
STINNER Victor added the comment: > Note: "static const int single_input = 305;" cause a complation error on > "case single_input": "case label does not reduce to an integer constant". Ah! A friend gave me another solution, define an enum. Example: enum { single_input = 256, ... };

[issue35197] graminit.h defines very generic names like 'stmt' or 'test'

2018-11-09 Thread STINNER Victor
New submission from STINNER Victor : graminit.h is an header file associating Grammar entities to their values, example: #define stmt 269 Problem: defines symbols have no prefix and cause compilation issues on regular C code depending where graminit.h is included. Example with ast.c: static