2007-06-12 20:30:11 -03:00
|
|
|
/* File object interface (what's left of it -- see io.py) */
|
1990-10-14 09:07:46 -03:00
|
|
|
|
2000-07-08 21:20:36 -03:00
|
|
|
#ifndef Py_FILEOBJECT_H
|
|
|
|
#define Py_FILEOBJECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2007-06-12 20:30:11 -03:00
|
|
|
#define PY_STDIOTEXTMODE "b"
|
1990-10-14 09:07:46 -03:00
|
|
|
|
2013-10-19 15:03:34 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
|
|
|
|
const char *, const char *,
|
|
|
|
const char *, int);
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
|
|
|
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
|
|
|
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
|
|
|
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2007-06-12 20:30:11 -03:00
|
|
|
PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
1993-07-28 06:05:47 -03:00
|
|
|
|
2001-05-14 09:17:34 -03:00
|
|
|
/* The default encoding used by the platform file system APIs
|
2002-04-21 04:29:14 -03:00
|
|
|
If non-NULL, this is different than the default encoding for strings
|
2001-05-14 09:17:34 -03:00
|
|
|
*/
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
|
2016-12-27 08:57:39 -04:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
|
2016-09-08 14:35:16 -03:00
|
|
|
PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors;
|
2016-12-27 08:57:39 -04:00
|
|
|
#endif
|
2008-10-03 13:09:28 -03:00
|
|
|
PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
|
2001-05-14 09:17:34 -03:00
|
|
|
|
2007-10-30 15:34:07 -03:00
|
|
|
/* Internal API
|
|
|
|
|
|
|
|
The std printer acts as a preliminary sys.stderr until the new io
|
|
|
|
infrastructure is in place. */
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2007-10-30 15:34:07 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
|
|
|
|
PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif /* Py_LIMITED_API */
|
Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r69364 | kristjan.jonsson | 2009-02-06 04:17:34 -0600 (Fri, 06 Feb 2009) | 1 line
Fix a number of Win32ErrorTests error cases. chmod wasn't being tested. 'access' never raises an error.
........
r69365 | armin.rigo | 2009-02-06 05:46:26 -0600 (Fri, 06 Feb 2009) | 2 lines
Ivan on IRC in #twisted reported this crasher.
........
r69409 | georg.brandl | 2009-02-07 06:21:17 -0600 (Sat, 07 Feb 2009) | 1 line
#5174: fix wrong file closing in example.
........
r69410 | neil.schemenauer | 2009-02-07 08:53:31 -0600 (Sat, 07 Feb 2009) | 4 lines
Fix broken test in test_hotshot. Treating the current directory as an
empty file is sloppy and non-portable. Use NamedTemporaryFile to make
an empty file.
........
r69413 | neil.schemenauer | 2009-02-07 12:35:16 -0600 (Sat, 07 Feb 2009) | 2 lines
Add test for issue #999042, explict global statement works.
........
r69417 | benjamin.peterson | 2009-02-07 17:01:19 -0600 (Sat, 07 Feb 2009) | 1 line
document individual 2to3 fixers
........
r69435 | benjamin.peterson | 2009-02-08 08:38:13 -0600 (Sun, 08 Feb 2009) | 1 line
document numliterals fixer
........
r69442 | benjamin.peterson | 2009-02-08 09:14:57 -0600 (Sun, 08 Feb 2009) | 1 line
a few edits and typos
........
r69447 | vinay.sajip | 2009-02-08 13:06:08 -0600 (Sun, 08 Feb 2009) | 2 lines
Issue #5170: Fixed Unicode output bug in logging and added test case. This is a regression which did not occur in 2.5.
........
r69495 | kristjan.jonsson | 2009-02-10 07:32:24 -0600 (Tue, 10 Feb 2009) | 1 line
Issue 4804. Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions.
........
r69519 | gregory.p.smith | 2009-02-11 17:45:25 -0600 (Wed, 11 Feb 2009) | 3 lines
Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
on LP64 platforms (most 64-bit Linux, bsd, unix systems).
........
r69520 | benjamin.peterson | 2009-02-11 21:50:00 -0600 (Wed, 11 Feb 2009) | 1 line
os.fsync() should be used to ensure that data is written to disk
........
r69521 | benjamin.peterson | 2009-02-11 22:17:04 -0600 (Wed, 11 Feb 2009) | 1 line
no need for this __bases__ trick anymore
........
2009-02-12 22:50:59 -04:00
|
|
|
|
2011-08-28 12:51:43 -03:00
|
|
|
/* A routine to check if a file descriptor can be select()-ed. */
|
2017-07-18 12:05:03 -03:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
/* On Windows, any socket fd can be select()-ed, no matter how high */
|
|
|
|
#define _PyIsSelectable_fd(FD) (1)
|
2011-08-28 12:51:43 -03:00
|
|
|
#else
|
2017-07-18 12:05:03 -03:00
|
|
|
#define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
|
|
|
|
#endif
|
2011-08-28 12:51:43 -03:00
|
|
|
|
1993-07-28 06:05:47 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_FILEOBJECT_H */
|