Andreas Stührk <[email protected]> added the comment:
There are some issues with the patch:
- The check for size of `args` in `ImportError_init()` is wrong: You can't
create an `ImportError` with 3 arguments now ("TypeError: ImportError expected
2 arguments, got 3")
- `ImportError_clear()` doesn't clear ``self->msg``.
- `ImportError_str()` doesn't increase the reference count for ``self->msg``
before returning it.
- The code that raises the exception (Python/import.c) doesn't check for error
return values: All the calls can return NULL which will cause a segfault due to
the uncoditional Py_DECREFs.
- Using `PyUnicode_DecodeASCII()` for the module name is wrong (IMHO), it
should rather be something like `PyUnicode_DecodeUTF8()` as module names can
contain non-ASCII characters in Python 3 and are AFAIK (at least right now)
always encoded using utf-8.
----------
nosy: +Trundle, haypo
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1559549>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com