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 serhiy.storchaka
Recipients ned.deily, serhiy.storchaka
Date 2018-06-10.06:35:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528612552.69.0.592728768989.issue33818@psf.upfronthosting.co.za>
In-reply-to
Content
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 (isee ssue28761 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
History
Date User Action Args
2018-06-10 06:36:34serhiy.storchakaunlinkissue33818 messages
2018-06-10 06:35:52serhiy.storchakasetrecipients: + serhiy.storchaka, ned.deily
2018-06-10 06:35:52serhiy.storchakasetmessageid: <1528612552.69.0.592728768989.issue33818@psf.upfronthosting.co.za>
2018-06-10 06:35:52serhiy.storchakalinkissue33818 messages
2018-06-10 06:35:51serhiy.storchakacreate