- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
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.
| Author | Oren Milman |
|---|---|
| Recipients | Oren Milman |
| Date | 2017-09-26.06:32:28 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1506407548.97.0.597498923385.issue31586@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
|---|
The following code causes a SystemError:
class BadMapping:
get = dict.get
__setitem__ = dict.__setitem__
import _collections
_collections._count_elements(BadMapping(), [42])
This is because _count_elements() (in Modules/_collectionsmodule.c) assumes
that the mapping argument is a dictionary in case it has the same get() and
__setitem__() methods as dict. And so, _count_elements() passes the mapping
argument to _PyDict_GetItem_KnownHash(), which raises the SystemError.
ISTM it is a very unlikely corner case, so that adding a test (as well as
a NEWS.d item) for it is unnecessary.
What do you think? |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-09-26 06:32:29 | Oren Milman | set | recipients: + Oren Milman |
| 2017-09-26 06:32:28 | Oren Milman | set | messageid: <1506407548.97.0.597498923385.issue31586@psf.upfronthosting.co.za> |
| 2017-09-26 06:32:28 | Oren Milman | link | issue31586 messages |
| 2017-09-26 06:32:28 | Oren Milman | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
