annotate Include/fileobject.h @ 87690:66c1c9f32567 default tip

Add use_weakref option to functools.lru_cache The use_weakref option makes lru_cache create weak references to the function arguments when creating the cache key, which prevents them from staying in the memory forever even after all other references to them are gone. This is a proof of concept for http://bugs.python.org/issue19859
author Radomir Dopieralski <devel@sheep.art.pl>
date Tue, 03 Dec 2013 16:02:48 +0100
parents 3055e61f1e66
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42071
825041fc8e2c Rip out the file object's implementation.
Guido van Rossum <guido@python.org>
parents: 41554
diff changeset
1 /* File object interface (what's left of it -- see io.py) */
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
3 #ifndef Py_FILEOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
4 #define Py_FILEOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
5 #ifdef __cplusplus
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
6 extern "C" {
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
7 #endif
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
8
42071
825041fc8e2c Rip out the file object's implementation.
Guido van Rossum <guido@python.org>
parents: 41554
diff changeset
9 #define PY_STDIOTEXTMODE "b"
22312
19d1d35020bd Patch #530105: Allow file object may to be subtyped
Martin v. Löwis <martin@v.loewis.de>
parents: 21095
diff changeset
10
86484
3055e61f1e66 Issue #1772673: The type of `char*` arguments now changed to `const char*`.
Serhiy Storchaka <storchaka@gmail.com>
parents: 72115
diff changeset
11 PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
3055e61f1e66 Issue #1772673: The type of `char*` arguments now changed to `const char*`.
Serhiy Storchaka <storchaka@gmail.com>
parents: 72115
diff changeset
12 const char *, const char *,
3055e61f1e66 Issue #1772673: The type of `char*` arguments now changed to `const char*`.
Serhiy Storchaka <storchaka@gmail.com>
parents: 72115
diff changeset
13 const char *, int);
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24594
diff changeset
14 PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24594
diff changeset
15 PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24594
diff changeset
16 PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24594
diff changeset
17 PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 64622
diff changeset
18 #ifndef Py_LIMITED_API
42071
825041fc8e2c Rip out the file object's implementation.
Guido van Rossum <guido@python.org>
parents: 41554
diff changeset
19 PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 64622
diff changeset
20 #endif
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
21
17822
50376d470648 Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule.
Mark Hammond <mhammond@skippinet.com.au>
parents: 14375
diff changeset
22 /* The default encoding used by the platform file system APIs
23201
c408e8b2675a Py_UniversalNewlineFread(): Many changes.
Tim Peters <tim.peters@gmail.com>
parents: 23029
diff changeset
23 If non-NULL, this is different than the default encoding for strings
17822
50376d470648 Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule.
Mark Hammond <mhammond@skippinet.com.au>
parents: 14375
diff changeset
24 */
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24594
diff changeset
25 PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
49403
e822992cf6ce Issue #3187: Add sys.setfilesystemencoding.
Martin v. Löwis <martin@v.loewis.de>
parents: 44134
diff changeset
26 PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
17822
50376d470648 Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule.
Mark Hammond <mhammond@skippinet.com.au>
parents: 14375
diff changeset
27
43718
e510b716bd80 Patch 1352 (continued in issue 1329) by Christian Heimes.
Guido van Rossum <guido@python.org>
parents: 43712
diff changeset
28 /* Internal API
e510b716bd80 Patch 1352 (continued in issue 1329) by Christian Heimes.
Guido van Rossum <guido@python.org>
parents: 43712
diff changeset
29
e510b716bd80 Patch 1352 (continued in issue 1329) by Christian Heimes.
Guido van Rossum <guido@python.org>
parents: 43712
diff changeset
30 The std printer acts as a preliminary sys.stderr until the new io
e510b716bd80 Patch 1352 (continued in issue 1329) by Christian Heimes.
Guido van Rossum <guido@python.org>
parents: 43712
diff changeset
31 infrastructure is in place. */
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 64622
diff changeset
32 #ifndef Py_LIMITED_API
43718
e510b716bd80 Patch 1352 (continued in issue 1329) by Christian Heimes.
Guido van Rossum <guido@python.org>
parents: 43712
diff changeset
33 PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int);
e510b716bd80 Patch 1352 (continued in issue 1329) by Christian Heimes.
Guido van Rossum <guido@python.org>
parents: 43712
diff changeset
34 PyAPI_DATA(PyTypeObject) PyStdPrinter_Type;
e510b716bd80 Patch 1352 (continued in issue 1329) by Christian Heimes.
Guido van Rossum <guido@python.org>
parents: 43712
diff changeset
35
51579
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
36 #if defined _MSC_VER && _MSC_VER >= 1400
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
37 /* A routine to check if a file descriptor is valid on Windows. Returns 0
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
38 * and sets errno to EBADF if it isn't. This is to avoid Assertions
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
39 * from various functions in the Windows CRT beginning with
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
40 * Visual Studio 2005
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
41 */
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
42 int _PyVerify_fd(int fd);
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
43 #else
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
44 #define _PyVerify_fd(A) (1) /* dummy */
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
45 #endif
66664
62b61abd02b8 Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents: 64622
diff changeset
46 #endif /* Py_LIMITED_API */
51579
648e07dd0825 Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents: 49403
diff changeset
47
72115
852ca32eb18d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
Charles-François Natali <neologix@free.fr>
parents: 66664
diff changeset
48 /* A routine to check if a file descriptor can be select()-ed. */
852ca32eb18d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
Charles-François Natali <neologix@free.fr>
parents: 66664
diff changeset
49 #ifdef HAVE_SELECT
852ca32eb18d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
Charles-François Natali <neologix@free.fr>
parents: 66664
diff changeset
50 #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))
852ca32eb18d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
Charles-François Natali <neologix@free.fr>
parents: 66664
diff changeset
51 #else
852ca32eb18d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
Charles-François Natali <neologix@free.fr>
parents: 66664
diff changeset
52 #define _PyIsSelectable_fd(FD) (1)
852ca32eb18d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
Charles-François Natali <neologix@free.fr>
parents: 66664
diff changeset
53 #endif /* HAVE_SELECT */
852ca32eb18d Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
Charles-François Natali <neologix@free.fr>
parents: 66664
diff changeset
54
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
55 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
56 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
57 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
58 #endif /* !Py_FILEOBJECT_H */