[issue32197] Compiling against master branch fails; error: expected expression SET_DECODE_ERROR

Sanyam Khurana report at bugs.python.org
Sat Dec 2 12:58:53 EST 2017


Sanyam Khurana <sanyam.khurana01 at gmail.com> added the comment:

Even a simple use of ternary operator instead of using if-else inside do-while to handle the macro like:

#define SET_DECODE_ERROR(NAME, LEN) \
    pymain->err = ((LEN) == (size_t)-2) \
    ? _Py_INIT_USER_ERR("cannot decode " #NAME) \
    : _Py_INIT_NO_MEMORY()

, throws the error `undeclared identifier pymain`:

gcc -c -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration   -I. -I./Include    -DPy_BUILD_CORE -o Modules/main.o Modules/main.c
Modules/main.c:899:20: error: use of undeclared identifier 'pymain'
            return SET_DECODE_ERROR("PYTHONEXECUTABLE environment "
                   ^
Modules/main.c:46:5: note: expanded from macro 'SET_DECODE_ERROR'
    pymain->err = ((LEN) == (size_t)-2) \
    ^
1 error generated.
make: *** [Modules/main.o] Error 1

I'm still trying to figure out a solution for this.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32197>
_______________________________________


More information about the Python-bugs-list mailing list