exec_file crash on Debug mode (Win 10)
还没有人认领这个 Issue。
评估
调研方向
未指定任何仓库文件或测试。先在所述的 Windows 10、VS2019、VC142、Python 3.10 调试环境中重现崩溃,然后比较使用 PyRun_File 的失败 exec_file 路径与正常工作的 PyRun_SimpleFile 和 _Py_fopen_obj 路径。完成标准是在调试模式下执行 embedding.py,且不再出现报告中的崩溃。
由索引模型根据 Issue 内容生成。
描述
I face a crash on build 1.78 of boost python, on Windows 10, VS2019, VC142, Python 3.10 only on debug mode. Here is the script
#ifdef _DEBUG
#undef _DEBUG
#endif
#define PY_SSIZE_T_CLEAN
#include <Python.h>
int main(int argc, char* argv[])
{
Py_Initialize();
char* f = const_cast<char*>("E:\\Projects\\TestBoostPython\\embedding.py");
PyObject* fo = Py_BuildValue("s", f);
PyObject* fb = Py_None;
PyUnicode_FSConverter(fo, &fb);
char* f_as_uft = PyBytes_AsString(fb);
FILE* fs = fopen(f_as_uft, "r+");
Py_DECREF(fo);
Py_DECREF(fb);
PyObject* result = PyRun_File(fs,
f,
Py_file_input,
nullptr, nullptr);
fclose(fs);
Py_FinalizeEx();
return 0;
}
which is exactly the exec_file of boost python.
The call stack is
ucrtbase.dll!_invoke_watson() Unknown
ucrtbase.dll!_invalid_parameter() Unknown
ucrtbase.dll!_invalid_parameter_noinfo() Unknown
ucrtbase.dll!_read() Unknown
ucrtbase.dll!common_refill_and_read_nolock<char>() Unknown
ucrtbase.dll!fgetc() Unknown
python310.dll!check_bom(int(*)(tok_state *) get_char, void(*)(int, tok_state *) unget_char, int(*)(tok_state *, const char *) tok, tok_state *) Line 267 C
python310.dll!tok_underflow_file(tok_state * tok) Line 944 C
[Inline Frame] python310.dll!tok_nextc(tok_state *) Line 1042 C
python310.dll!tok_get(tok_state * tok, const char * * p_start, const char * * p_end) Line 1366 C
[Inline Frame] python310.dll!PyTokenizer_Get(tok_state * tok, const char * *) Line 2053 C
python310.dll!_PyPegen_fill_token(Parser * p) Line 745 C
[Inline Frame] python310.dll!_PyPegen_expect_token(Parser *) Line 900 C
[Inline Frame] python310.dll!_tmp_15_rule(Parser *) Line 22816 C
[Inline Frame] python310.dll!_PyPegen_lookahead(int) Line 891 C
python310.dll!compound_stmt_rule(Parser * p) Line 2145 C
[Inline Frame] python310.dll!statement_rule(Parser *) Line 1490 C
[Inline Frame] python310.dll!_loop1_11_rule(Parser *) Line 22574 C
[Inline Frame] python310.dll!statements_rule(Parser *) Line 1446 C
python310.dll!file_rule(Parser * p) Line 957 C
python310.dll!_PyPegen_parse(Parser * p) Line 34511 C
python310.dll!_PyPegen_run_parser(Parser * p) Line 1325 C
[Inline Frame] python310.dll!_PyPegen_run_parser_from_file_pointer(_iobuf *) Line 1423 C
python310.dll!_PyParser_ASTFromFile(_iobuf * fp, _object * filename_ob, const char * enc, int mode, const char * ps1, const char * ps2, PyCompilerFlags * flags, int * errcode, _arena * arena) Line 26 C
python310.dll!pyrun_file(_iobuf * fp, _object * filename, int start, _object * globals, _object * locals, int closeit, PyCompilerFlags * flags) Line 1199 C
python310.dll!PyRun_FileExFlags(_iobuf * fp, const char * filename, int start, _object * globals, _object * locals, int closeit, PyCompilerFlags * flags) Line 1230 C
However the following code runs smoothly on the same environment
#ifdef _DEBUG
#undef _DEBUG
#endif
#define PY_SSIZE_T_CLEAN
#include <Python.h>
int main(int argc, char* argv[])
{
Py_Initialize();
char* f = const_cast<char*>("E:\\Projects\\TestBoostPython\\embedding.py");
PyObject* obj = Py_BuildValue("s", f);
FILE* file = _Py_fopen_obj(obj, "r+");
if (file != NULL) {
PyRun_SimpleFile(file, f);
}
Py_Finalize();
}
- 主要语言
- C++
- 星标
- 537
- 派生
- 223
- 平均合并
- 11 小时 22 分钟
- 30 天内合并 PR
- 2
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
boostorg/python 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 64/100
-
BoostDetectToolset-1.90.0.cmake file not found in an include() call in boost_python-config.cmake 未关闭
难度 3/5 1-2 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 25/100
相似的 Issue
-
AuTest Bug Tests
难度 2/5 1-3 小时 新手友好度 78/100
apache/trafficserver#13714 ·
-
bug build
难度 2/5 1-3 小时 新手友好度 88/100
facebookincubator/velox#19143 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 68/100
tenstorrent/tt-metal#57393 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
objectionary/eo-graphs#74 ·