[issue24012] Add error checks to PyInit_pyexpat()

2021-12-11 Thread Irit Katriel


Irit Katriel  added the comment:

This is all sorted now:

iritkatriel@Irits-MBP cpython % grep "PyModule_AddObject(" Modules/pyexpat.c 
if (PyModule_AddObject(mod, name, submodule) < 0) {
if (PyModule_AddObject(errors_module, "codes", codes_dict) < 0) {
if (PyModule_AddObject(errors_module, "messages", rev_codes_dict) < 0) {
if (PyModule_AddObject(mod, "features", list) < 0) {
if (PyModule_AddObject(mod, "version_info", versionInfo) < 0) {
if (PyModule_AddObject(mod, "expat_CAPI", capi_object) < 0) {
iritkatriel@Irits-MBP cpython % grep "PyDict_SetItem(" Modules/pyexpat.c
PyDict_SetItem(self->intern, result, result) == 0)
else if (PyDict_SetItem(container, n, v)) {
int res = PyDict_SetItem(rev_codes_dict, num, str);
iritkatriel@Irits-MBP cpython % grep "PySys_GetObject(" Modules/pyexpat.c
iritkatriel@Irits-MBP cpython %

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue24012] Add error checks to PyInit_pyexpat()

2018-08-17 Thread Berker Peksag


Berker Peksag  added the comment:

Some parts of the patch have already been applied into master:

* PySys_GetObject(): 
https://github.com/python/cpython/commit/7a5457b6878db61910c81017d10579edb7c91512

* PyDict_SetItem(): 
https://github.com/python/cpython/commit/3f9eee6eb4b25fe1926eaa5f00e02344b126f54d#diff-cc8b737f9996c36521d5b9db5ea1a032

The only remaining part is about PyModule_AddObject(), but there are already 
many usages of PyModule_AddObject() without doing any error checking, so I 
suggest closing this as 'outdated'.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue24012] Add error checks to PyInit_pyexpat()

2015-04-19 Thread Christian Heimes

New submission from Christian Heimes:

Similar to #24011 and #24010 the pyexpat module's init function fails to check 
some return values for NULL. The patch doesn't include proper reference 
cleanups as most of the other parts of PyInit_pyexpat() don't cleanup on error, 
too.

CID 982779 (#2 of 2): Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a pointer that might be null sys_modules when 
calling PyDict_SetItem

CID 982240 (#2 of 2): Unchecked return value (CHECKED_RETURN)
check_return: Calling PyDict_SetItem without checking return value (as is done 
elsewhere 158 out of 174 times)

--
components: Extension Modules
files: pyexpat.patch
keywords: patch
messages: 241555
nosy: christian.heimes, eli.bendersky, scoder
priority: normal
severity: normal
stage: patch review
status: open
title: Add error checks to PyInit_pyexpat()
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file39129/pyexpat.patch

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