This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017年07月31日 19:24 by scoder, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 2963 | merged | scoder, 2017年07月31日 19:24 | |
| Messages (4) | |||
|---|---|---|---|
| msg299579 - (view) | Author: Stefan Behnel (scoder) * (Python committer) | Date: 2017年07月31日 19:24 | |
PyObject *exception, *value, *tb;
PyErr_Fetch(&exception, &value, &tb);
/* PyObject_IsSubclass() can recurse and therefore is
not safe (see test_bad_getattr in test.pickletester). */
res = PyType_IsSubtype((PyTypeObject *)err, (PyTypeObject *)exc);
/* This function must not fail, so print the error here */
if (res == -1) {
PyErr_WriteUnraisable(err);
res = 0;
}
PyErr_Restore(exception, value, tb);
According to the comment, there was previously a call to PyObject_IsSubclass() involved which could fail, but since it was replaced with a call to PyType_IsSubtype(), it can no longer fail.
See pull request.
|
|||
| msg299580 - (view) | Author: Stefan Behnel (scoder) * (Python committer) | Date: 2017年07月31日 19:56 | |
Looks like the switch from PyObject_IsSubclass() to PyType_IsSubtype() was made during the original Py3 development cycle. It should thus be safe to assume that the semantics are "as designed". :) What about applying the patch also to 3.6 and older? |
|||
| msg299584 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年07月31日 20:27 | |
New changeset e4c06bcca358c6dcb6393a75a1589ff6a2d45cde by Serhiy Storchaka (scoder) in branch 'master': bpo-31091: Remove dead code in PyErr_GivenExceptionMatches(). (#2963) https://github.com/python/cpython/commit/e4c06bcca358c6dcb6393a75a1589ff6a2d45cde |
|||
| msg299585 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年07月31日 20:30 | |
This is just a cleaning up. There is no bug in the old code. Usually such kind of changes are not backported. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:49 | admin | set | github: 75274 |
| 2017年07月31日 20:30:21 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg299585 stage: patch review -> resolved |
| 2017年07月31日 20:27:49 | serhiy.storchaka | set | messages: + msg299584 |
| 2017年07月31日 19:56:29 | scoder | set | messages: + msg299580 |
| 2017年07月31日 19:40:21 | serhiy.storchaka | set | nosy:
+ pitrou, serhiy.storchaka stage: patch review |
| 2017年07月31日 19:24:27 | scoder | create | |