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 petdance
Recipients petdance
Date 2020-02-22.00:25:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582331134.81.0.179748951937.issue39721@roundup.psfhosted.org>
In-reply-to
Content
The function PyTokenizer_FromUTF8 from Parser/tokenizer.c had a comment:

    /* XXX: constify members. */

This patch addresses that.

In the tok_state struct:
    * end and start were non-const but could be made const
    * str and input were const but should have been non-const

Changes to support this include:
    * decode_str() now returns a char * since it is allocated.
    * PyTokenizer_FromString() and PyTokenizer_FromUTF8() each creates a
        new char * for an allocate string instead of reusing the input
        const char *.
    * PyTokenizer_Get() and tok_get() now take const char ** arguments.
    * Various local vars are const or non-const accordingly.

I was able to remove five casts that cast away constness.
History
Date User Action Args
2020-02-22 00:25:34petdancesetrecipients: + petdance
2020-02-22 00:25:34petdancesetmessageid: <1582331134.81.0.179748951937.issue39721@roundup.psfhosted.org>
2020-02-22 00:25:34petdancelinkissue39721 messages
2020-02-22 00:25:34petdancecreate