Title: Delete a pending item in _warning.c
Type: Stage: resolved
Components: Extension Modules Versions: Python 3.9
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ppperry, serhiy.storchaka, shihai1991
Priority: normal Keywords: patch

Created on 2020-02-08 14:27 by shihai1991, last changed 2020-03-14 14:45 by shihai1991. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18414 merged shihai1991, 2020-02-08 14:30
Messages (7)
msg361630 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2020-02-08 14:27
a pend item could be removed (

two reasons:
1) every warning have `__name__` and it must not NULL(`The tp_name slot must be set;` from pep0253)
2) the `__name__` of Warning class(including children class) can not be removed.

>>> del UserWarning.__name__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type 'UserWarning'
msg361632 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2020-02-08 14:32
If I am wrong, remove the check operation of `name` is fine.
msg361778 - (view) Author: (ppperry) Date: 2020-02-11 04:04
What if a warning has a metaclass with a custom __getattribute__ method?
msg361792 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2020-02-11 09:45
> What if a warning has a metaclass with a custom __getattribute__ method?

Sorry, ppperry. I don't understand your question clearly. Could you give me some examples?

This function could be touched when user call `warnings.warn_explicit()`.
msg364161 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-14 13:41
New changeset 57c781048915e45d15eaa348c51ec01b12cc170a by Hai Shi in branch 'master':
bpo-39585: Delete a pending comment in _warning.c (GH-18414)
msg364162 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-14 13:42
The C code is equivalent to the Python code. No special handling is needed.
msg364174 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2020-03-14 14:45
Thanks, serhiy.
Date User Action Args
2020-03-14 14:45:25shihai1991setmessages: + msg364174
2020-03-14 13:42:16serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg364162

stage: patch review -> resolved
2020-03-14 13:41:01serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg364161
2020-02-11 09:47:07shihai1991setcomponents: + Extension Modules, - Interpreter Core
2020-02-11 09:45:21shihai1991setmessages: + msg361792
2020-02-11 04:04:47ppperrysetnosy: + ppperry
messages: + msg361778
2020-02-08 14:32:45shihai1991setmessages: + msg361632
2020-02-08 14:30:41shihai1991setkeywords: + patch
stage: patch review
pull_requests: + pull_request17789
2020-02-08 14:27:40shihai1991create