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 methane
Recipients mbussonn, methane, takluyver, vstinner
Date 2017-02-23.06:21:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487830902.7.0.871818005132.issue29622@psf.upfronthosting.co.za>
In-reply-to
Content
AST type doesn't have any information about optional fields.  And I don't know it's worth enough to add it.
When AST is instantiated by keyword arguments, there are no check about absence of some fields.
I suppose we can just loosen positional arguments too.

current:

    if (PyTuple_GET_SIZE(args) > 0) {
        if (numfields != PyTuple_GET_SIZE(args)) {
            PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
                         "%zd positional argument%s",
                         Py_TYPE(self)->tp_name,
                         numfields == 0 ? "" : "either 0 or ",
                         numfields, numfields == 1 ? "" : "s");

will be:

    if (PyTuple_GET_SIZE(args) > 0) {
        if (numfields > PyTuple_GET_SIZE(args)) {
            PyErr_Format(PyExc_TypeError, "%.400s constructor takes at most "
                         "%zd positional argument%s",
                         Py_TYPE(self)->tp_name,
                         numfields, numfields == 1 ? "" : "s");
History
Date User Action Args
2017-02-23 06:21:42methanesetrecipients: + methane, vstinner, takluyver, mbussonn
2017-02-23 06:21:42methanesetmessageid: <1487830902.7.0.871818005132.issue29622@psf.upfronthosting.co.za>
2017-02-23 06:21:42methanelinkissue29622 messages
2017-02-23 06:21:42methanecreate