-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
bpo-36473: add maximum iteration check for dict .values() and .items() #12619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I see the tests failing because the memory size for everything that uses dict keys changes with that (obviously). Any input on if/how/when this ABI change is possible/worth it would be greatly appreciated (also if it's just enough to adjust the sizes in the test case). |
To summarize the "cost" of handling these corner cases: 1.) 1x ssize_t (8 bytes on 64 bit, 4 bytes on 32 bit) additional memory overhead for each dict Alternatively, I could prepare a PR that applies #12596 to Could this still be a case that's enabled in |
An alternative; without memory overhead, only tracking the maximum iteration count: https://github.com/thp/cpython/commit/ace18d85bc32fa9e5dcb17b442c72c954d9367cf |
Please do this. Not raising RuntimeException is not a bug. I don't want to add member only for it. |
@methane I re-used this pull request (hope this is okay) and updated the changes now to only add the maximum iteration checks to |
There seem to be some (temporary?) test failures in Azure Pipelines unrelated to the change, it is possible to trigger a re-build? (Edit: Force-pushed the amended commit now to trigger a rebuild.)
|
@@ -0,0 +1 @@ | |||
``dict`` iterators will now detect an iteration count overflow due to changed dict keys for ``.items()`` and ``.values()``, and raise a ``RuntimeError``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update Misc/NEWS.d/next/Core and Builtins/2019-03-27-23-53-00.bpo-36452.xhK2lT.rst
instead of adding new entry.
News entry is not only for credit, but also Python users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done + PR updated.
No description provided.