cpython: 420f70a22b9d (original) (raw)
Mercurial > cpython
changeset 84258:420f70a22b9d
Issue #11016: Add C implementation of the stat module as _stat [#11016]
Christian Heimes christian@cheimes.de | |
---|---|
date | Sat, 22 Jun 2013 21:05:02 +0200 |
parents | d7d73f48dfda |
children | 1d67c0893719 |
files | Doc/library/stat.rst Doc/whatsnew/3.4.rst Lib/stat.py Lib/test/test_stat.py Misc/NEWS Modules/Setup.dist Modules/_stat.c PC/VS9.0/pythoncore.vcproj PCbuild/pythoncore.vcxproj |
diffstat | 9 files changed, 679 insertions(+), 23 deletions(-)[+] [-] Doc/library/stat.rst 51 Doc/whatsnew/3.4.rst 7 Lib/stat.py 6 Lib/test/test_stat.py 57 Misc/NEWS 2 Modules/Setup.dist 1 Modules/_stat.c 571 PC/VS9.0/pythoncore.vcproj 4 PCbuild/pythoncore.vcxproj 3 |
line wrap: on
line diff
--- a/Doc/library/stat.rst
+++ b/Doc/library/stat.rst
@@ -6,7 +6,8 @@
os.lstat() and os.fstat().
.. sectionauthor:: Skip Montanaro skip@automatrix.com
-Source code: :source:Lib/stat.py
+Source code: :source:Modules/_stat.c
:source:`Lib/stat.py`[](#l1.9)
--------------
@@ -15,6 +16,9 @@ results of :func:os.stat
, :func:os.fs[](#l1.13) exist). For complete details about the :c:func:
stat, :c:func:
fstat and[](#l1.14) :c:func:
lstat` calls, consult the documentation for your system.
+.. versionchanged:: 3.4
The :mod:stat
module defines the following functions to test for specific file
types:
@@ -53,6 +57,24 @@ types:
Return non-zero if the mode is from a socket.
+.. function:: S_ISDOOR(mode)
+
+.. function:: S_ISPORT(mode) +
+.. function:: S_ISWHT(mode) +
Two additional functions are defined for more general manipulation of the file's mode: @@ -113,6 +135,10 @@ readable string: .. versionadded:: 3.3
- .. versionchanged:: 3.4
The function supports :data:`S_IFDOOR`, :data:`S_IFPORT` and[](#l1.53)
:data:`S_IFWHT`.[](#l1.54)
+
All the variables below are simply symbolic indexes into the 10-tuple returned
by :func:os.stat
, :func:os.fstat
or :func:os.lstat
.
@@ -210,6 +236,29 @@ Use of the functions above is more porta
FIFO.
+.. data:: S_IFDOOR
+
- :data:
S_IFDOOR
, :data:S_IFPORT
or :data:S_IFWHT
are defined as - 0 when the platform does not have support for the file types. +
The following flags can also be used in the mode argument of :func:os.chmod
:
.. data:: S_ISUID
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -182,7 +182,6 @@ functools
New :func:functools.singledispatch
decorator: see the :pep:443
.
-
smtplib
-------
@@ -213,6 +212,12 @@ wave
The :meth:~wave.getparams
method now returns a namedtuple rather than a
plain tuple. (Contributed by Claudiu Popa in :issue:17487
.)
+stat
+---
+
+The stat module is now backed by a C implementation in :mod:_stat
. A C
+implementation is required as most of the values aren't standardized and
+platform-dependent. (Contributed by Christian Heimes in :issue:11016
.)
Optimizations
=============
--- a/Lib/stat.py +++ b/Lib/stat.py @@ -147,3 +147,9 @@ def filemode(mode): else: perm.append("-") return "".join(perm) + +# If available, use C implementation +try:
--- a/Lib/test/test_stat.py +++ b/Lib/test/test_stat.py @@ -1,9 +1,13 @@ import unittest import os from test.support import TESTFN, run_unittest, import_fresh_module -import stat + +c_stat = import_fresh_module('stat', fresh=['_stat']) +py_stat = import_fresh_module('stat', blocked=['_stat']) class TestFilemode(unittest.TestCase):
+ file_flags = {'SF_APPEND', 'SF_ARCHIVED', 'SF_IMMUTABLE', 'SF_NOUNLINK', 'SF_SNAPSHOT', 'UF_APPEND', 'UF_COMPRESSED', 'UF_HIDDEN', 'UF_IMMUTABLE', 'UF_NODUMP', 'UF_NOUNLINK', 'UF_OPAQUE'} @@ -60,17 +64,17 @@ class TestFilemode(unittest.TestCase): def get_mode(self, fname=TESTFN): st_mode = os.lstat(fname).st_mode
modestr = stat.filemode(st_mode)[](#l4.22)
modestr = self.statmod.filemode(st_mode)[](#l4.23) return st_mode, modestr[](#l4.24)
def assertS_IS(self, name, mode): # test format, lstrip is for S_IFIFO
fmt = getattr(stat, "S_IF" + name.lstrip("F"))[](#l4.28)
self.assertEqual(stat.S_IFMT(mode), fmt)[](#l4.29)
fmt = getattr(self.statmod, "S_IF" + name.lstrip("F"))[](#l4.30)
self.assertEqual(self.statmod.S_IFMT(mode), fmt)[](#l4.31) # test that just one function returns true[](#l4.32) testname = "S_IS" + name[](#l4.33) for funcname in self.format_funcs:[](#l4.34)
func = getattr(stat, funcname, None)[](#l4.35)
func = getattr(self.statmod, funcname, None)[](#l4.36) if func is None:[](#l4.37) if funcname == testname:[](#l4.38) raise ValueError(funcname)[](#l4.39)
@@ -88,35 +92,35 @@ class TestFilemode(unittest.TestCase): st_mode, modestr = self.get_mode() self.assertEqual(modestr, '-rwx------') self.assertS_IS("REG", st_mode)
self.assertEqual(stat.S_IMODE(st_mode),[](#l4.44)
stat.S_IRWXU)[](#l4.45)
self.assertEqual(self.statmod.S_IMODE(st_mode),[](#l4.46)
self.statmod.S_IRWXU)[](#l4.47)
os.chmod(TESTFN, 0o070) st_mode, modestr = self.get_mode() self.assertEqual(modestr, '----rwx---') self.assertS_IS("REG", st_mode)
self.assertEqual(stat.S_IMODE(st_mode),[](#l4.53)
stat.S_IRWXG)[](#l4.54)
self.assertEqual(self.statmod.S_IMODE(st_mode),[](#l4.55)
self.statmod.S_IRWXG)[](#l4.56)
os.chmod(TESTFN, 0o007) st_mode, modestr = self.get_mode() self.assertEqual(modestr, '-------rwx') self.assertS_IS("REG", st_mode)
self.assertEqual(stat.S_IMODE(st_mode),[](#l4.62)
stat.S_IRWXO)[](#l4.63)
self.assertEqual(self.statmod.S_IMODE(st_mode),[](#l4.64)
self.statmod.S_IRWXO)[](#l4.65)
os.chmod(TESTFN, 0o444) st_mode, modestr = self.get_mode() self.assertS_IS("REG", st_mode) self.assertEqual(modestr, '-r--r--r--')
self.assertEqual(stat.S_IMODE(st_mode), 0o444)[](#l4.71)
self.assertEqual(self.statmod.S_IMODE(st_mode), 0o444)[](#l4.72) else:[](#l4.73) os.chmod(TESTFN, 0o700)[](#l4.74) st_mode, modestr = self.get_mode()[](#l4.75) self.assertEqual(modestr[:3], '-rw')[](#l4.76) self.assertS_IS("REG", st_mode)[](#l4.77)
self.assertEqual(stat.S_IFMT(st_mode),[](#l4.78)
stat.S_IFREG)[](#l4.79)
self.assertEqual(self.statmod.S_IFMT(st_mode),[](#l4.80)
self.statmod.S_IFREG)[](#l4.81)
def test_directory(self): os.mkdir(TESTFN) @@ -162,25 +166,38 @@ class TestFilemode(unittest.TestCase): def test_module_attributes(self): for key, value in self.stat_struct.items():
modvalue = getattr(stat, key)[](#l4.89)
modvalue = getattr(self.statmod, key)[](#l4.90) self.assertEqual(value, modvalue, key)[](#l4.91) for key, value in self.permission_bits.items():[](#l4.92)
modvalue = getattr(stat, key)[](#l4.93)
modvalue = getattr(self.statmod, key)[](#l4.94) self.assertEqual(value, modvalue, key)[](#l4.95) for key in self.file_flags:[](#l4.96)
modvalue = getattr(stat, key)[](#l4.97)
modvalue = getattr(self.statmod, key)[](#l4.98) self.assertIsInstance(modvalue, int)[](#l4.99) for key in self.formats:[](#l4.100)
modvalue = getattr(stat, key)[](#l4.101)
modvalue = getattr(self.statmod, key)[](#l4.102) self.assertIsInstance(modvalue, int)[](#l4.103) for key in self.format_funcs:[](#l4.104)
func = getattr(stat, key)[](#l4.105)
func = getattr(self.statmod, key)[](#l4.106) self.assertTrue(callable(func))[](#l4.107) self.assertEqual(func(0), 0)[](#l4.108)
+class TestFilemodeCStat(TestFilemode):
- formats = TestFilemode.formats | {'S_IFDOOR', 'S_IFPORT', 'S_IFWHT'}
- format_funcss = TestFilemode.format_funcs | {'S_ISDOOR', 'S_ISPORT',
'S_ISWHT'}[](#l4.116)
+ + +class TestFilemodePyStat(TestFilemode):
if name == 'main': test_main()
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -123,6 +123,8 @@ Core and Builtins Library ------- +- Issue #11016: Add C implementation of the stat module as _stat. +
--- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -117,6 +117,7 @@ pwd pwdmodule.c # this is needed to fi _collections _collectionsmodule.c # Container types itertools itertoolsmodule.c # Functions creating iterators for efficient looping atexit atexitmodule.c # Register functions to be run at interpreter-shutdown +_stat _stat.c # stat.h interface
access to ISO C locale support
_locale _localemodule.c # -lintl
new file mode 100644 --- /dev/null +++ b/Modules/_stat.c @@ -0,0 +1,571 @@ +/* stat.h interface
- *
- *
- *
- *
- / + +#define PY_SSIZE_T_CLEAN +#include "Python.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif / HAVE_SYS_TYPES_H / + +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif / HAVE_SYS_STAT_H / + +/ From Python's stat.py / +#ifndef S_IMODE +# define S_IMODE 07777 +#endif + +/ S_IFXXX constants (file types)
- *
- / +#ifndef S_IFMT +# define S_IFMT 0170000 +#endif + +#ifndef S_IFDIR +# define S_IFDIR 0040000 +#endif + +#ifndef S_IFCHR +# define S_IFCHR 0020000 +#endif + +#ifndef S_IFBLK +# define S_IFBLK 0060000 +#endif + +#ifndef S_IFREG +# define S_IFREG 0100000 +#endif + +#ifndef S_IFIFO +# define S_IFIFO 0010000 +#endif + +#ifndef S_IFLNK +# define S_IFLNK 0120000 +#endif + +#ifndef S_IFSOCK +# define S_IFSOCK 0140000 +#endif + +#ifndef S_IFDOOR +# define S_IFDOOR 0 +#endif + +#ifndef S_IFPORT +# define S_IFPORT 0 +#endif + +#ifndef S_IFWHT +# define S_IFWHT 0 +#endif + + +/ S_ISXXX() / +#ifndef S_ISDIR +# define S_ISDIR(mode) ((mode) & S_IFMT) == S_IDIR +#endif + +#ifndef S_ISCHR +# define S_ISCHR(mode) ((mode) & S_IFMT) == S_ICHR +#endif + +#ifndef S_ISBLK +# define S_ISBLK(mode) ((mode) & S_IFMT) == S_IBLK +#endif + +#ifndef S_ISREG +# define S_ISREG(mode) ((mode) & S_IFMT) == S_IREG +#endif + +#ifndef S_ISFIFO +# define S_ISFIFO(mode) ((mode) & S_IFMT) == S_IFIFO +#endif + +#ifndef S_ISLNK +# define S_ISLNK(mode) ((mode) & S_IFMT) == S_IFLNK +#endif + +#ifndef S_ISSOCK +# define S_ISSOCK(mode) ((mode) & S_IFMT) == S_IFSOCK +#endif + +#ifndef S_ISDOOR +# define S_ISDOOR(mode) 0 +#endif + +#ifndef S_ISPORT +# define S_ISPORT(mode) 0 +#endif + +#ifndef S_ISWHT +# define S_ISWHT(mode) 0 +#endif + + +/ S_I* file permission
- *
- / +#ifndef S_ISUID +# define S_ISUID 04000 +#endif + +#ifndef S_ISGID +# define S_ISGID 02000 +#endif + +/ what is S_ENFMT? / +#ifndef S_ENFMT +# define S_ENFMT S_ISGID +#endif + +#ifndef S_ISVTX +# define S_ISVTX 01000 +#endif + +#ifndef S_IREAD +# define S_IREAD 00400 +#endif + +#ifndef S_IWRITE +# define S_IWRITE 00200 +#endif + +#ifndef S_IEXEC +# define S_IEXEC 00100 +#endif + +#ifndef S_IRWXU +# define S_IRWXU 00700 +#endif + +#ifndef S_IRUSR +# define S_IRUSR 00400 +#endif + +#ifndef S_IWUSR +# define S_IWUSR 00200 +#endif + +#ifndef S_IXUSR +# define S_IXUSR 00100 +#endif + +#ifndef S_IRWXG +# define S_IRWXG 00070 +#endif + +#ifndef S_IRGRP +# define S_IRGRP 00040 +#endif + +#ifndef S_IWGRP +# define S_IWGRP 00020 +#endif + +#ifndef S_IXGRP +# define S_IXGRP 00010 +#endif + +#ifndef S_IRWXO +# define S_IRWXO 00007 +#endif + +#ifndef S_IROTH +# define S_IROTH 00004 +#endif + +#ifndef S_IWOTH +# define S_IWOTH 00002 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 00001 +#endif + + +/ Names for file flags */ +#ifndef UF_NODUMP +# define UF_NODUMP 0x00000001 +#endif + +#ifndef UF_IMMUTABLE +# define UF_IMMUTABLE 0x00000002 +#endif + +#ifndef UF_APPEND +# define UF_APPEND 0x00000004 +#endif + +#ifndef UF_OPAQUE +# define UF_OPAQUE 0x00000008 +#endif + +#ifndef UF_NOUNLINK +# define UF_NOUNLINK 0x00000010 +#endif + +#ifndef UF_COMPRESSED +# define UF_COMPRESSED 0x00000020 +#endif + +#ifndef UF_HIDDEN +# define UF_HIDDEN 0x00008000 +#endif + +#ifndef SF_ARCHIVED +# define SF_ARCHIVED 0x00010000 +#endif + +#ifndef SF_IMMUTABLE +# define SF_IMMUTABLE 0x00020000 +#endif + +#ifndef SF_APPEND +# define SF_APPEND 0x00040000 +#endif + +#ifndef SF_NOUNLINK +# define SF_NOUNLINK 0x00100000 +#endif + +#ifndef SF_SNAPSHOT +# define SF_SNAPSHOT 0x00200000 +#endif + + +#define stat_S_ISFUNC(isfunc, doc) [](#l7.262)
- static PyObject * [](#l7.263)
- stat_ ##isfunc (PyObject *self, PyObject *omode) [](#l7.264)
- { [](#l7.265)
unsigned long mode = PyLong_AsUnsignedLong(omode); \[](#l7.266)
if ((mode == (unsigned long)-1) && PyErr_Occurred()) { \[](#l7.267)
return NULL; \[](#l7.268)
} \[](#l7.269)
return PyBool_FromLong(isfunc(mode)); \[](#l7.270)
- } [](#l7.271)
- PyDoc_STRVAR(stat_ ## isfunc ## _doc, doc)
+ + +PyDoc_STRVAR(stat_S_IMODE_doc, +"Return the portion of the file's mode that can be set by os.chmod()."); + +static PyObject * +stat_S_IMODE(PyObject *self, PyObject *omode) +{
- unsigned long mode = PyLong_AsUnsignedLong(omode);
- if ((mode == (unsigned long)-1) && PyErr_Occurred()) {
return NULL;[](#l7.323)
- }
- return PyLong_FromUnsignedLong(mode & S_IMODE);
+} + + +PyDoc_STRVAR(stat_S_IFMT_doc, +"Return the portion of the file's mode that describes the file type."); + +static PyObject * +stat_S_IFMT(PyObject *self, PyObject *omode) +{
- unsigned long mode = PyLong_AsUnsignedLong(omode);
- if ((mode == (unsigned long)-1) && PyErr_Occurred()) {
return NULL;[](#l7.337)
- }
- return PyLong_FromUnsignedLong(mode & S_IFMT);
+} + +/* file type chars according to
+static char +filetype(mode_t mode) +{
- /* common cases first */
- if (S_ISREG(mode)) return '-';
- if (S_ISDIR(mode)) return 'd';
- if (S_ISLNK(mode)) return 'l';
- /* special files */
- if (S_ISBLK(mode)) return 'b';
- if (S_ISCHR(mode)) return 'c';
- if (S_ISFIFO(mode)) return 'p';
- if (S_ISSOCK(mode)) return 's';
- /* non-standard types */
- if (S_ISDOOR(mode)) return 'D';
- if (S_ISPORT(mode)) return 'P';
- if (S_ISWHT(mode)) return 'w';
- /* unknown */
- return '?';
+} + +static void +fileperm(mode_t mode, char *buf) +{
- buf[0] = mode & S_IRUSR ? 'r' : '-';
- buf[1] = mode & S_IWUSR ? 'w' : '-';
- if (mode & S_ISUID) {
buf[2] = mode & S_IXUSR ? 's' : 'S';[](#l7.371)
- } else {
buf[2] = mode & S_IXUSR ? 'x' : '-';[](#l7.373)
- }
- buf[3] = mode & S_IRGRP ? 'r' : '-';
- buf[4] = mode & S_IWGRP ? 'w' : '-';
- if (mode & S_ISGID) {
buf[5] = mode & S_IXGRP ? 's' : 'S';[](#l7.378)
- } else {
buf[5] = mode & S_IXGRP ? 'x' : '-';[](#l7.380)
- }
- buf[6] = mode & S_IROTH ? 'r' : '-';
- buf[7] = mode & S_IWOTH ? 'w' : '-';
- if (mode & S_ISVTX) {
buf[8] = mode & S_IXOTH ? 't' : 'T';[](#l7.385)
- } else {
buf[8] = mode & S_IXOTH ? 'x' : '-';[](#l7.387)
- }
+} + +PyDoc_STRVAR(stat_filemode_doc, +"Convert a file's mode to a string of the form '-rwxrwxrwx'"); + +static PyObject * +stat_filemode(PyObject *self, PyObject *omode) +{
- mode = PyLong_AsUnsignedLong(omode);
- if ((mode == (unsigned long)-1) && PyErr_Occurred()) {
return NULL;[](#l7.402)
- }
+} + + +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 */
+}; + + +PyDoc_STRVAR(module_doc, +"S_IFMT_: file type bits\n[](#l7.430) +S_IFDIR: directory\n[](#l7.431) +S_IFCHR: character device\n[](#l7.432) +S_IFBLK: block device\n[](#l7.433) +S_IFREG: regular file\n[](#l7.434) +S_IFIFO: fifo (named pipe)\n[](#l7.435) +S_IFLNK: symbolic link\n[](#l7.436) +S_IFSOCK: socket file\n[](#l7.437) +S_IFDOOR: door\n[](#l7.438) +S_IFPORT: event port\n[](#l7.439) +S_IFWHT: whiteout\n[](#l7.440) +\n" + +"S_ISUID: set UID bit\n[](#l7.443) +S_ISGID: set GID bit\n[](#l7.444) +S_ENFMT: file locking enforcement\n[](#l7.445) +S_ISVTX: sticky bit\n[](#l7.446) +S_IREAD: Unix V7 synonym for S_IRUSR\n[](#l7.447) +S_IWRITE: Unix V7 synonym for S_IWUSR\n[](#l7.448) +S_IEXEC: Unix V7 synonym for S_IXUSR\n[](#l7.449) +S_IRWXU: mask for owner permissions\n[](#l7.450) +S_IRUSR: read by owner\n[](#l7.451) +S_IWUSR: write by owner\n[](#l7.452) +S_IXUSR: execute by owner\n[](#l7.453) +S_IRWXG: mask for group permissions\n[](#l7.454) +S_IRGRP: read by group\n[](#l7.455) +S_IWGRP: write by group\n[](#l7.456) +S_IXGRP: execute by group\n[](#l7.457) +S_IRWXO: mask for others (not in group) permissions\n[](#l7.458) +S_IROTH: read by others\n[](#l7.459) +S_IWOTH: write by others\n[](#l7.460) +S_IXOTH: execute by others\n[](#l7.461) +\n" + +"UF_NODUMP: do not dump file\n[](#l7.464) +UF_IMMUTABLE: file may not be changed\n[](#l7.465) +UF_APPEND: file may only be appended to\n[](#l7.466) +UF_OPAQUE: directory is opaque when viewed through a union stack\n[](#l7.467) +UF_NOUNLINK: file may not be renamed or deleted\n[](#l7.468) +UF_COMPRESSED: OS X: file is hfs-compressed\n[](#l7.469) +UF_HIDDEN: OS X: file should not be displayed\n[](#l7.470) +SF_ARCHIVED: file may be archived\n[](#l7.471) +SF_IMMUTABLE: file may not be changed\n[](#l7.472) +SF_APPEND: file may only be appended to\n[](#l7.473) +SF_NOUNLINK: file may not be renamed or deleted\n[](#l7.474) +SF_SNAPSHOT: file is a snapshot file\n[](#l7.475) +\n" + +"ST_MODE\n[](#l7.478) +ST_INO\n[](#l7.479) +ST_DEV\n[](#l7.480) +ST_NLINK\n[](#l7.481) +ST_UID\n[](#l7.482) +ST_GID\n[](#l7.483) +ST_SIZE\n[](#l7.484) +ST_ATIME\n[](#l7.485) +ST_MTIME\n[](#l7.486) +ST_CTIME\n[](#l7.487) +"); + + +static struct PyModuleDef statmodule = {
+}; + +PyMODINIT_FUNC +PyInit__stat(void) +{
- if (PyModule_AddIntMacro(m, S_IFDIR)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFCHR)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFBLK)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFREG)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFIFO)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFLNK)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFSOCK)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFDOOR)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFPORT)) return NULL;
- if (PyModule_AddIntMacro(m, S_IFWHT)) return NULL;
- if (PyModule_AddIntMacro(m, S_ISUID)) return NULL;
- if (PyModule_AddIntMacro(m, S_ISGID)) return NULL;
- if (PyModule_AddIntMacro(m, S_ISVTX)) return NULL;
- if (PyModule_AddIntMacro(m, S_ENFMT)) return NULL;
- if (PyModule_AddIntMacro(m, S_IREAD)) return NULL;
- if (PyModule_AddIntMacro(m, S_IWRITE)) return NULL;
- if (PyModule_AddIntMacro(m, S_IEXEC)) return NULL;
- if (PyModule_AddIntMacro(m, S_IRWXU)) return NULL;
- if (PyModule_AddIntMacro(m, S_IRUSR)) return NULL;
- if (PyModule_AddIntMacro(m, S_IWUSR)) return NULL;
- if (PyModule_AddIntMacro(m, S_IXUSR)) return NULL;
- if (PyModule_AddIntMacro(m, S_IRWXG)) return NULL;
- if (PyModule_AddIntMacro(m, S_IRGRP)) return NULL;
- if (PyModule_AddIntMacro(m, S_IWGRP)) return NULL;
- if (PyModule_AddIntMacro(m, S_IXGRP)) return NULL;
- if (PyModule_AddIntMacro(m, S_IRWXO)) return NULL;
- if (PyModule_AddIntMacro(m, S_IROTH)) return NULL;
- if (PyModule_AddIntMacro(m, S_IWOTH)) return NULL;
- if (PyModule_AddIntMacro(m, S_IXOTH)) return NULL;
- if (PyModule_AddIntMacro(m, UF_NODUMP)) return NULL;
- if (PyModule_AddIntMacro(m, UF_IMMUTABLE)) return NULL;
- if (PyModule_AddIntMacro(m, UF_APPEND)) return NULL;
- if (PyModule_AddIntMacro(m, UF_OPAQUE)) return NULL;
- if (PyModule_AddIntMacro(m, UF_NOUNLINK)) return NULL;
- if (PyModule_AddIntMacro(m, UF_COMPRESSED)) return NULL;
- if (PyModule_AddIntMacro(m, UF_HIDDEN)) return NULL;
- if (PyModule_AddIntMacro(m, SF_ARCHIVED)) return NULL;
- if (PyModule_AddIntMacro(m, SF_IMMUTABLE)) return NULL;
- if (PyModule_AddIntMacro(m, SF_APPEND)) return NULL;
- if (PyModule_AddIntMacro(m, SF_NOUNLINK)) return NULL;
- if (PyModule_AddIntMacro(m, SF_SNAPSHOT)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_MODE", 0)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_INO", 1)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_DEV", 2)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_NLINK", 3)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_UID", 4)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_GID", 5)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_SIZE", 6)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_ATIME", 7)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_MTIME", 8)) return NULL;
- if (PyModule_AddIntConstant(m, "ST_CTIME", 9)) return NULL;
+} + +#ifdef __cplusplus +} +#endif
--- a/PC/VS9.0/pythoncore.vcproj +++ b/PC/VS9.0/pythoncore.vcproj @@ -1155,6 +1155,10 @@ > <File + RelativePath="....\Modules_stat.c" + > + + <File RelativePath="....\Modules\symtablemodule.c" >
--- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -525,6 +525,7 @@