Mercurial > cpython-lru_cache-weakref
annotate Include/cStringIO.h @ 27281:5a050200f736 legacy-trunk
When time.localtime() is passed a tick count the platform C localtime()
function can't handle, don't raise IOError -- that doesn't make sense.
Raise ValueError instead.
Bugfix candidate.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Fri, 17 Jan 2003 20:08:54 +0000 |
| parents | 36124157b317 |
| children | 7039375226a7 |
| rev | line source |
|---|---|
|
25554
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24580
diff
changeset
|
1 #ifndef Py_CSTRINGIO_H |
|
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24580
diff
changeset
|
2 #define Py_CSTRINGIO_H |
|
22688
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
3 #ifdef __cplusplus |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
4 extern "C" { |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
5 #endif |
| 4598 | 6 /* |
| 7 | |
| 8 This header provides access to cStringIO objects from C. | |
| 9 Functions are provided for calling cStringIO objects and | |
| 10 macros are provided for testing whether you have cStringIO | |
| 11 objects. | |
| 12 | |
| 13 Before calling any of the functions or macros, you must initialize | |
| 14 the routines with: | |
| 15 | |
|
9944
396a38ea9b84
There's a macro PycString_IMPORT which the documentation listed as
Guido van Rossum <guido@python.org>
parents:
9605
diff
changeset
|
16 PycString_IMPORT |
| 4598 | 17 |
| 18 This would typically be done in your init function. | |
| 19 | |
| 20 */ | |
|
24580
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
21 #define PycString_IMPORT \ |
|
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
22 PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import("cStringIO", \ |
|
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
23 "cStringIO_CAPI") |
| 4598 | 24 |
|
13620
5b727ab37092
Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
Thomas Wouters <thomas@python.org>
parents:
13447
diff
changeset
|
25 /* Basic functions to manipulate cStringIO objects from C */ |
| 4598 | 26 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
27 static struct PycStringIO_CAPI { |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
28 |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
29 /* Read a string. If the last argument is -1, the remainder will be read. */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
30 int(*cread)(PyObject *, char **, int); |
| 4598 | 31 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
32 /* Read a line */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
33 int(*creadline)(PyObject *, char **); |
| 4598 | 34 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
35 /* Write a string */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
36 int(*cwrite)(PyObject *, char *, int); |
| 4598 | 37 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
38 /* Get the cStringIO object as a Python string */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
39 PyObject *(*cgetvalue)(PyObject *); |
| 4598 | 40 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
41 /* Create a new output object */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
42 PyObject *(*NewOutput)(int); |
| 4598 | 43 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
44 /* Create an input object from a Python string */ |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
9944
diff
changeset
|
45 PyObject *(*NewInput)(PyObject *); |
| 4598 | 46 |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
47 /* The Python types for cStringIO input and output objects. |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
48 Note that you can do input on an output object. |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
49 */ |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
50 PyTypeObject *InputType, *OutputType; |
|
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
51 |
|
24580
ca20be24381f
Remove function definition from cStringIO.h.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
22805
diff
changeset
|
52 } *PycStringIO; |
| 4598 | 53 |
| 54 /* These can be used to test if you have one */ | |
| 4902 | 55 #define PycStringIO_InputCheck(O) \ |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
56 ((O)->ob_type==PycStringIO->InputType) |
| 4902 | 57 #define PycStringIO_OutputCheck(O) \ |
|
5279
16372a4c4c14
Changed the way the C API was exported. Jim Fulton.
Guido van Rossum <guido@python.org>
parents:
4902
diff
changeset
|
58 ((O)->ob_type==PycStringIO->OutputType) |
| 4598 | 59 |
|
22688
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
60 #ifdef __cplusplus |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
61 } |
|
c0596f84a8fb
Patch #536908: Add missing #include guards/extern "C".
Martin v. Löwis <martin@v.loewis.de>
parents:
18064
diff
changeset
|
62 #endif |
|
25554
36124157b317
SF # 607253, header file problems by Ralf W. Grosse-Kunstleve
Neal Norwitz <nnorwitz@gmail.com>
parents:
24580
diff
changeset
|
63 #endif /* !Py_CSTRINGIO_H */ |
