[issue20170] Derby #1: Convert 137 sites to Argument Clinic in Modules/posixmodule.c

Larry Hastings report at bugs.python.org
Wed Jan 29 18:27:04 CET 2014


Larry Hastings added the comment:

Actually, forget about the file output preset.  It wouldn't work for posixmodule.  > 80% of the entry points are #ifdef conditional on platform functionality.  Which means the Clinic generated stuff needs to be #ifdef too.

It wouldn't be that hard to add the ability to #ifdef your generated code... but then what?  Should it generate an #endif too, right before the end of the block?

If it closed the #ifdef, then it'd look dumb:

    /*[clinic input]*
    ifdef HAVE_WHATNOT
    os.whatnot
    [clinic start generated code]*/
    #ifdef HAVE_WHATNOT
    ...
    static PyObject *
    os_whatnot(PyModuleType *)
    #endif /* HAVE_WHATNOT */
    /*[clinic end generated code: output=... ]*/
    #ifdef HAVE_WHATNOT
    {
        ...
    }
    #endif /* HAVE_WHATNOT */


If it didn't close the #ifdef, well, that looks dumb too:

    /*[clinic input]*
    ifdef HAVE_WHATNOT
    os.whatnot
    [clinic start generated code]*/
    #ifdef HAVE_WHATNOT
    ...
    static PyObject *
    os_whatnot(PyModuleType *)
    /*[clinic end generated code: output=... ]*/
    {
        ...
    }
    #endif /* HAVE_WHATNOT */

though maybe that's less dumb.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20170>
_______________________________________


More information about the Python-bugs-list mailing list