Issue33818
Created on 2018-06-10 06:35 by serhiy.storchaka, last changed 2018-06-15 08:10 by serhiy.storchaka. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 7581 | merged | serhiy.storchaka, 2018-06-10 06:45 | |
| Messages (3) | |||
|---|---|---|---|
| msg319201 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-06-10 06:36 | |
PyExceptionClass_Name() returns just the tp_name field, a pointer to immutable char array. tp_name had type "char *" in old Python versions, but it was changed to "const char *" in revision af68c874a6803b4e90b616077a602c0593719a1d. But PyExceptionClass_Name() still casts tp_name to "char *". I think it would be better to return "const char *". It would be a breaking change, but seems most third-party code uses the result of PyExceptionClass_Name() in context where "const char *" is acceptable [1], and it is easy to add "const" in a variable declaration if the result is assigned to a variable (as in both cases of using PyExceptionClass_Name() in the CPython core). Since several similar breaking changes were made in 3.7 (see issue28761 and issue28769), it would be nice to made this change in 3.7 too. But it may be too late for 3.7. [1] https://github.com/search?q=PyExceptionClass_Name&type=Code |
|||
| msg319255 - (view) | Author: Ned Deily (ned.deily) * | Date: 2018-06-10 22:07 | |
While I think the change makes sense aesthetically, I do not see a compelling reason why such a user interface change should be introduced to 3.7 at literally the last moment. Let's do it for 3.8, please. |
|||
| msg319593 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-06-15 08:09 | |
New changeset ceeef10cdbc08561f9954e13bbed1cb2299a8c72 by Serhiy Storchaka in branch 'master': bpo-33818: PyExceptionClass_Name() will now return "const char *". (GH-7581) https://github.com/python/cpython/commit/ceeef10cdbc08561f9954e13bbed1cb2299a8c72 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-06-15 08:10:50 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-06-15 08:09:46 | serhiy.storchaka | set | messages: + msg319593 |
| 2018-06-10 22:07:58 | ned.deily | set | messages:
+ msg319255 versions: - Python 3.7 |
| 2018-06-10 06:45:05 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request7204 |
| 2018-06-10 06:36:34 | serhiy.storchaka | set | messages: - msg319200 |
| 2018-06-10 06:36:24 | serhiy.storchaka | set | messages: + msg319201 |
| 2018-06-10 06:35:52 | serhiy.storchaka | create | |