You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compiling against master branch fails; error: expected expression SET_DECODE_ERROR #76378
bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (bpo-4667)
Changes:
* _PyPathConfig_Fini() cannot be called in Py_FinalizeEx().
Py_Initialize() and Py_Finalize() can be called multiple times, but
it must not "forget" parameters set by Py_SetProgramName(),
Py_SetPath() or Py_SetPythonHome(), whereas _PyPathConfig_Fini()
clear all these parameters.
* config_get_program_name() and calculate_program_full_path() now
also decode paths using Py_DecodeLocale() to use the
surrogateescape error handler, rather than decoding using
mbstowcs() which is strict.
* Change _Py_CheckPython3() prototype: () => (void)
* Truncate a few lines which were too long
:040000 040000 de4ec929ff3fcd3c6455d8dae4d16e47fdd32ad5 8b289341f1b5e68757ac3b111a7f11808f5de1ec M Include
:040000 040000 ecddc93b37f74818d85f6d8e8ab0e0c57e893c03 c51971a3af2b6f163e625505265277410bb9eedd M Modules
:040000 040000 b92d30ac6375b7dde865a878e701684dd400e742 7d5d8810407060f32c9cbce20dcfc6f9d425524f M PC
:040000 040000 537f9e0e6a27b41178fe7b828a8da99c63cc2d9b b14940c66180023a3704ad3949367db3e82ca832 M Python
I tried to resolve the issue by trying to figure out the syntax for the SET_DECODE_ERROR macro.
I tried to call a function from the macro, and eventually do the checking in that function.
Second way I tried was to replace statement for macro instead of using do-while for placing the if-else clause.
I was stuck at the issue that at the point when the compiler tries to replace the macro with actual code, pymain wasn't defined.
If someone could provide a pointer on this, it would be really helpful and I'll try to work on a patch.
One simplest possible solution would be not use macro and simply use the code at the 3 places where it is being used. But I'll defer this anti-DRY approach if we can have a better solution.
Oh sorry, I missed the macOS failure and I wasn't available last week-end for quickly fix it. So thanks Serhiy for the revert ;-) I reapplied my changes with the following fix. test_embed randomly failed, but it's unrelated (I was able to reproduce the bug on master, with the revert): https://bugs.python.org/issue20891#msg307550
Activity
CuriousLearner commentedon Dec 2, 2017
The current master branch at commit af5a895
fails while building the interpreter.
The following is the traceback while running
makeafter./configure --with-pydebuggcc -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -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:904:20: error: expected expression
return SET_DECODE_ERROR("PYTHONEXECUTABLE environment "
^
Modules/main.c:46:5: note: expanded from macro 'SET_DECODE_ERROR'
do { \
^
1 error generated.
make: *** [Modules/main.o] Error 1
CuriousLearner commentedon Dec 2, 2017
I used git bisect to track down the commit that broke the build.
Seems like this is the SHA: ebac19d
ebac19d is the first bad commit
commit ebac19d
Author: Victor Stinner <victor.stinner@gmail.com>
Date: Fri Dec 1 20:09:52 2017 +0100
:040000 040000 de4ec929ff3fcd3c6455d8dae4d16e47fdd32ad5 8b289341f1b5e68757ac3b111a7f11808f5de1ec M Include
:040000 040000 ecddc93b37f74818d85f6d8e8ab0e0c57e893c03 c51971a3af2b6f163e625505265277410bb9eedd M Modules
:040000 040000 b92d30ac6375b7dde865a878e701684dd400e742 7d5d8810407060f32c9cbce20dcfc6f9d425524f M PC
:040000 040000 537f9e0e6a27b41178fe7b828a8da99c63cc2d9b b14940c66180023a3704ad3949367db3e82ca832 M Python
CuriousLearner commentedon Dec 2, 2017
I tried to resolve the issue by trying to figure out the syntax for the SET_DECODE_ERROR macro.
I tried to call a function from the macro, and eventually do the checking in that function.
Second way I tried was to replace statement for macro instead of using do-while for placing the if-else clause.
I was stuck at the issue that at the point when the compiler tries to replace the macro with actual code,
pymainwasn't defined.If someone could provide a pointer on this, it would be really helpful and I'll try to work on a patch.
One simplest possible solution would be not use macro and simply use the code at the 3 places where it is being used. But I'll defer this anti-DRY approach if we can have a better solution.
CuriousLearner commentedon Dec 2, 2017
Even a simple use of ternary operator instead of using if-else inside do-while to handle the macro like:
, 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.
serhiy-storchaka commentedon Dec 2, 2017
New changeset 13badcb by Serhiy Storchaka in branch 'master':
bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (bpo-4681)
13badcb
vstinner commentedon Dec 4, 2017
New changeset 31a8393 by Victor Stinner in branch 'master':
Revert "bpo-32197: Try to fix a compiler error on OS X introduced in bpo-32030. (bpo-4681)" (bpo-4694)
31a8393
vstinner commentedon Dec 4, 2017
Oh sorry, I missed the macOS failure and I wasn't available last week-end for quickly fix it. So thanks Serhiy for the revert ;-) I reapplied my changes with the following fix. test_embed randomly failed, but it's unrelated (I was able to reproduce the bug on master, with the revert):
https://bugs.python.org/issue20891#msg307550
The fix:
vstinner commentedon Dec 4, 2017
I tested manually that compilation and tests succeed on macOS.
CuriousLearner commentedon Dec 4, 2017
Hey Victor, thanks for the update.
I was confused about how the macro was replaced in the previous version.