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 2014年02月13日 10:44 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg211142 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2014年02月13日 10:44 | |
See this huge warning in the definition of PyDict_GetItem:
/* Note that, for historical reasons, PyDict_GetItem() suppresses all errors
* that may occur (originally dicts supported only string keys, and exceptions
* weren't possible). So, while the original intent was that a NULL return
* meant the key wasn't present, in reality it can mean that, or that an error
* (suppressed) occurred while computing the key's hash, or that some error
* (suppressed) occurred when comparing keys in the dict's internal probe
* sequence. A nasty example of the latter is when a Python-coded comparison
* function hits a stack-depth error, which can cause this to return NULL
* even if the key is present.
*/
PyObject *
PyDict_GetItem(PyObject *op, PyObject *key)
{ ... }
PyDict_GetItem() should avoided because it may hide important exceptions like KeyboardInterrupt or MemoryError.
See for example #14537 for a specific error.
By the way, the PyDict_GetItem() documentation should contain a big red warning and suggest to use PyDict_GetItemWithError() instead.
|
|||
| msg211167 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2014年02月13日 20:05 | |
Please, no more big red warnings. Keep the docs factual and straight-forward. In the docs for PyDict_GetItem(), note that errors will get suppressed. To get error reporting use PyDict_GetItemWithError() instead. |
|||
| msg297122 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年06月28日 01:33 | |
Sorry, I lost track of this issue, so I just close it. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:58 | admin | set | github: 64814 |
| 2017年06月28日 01:33:58 | vstinner | set | status: open -> closed resolution: out of date messages: + msg297122 stage: needs patch -> resolved |
| 2014年02月13日 20:05:04 | rhettinger | set | nosy:
+ rhettinger messages: + msg211167 |
| 2014年02月13日 19:14:31 | serhiy.storchaka | set | stage: needs patch |
| 2014年02月13日 10:44:13 | vstinner | create | |