[issue42625] Segmentation fault of PyState_AddModule()

2020-12-29 Thread Petr Viktorin
Petr Viktorin added the comment: Thanks, Victor, for explaining! You'll also see NULL checks in existing code where they aren't strictly necessary, but removing them would be too much trouble. -- ___ Python tracker

[issue42625] Segmentation fault of PyState_AddModule()

2020-12-17 Thread hai shi
hai shi added the comment: Thanks victor, petr for your comment and review. I closed this bpo and PR. I paste victor's explanation in here in case other developers have the same question too: Getting a crash is the expected behaviour if you don't respect a function API. Most C functions are d

[issue42625] Segmentation fault of PyState_AddModule()

2020-12-13 Thread hai shi
hai shi added the comment: > When does this actually happen? Is there a common situation where you'd > mistakenly pass NULL to PyState_AddModule? If created mod haven't been checked will have this risk. PyState_AddModule is a exposing C API, we should make sure that calling API is in a safe w

[issue42625] Segmentation fault of PyState_AddModule()

2020-12-12 Thread Petr Viktorin
Petr Viktorin added the comment: When does this actually happen? Is there a common situation where you'd mistakenly pass NULL to PyState_AddModule? -- ___ Python tracker ___

[issue42625] Segmentation fault of PyState_AddModule()

2020-12-12 Thread hai shi
Change by hai shi : -- keywords: +patch pull_requests: +22603 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23745 ___ Python tracker ___

[issue42625] Segmentation fault of PyState_AddModule()

2020-12-12 Thread hai shi
New submission from hai shi : PyState_AddModule(NULL, &_testcapimodule) in _testcapi module will get a segmentation fault. And it's a C API, so a little improvement will be better. -- assignee: shihai1991 components: C API messages: 382915 nosy: petr.viktorin, shihai1991, vstinner prio