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 mark.dickinson, rhettinger, serhiy.storchaka, vstinner
Date 2017-03-22.18:02:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Yet one idea that can make the code simpler is make PyLong_FromLong(0) and PyLong_FromLong(1) never failing. I.e. require NSMALLPOSINTS not less than 2.

> Also consider adding new function PyLong_Increment.  This basic operation is small pain using the current API.  It may also give a small speed benefit.

Smaller pain with using _PyLong_One and Py_SETREF().

    Py_SETREF(long_obj, PyNumber_Add(long_obj, _PyLong_One));

Agree that with _PyLong_Increment() it can look better and be faster. But I don't know whether incrementing by 1 is enough popular operation. I have counted 5 cases in the stdlib (not counting tests): for enumerate, range and Counter.

> The problem is to make sure that singletons are created in the right order :-/

Yes, I spent much time for making empty Unicode string singleton always be initialized. It can be accessed at very early stage.
Date User Action Args
2017-03-22 18:02:43serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, mark.dickinson, vstinner
2017-03-22 18:02:43serhiy.storchakasetmessageid: <>
2017-03-22 18:02:43serhiy.storchakalinkissue29878 messages
2017-03-22 18:02:43serhiy.storchakacreate