Author serhiy.storchaka
Recipients r.david.murray, rhettinger, serhiy.storchaka, xiang.zhang
Date 2016-07-17.16:20:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468772414.99.0.0513025761293.issue27541@psf.upfronthosting.co.za>
In-reply-to
Content
It looks to me that the repr of a collection contains a dynamic name if it is implemented in Python and hardcoded base name if it is implemented in C (OrderedDict originally was implemented in Python). Maybe just because tp_name contains full qualified name, and extracting a bare class name needs few lines of code.

There is similar issue with the io module classes: issue21861.

Since this problem is already solved for OrderedDict, I think it is easy to use this solution in other classes. Maybe factoring out the following code into helper function.

    const char *classname;

    classname = strrchr(Py_TYPE(self)->tp_name, '.');
    if (classname == NULL)
        classname = Py_TYPE(self)->tp_name;
    else
        classname++;
History
Date User Action Args
2016-07-17 16:20:15serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, r.david.murray, xiang.zhang
2016-07-17 16:20:14serhiy.storchakasetmessageid: <1468772414.99.0.0513025761293.issue27541@psf.upfronthosting.co.za>
2016-07-17 16:20:14serhiy.storchakalinkissue27541 messages
2016-07-17 16:20:14serhiy.storchakacreate