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.

classification
Title: SystemError raised by warn_explicit() in case warnings.onceregistry is not a dict
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Oren Milman, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-09-10 17:37 by Oren Milman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3485 merged Oren Milman, 2017-09-10 20:13
PR 3493 merged serhiy.storchaka, 2017-09-11 06:40
PR 3494 merged serhiy.storchaka, 2017-09-11 06:43
Messages (4)
msg301822 - (view) Author: Oren Milman (Oren Milman) * Date: 2017-09-10 17:37
The following code causes warn_explicit() (in Python/_warnings.c) to raise a
SystemError:

import warnings
warnings.filterwarnings('once')
warnings.onceregistry = None
warnings.warn_explicit(message='foo', category=Warning, filename='bar',
                       lineno=1, registry=None)


this is because warn_explicit() assumes that warnings.onceregistry is a dict,
and passes it to update_registry(), which passes it to already_warned(), which
eventually passes it to _PyDict_SetItemId(), which raises the SystemError.
msg301862 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-11 06:28
New changeset 252033d50effa08046ac34fcc406bc99796ab88b by Serhiy Storchaka (Oren Milman) in branch 'master':
bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (#3485)
https://github.com/python/cpython/commit/252033d50effa08046ac34fcc406bc99796ab88b
msg301865 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-11 07:01
New changeset 004547f97067be2e23ae770f300c0c0d1db1ba27 by Serhiy Storchaka in branch '2.7':
[2.7] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3493)
https://github.com/python/cpython/commit/004547f97067be2e23ae770f300c0c0d1db1ba27
msg301866 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-11 07:01
New changeset 7972ed2111ea2f01e8712eef91bcf2260e05ad8b by Serhiy Storchaka in branch '3.6':
[3.6] bpo-31411: Prevent raising a SystemError in case warnings.onceregistry is not a dictionary. (GH-3485). (#3494)
https://github.com/python/cpython/commit/7972ed2111ea2f01e8712eef91bcf2260e05ad8b
History
Date User Action Args
2022-04-11 14:58:52adminsetgithub: 75592
2017-09-11 07:07:50serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-09-11 07:01:49serhiy.storchakasetmessages: + msg301866
2017-09-11 07:01:33serhiy.storchakasetmessages: + msg301865
2017-09-11 06:43:58serhiy.storchakasetpull_requests: + pull_request3487
2017-09-11 06:40:14serhiy.storchakasetpull_requests: + pull_request3486
2017-09-11 06:28:42serhiy.storchakasetmessages: + msg301862
2017-09-10 20:38:04serhiy.storchakasetnosy: + serhiy.storchaka
2017-09-10 20:13:21Oren Milmansetkeywords: + patch
stage: patch review
pull_requests: + pull_request3475
2017-09-10 17:37:43Oren Milmancreate