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 vstinner
Recipients christian.heimes, giampaolo.rodola, jcea, loewis, movement, neologix, pitrou, r.david.murray, vstinner
Date 2013-05-06.22:52:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367880736.84.0.0816642120521.issue11016@psf.upfronthosting.co.za>
In-reply-to
Content
If we use the C language, I would prefer to only expose what does really exist, and not add "fake" functions like:

+#ifndef S_ISDOOR
+#  define S_ISDOOR(mode) 0
+#endif

So in:

+static PyMethodDef stat_methods[] = {
+    {"S_ISDIR",         stat_S_ISDIR,  METH_O, stat_S_ISDIR_doc},
+    {"S_ISCHR",         stat_S_ISCHR,  METH_O, stat_S_ISCHR_doc},
+    {"S_ISBLK",         stat_S_ISBLK,  METH_O, stat_S_ISBLK_doc},
+    {"S_ISREG",         stat_S_ISREG,  METH_O, stat_S_ISREG_doc},
+    {"S_ISFIFO",        stat_S_ISFIFO, METH_O, stat_S_ISFIFO_doc},
+    {"S_ISLNK",         stat_S_ISLNK,  METH_O, stat_S_ISLNK_doc},
+    {"S_ISSOCK",        stat_S_ISSOCK, METH_O, stat_S_ISSOCK_doc},
+    {"S_ISDOOR",        stat_S_ISDOOR, METH_O, stat_S_ISDOOR_doc},
+    {"S_ISPORT",        stat_S_ISPORT, METH_O, stat_S_ISPORT_doc},
+    {"S_ISWHT",         stat_S_ISWHT,  METH_O, stat_S_ISWHT_doc},
+    {"S_IMODE",         stat_S_IMODE,  METH_O, stat_S_IMODE_doc},
+    {"S_IFMT",          stat_S_IFMT,   METH_O, stat_S_IFMT_doc},
+    {"filemode",        stat_filemode, METH_O, stat_filemode_doc},
+    {NULL,              NULL}           /* sentinel */
+};

I expect something similar to what is done in posixmodule.c:

static PyMethodDef stat_methods[] = {
    {"S_ISDIR",         stat_S_ISDIR,  METH_O, stat_S_ISDIR_doc},
    ...
#ifdef S_ISDOOR
    {"S_ISDOOR",        stat_S_ISDOOR, METH_O, stat_S_ISDOOR_doc},
#endif
    {"filemode",        stat_filemode, METH_O, stat_filemode_doc},
    {NULL,              NULL}           /* sentinel */
};
History
Date User Action Args
2013-05-06 22:52:16vstinnersetrecipients: + vstinner, loewis, jcea, pitrou, movement, giampaolo.rodola, christian.heimes, r.david.murray, neologix
2013-05-06 22:52:16vstinnersetmessageid: <1367880736.84.0.0816642120521.issue11016@psf.upfronthosting.co.za>
2013-05-06 22:52:16vstinnerlinkissue11016 messages
2013-05-06 22:52:16vstinnercreate