SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files. Some of the platforms
aren't tested yet. Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences. When accessed as a sequence, they behave exactly as
before. But they also have attributes like st_mtime or tm_year. The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there). If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.
(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
|
|
|
|
|
|
|
/* Tuple object interface */
|
|
|
|
|
|
|
|
#ifndef Py_STRUCTSEQ_H
|
|
|
|
#define Py_STRUCTSEQ_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2002-10-17 19:48:27 +00:00
|
|
|
|
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files. Some of the platforms
aren't tested yet. Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences. When accessed as a sequence, they behave exactly as
before. But they also have attributes like st_mtime or tm_year. The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there). If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.
(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
|
|
|
typedef struct PyStructSequence_Field {
|
|
|
|
char *name;
|
|
|
|
char *doc;
|
|
|
|
} PyStructSequence_Field;
|
|
|
|
|
|
|
|
typedef struct PyStructSequence_Desc {
|
|
|
|
char *name;
|
|
|
|
char *doc;
|
|
|
|
struct PyStructSequence_Field *fields;
|
|
|
|
int n_in_sequence;
|
|
|
|
} PyStructSequence_Desc;
|
|
|
|
|
2002-10-16 18:27:39 +00:00
|
|
|
extern char* PyStructSequence_UnnamedField;
|
|
|
|
|
2002-10-17 19:48:27 +00:00
|
|
|
PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
|
|
|
|
PyStructSequence_Desc *desc);
|
|
|
|
|
2002-08-12 07:21:58 +00:00
|
|
|
PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
|
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files. Some of the platforms
aren't tested yet. Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences. When accessed as a sequence, they behave exactly as
before. But they also have attributes like st_mtime or tm_year. The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there). If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.
(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
PyObject_VAR_HEAD
|
|
|
|
PyObject *ob_item[1];
|
|
|
|
} PyStructSequence;
|
|
|
|
|
|
|
|
/* Macro, *only* to be used to fill in brand new objects */
|
|
|
|
#define PyStructSequence_SET_ITEM(op, i, v) \
|
|
|
|
(((PyStructSequence *)(op))->ob_item[i] = v)
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_STRUCTSEQ_H */
|