[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 designed like that. Only very few functions check their
arguments, tests are usually omitted for best performances.

Sorry for this noisy bpo.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 way(not 
raising a segmentation fault). :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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
priority: normal
severity: normal
status: open
title: Segmentation fault of PyState_AddModule()
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com