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年04月12日 20:58 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1096 | merged | serhiy.storchaka, 2017年04月12日 21:14 | |
| PR 1131 | serhiy.storchaka, 2017年04月17日 09:56 | ||
| PR 1180 | merged | serhiy.storchaka, 2017年04月19日 17:34 | |
| PR 1182 | merged | serhiy.storchaka, 2017年04月19日 18:34 | |
| PR 1183 | merged | serhiy.storchaka, 2017年04月19日 18:48 | |
| Messages (6) | |||
|---|---|---|---|
| msg291573 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年04月12日 20:58 | |
PyObject_Size(), PySequence_Size() and PyMapping_Size() can raise an exception. But not always this is checked after using them. This can lead to a crash. For example: >>> import io >>> class R(io.IOBase): ... def readline(self): return None ... >>> next(R()) Fatal Python error: a function returned a result with an error set TypeError: object of type 'NoneType' has no len() The above exception was the direct cause of the following exception: SystemError: <built-in function next> returned a result with an error set Current thread 0xb749c700 (most recent call first): File "<stdin>", line 1 in <module> |
|||
| msg291642 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年04月14日 07:36 | |
Raymond, could you please look at the change in Objects/setobject.c? It makes the code slightly faster (by avoiding few function calls: PyObject_Size(), PySequence_Size()/PyMapping_Size() and sq_length/mp_length), but the main purpose is making clear that no error check is needed after calling PyObject_Size(). I'm not going to include this change in backports. Xiang suggests larger change that allows to gets rid of one PyDict_CheckExact(). What do you prefer? |
|||
| msg291888 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年04月19日 17:03 | |
New changeset bf623ae8843dc30b28c574bec8d29fc14be59d86 by Serhiy Storchaka in branch 'master': bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096) https://github.com/python/cpython/commit/bf623ae8843dc30b28c574bec8d29fc14be59d86 |
|||
| msg291894 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年04月19日 18:22 | |
New changeset 680fea4067537a9b9c79aadd44a3a19e83cd2dbf by Serhiy Storchaka in branch '3.6': bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (#1096) (#1180) https://github.com/python/cpython/commit/680fea4067537a9b9c79aadd44a3a19e83cd2dbf |
|||
| msg291896 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年04月19日 19:09 | |
New changeset e63af29c87b44bb7ada5783cd0ff6ee6d4f9c17c by Serhiy Storchaka in branch '3.5': [3.5] bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (GH-1096) (GH-1180) (#1182) https://github.com/python/cpython/commit/e63af29c87b44bb7ada5783cd0ff6ee6d4f9c17c |
|||
| msg291898 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年04月19日 19:35 | |
New changeset 64aa4df8502ca5d0a8ffb767ff97f625625c758c by Serhiy Storchaka in branch '2.7': [2.7] bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (GH-1096) (GH-1180) (#1183) https://github.com/python/cpython/commit/64aa4df8502ca5d0a8ffb767ff97f625625c758c |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:45 | admin | set | github: 74247 |
| 2017年04月19日 19:36:45 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2017年04月19日 19:35:01 | serhiy.storchaka | set | messages: + msg291898 |
| 2017年04月19日 19:09:58 | serhiy.storchaka | set | messages: + msg291896 |
| 2017年04月19日 18:48:32 | serhiy.storchaka | set | pull_requests: + pull_request1312 |
| 2017年04月19日 18:34:45 | serhiy.storchaka | set | pull_requests: + pull_request1311 |
| 2017年04月19日 18:22:51 | serhiy.storchaka | set | messages: + msg291894 |
| 2017年04月19日 17:34:01 | serhiy.storchaka | set | pull_requests: + pull_request1308 |
| 2017年04月19日 17:03:54 | serhiy.storchaka | set | messages: + msg291888 |
| 2017年04月19日 15:46:55 | serhiy.storchaka | set | assignee: serhiy.storchaka |
| 2017年04月17日 09:56:09 | serhiy.storchaka | set | pull_requests: + pull_request1294 |
| 2017年04月14日 07:36:29 | serhiy.storchaka | set | nosy:
+ rhettinger messages: + msg291642 |
| 2017年04月14日 05:54:23 | xiang.zhang | set | nosy:
+ xiang.zhang |
| 2017年04月12日 21:15:17 | serhiy.storchaka | set | stage: patch review |
| 2017年04月12日 21:14:54 | serhiy.storchaka | set | pull_requests: + pull_request1239 |
| 2017年04月12日 20:58:52 | serhiy.storchaka | create | |