Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(_io__BufferedIOBase_readinto__doc__, |
| 6 | "readinto($self, buffer, /)\n" |
| 7 | "--\n" |
| 8 | "\n"); |
| 9 | |
| 10 | #define _IO__BUFFEREDIOBASE_READINTO_METHODDEF \ |
| 11 | {"readinto", (PyCFunction)_io__BufferedIOBase_readinto, METH_O, _io__BufferedIOBase_readinto__doc__}, |
| 12 | |
| 13 | static PyObject * |
| 14 | _io__BufferedIOBase_readinto_impl(PyObject *self, Py_buffer *buffer); |
| 15 | |
| 16 | static PyObject * |
| 17 | _io__BufferedIOBase_readinto(PyObject *self, PyObject *arg) |
| 18 | { |
| 19 | PyObject *return_value = NULL; |
| 20 | Py_buffer buffer = {NULL, NULL}; |
| 21 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 22 | if (!PyArg_Parse(arg, "w*:readinto", &buffer)) |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 23 | goto exit; |
| 24 | return_value = _io__BufferedIOBase_readinto_impl(self, &buffer); |
| 25 | |
| 26 | exit: |
| 27 | /* Cleanup for buffer */ |
| 28 | if (buffer.obj) |
| 29 | PyBuffer_Release(&buffer); |
| 30 | |
| 31 | return return_value; |
| 32 | } |
| 33 | |
| 34 | PyDoc_STRVAR(_io__BufferedIOBase_readinto1__doc__, |
| 35 | "readinto1($self, buffer, /)\n" |
| 36 | "--\n" |
| 37 | "\n"); |
| 38 | |
| 39 | #define _IO__BUFFEREDIOBASE_READINTO1_METHODDEF \ |
| 40 | {"readinto1", (PyCFunction)_io__BufferedIOBase_readinto1, METH_O, _io__BufferedIOBase_readinto1__doc__}, |
| 41 | |
| 42 | static PyObject * |
| 43 | _io__BufferedIOBase_readinto1_impl(PyObject *self, Py_buffer *buffer); |
| 44 | |
| 45 | static PyObject * |
| 46 | _io__BufferedIOBase_readinto1(PyObject *self, PyObject *arg) |
| 47 | { |
| 48 | PyObject *return_value = NULL; |
| 49 | Py_buffer buffer = {NULL, NULL}; |
| 50 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 51 | if (!PyArg_Parse(arg, "w*:readinto1", &buffer)) |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 52 | goto exit; |
| 53 | return_value = _io__BufferedIOBase_readinto1_impl(self, &buffer); |
| 54 | |
| 55 | exit: |
| 56 | /* Cleanup for buffer */ |
| 57 | if (buffer.obj) |
| 58 | PyBuffer_Release(&buffer); |
| 59 | |
| 60 | return return_value; |
| 61 | } |
| 62 | |
| 63 | PyDoc_STRVAR(_io__BufferedIOBase_detach__doc__, |
| 64 | "detach($self, /)\n" |
| 65 | "--\n" |
| 66 | "\n" |
| 67 | "Disconnect this buffer from its underlying raw stream and return it.\n" |
| 68 | "\n" |
| 69 | "After the raw stream has been detached, the buffer is in an unusable\n" |
| 70 | "state."); |
| 71 | |
| 72 | #define _IO__BUFFEREDIOBASE_DETACH_METHODDEF \ |
| 73 | {"detach", (PyCFunction)_io__BufferedIOBase_detach, METH_NOARGS, _io__BufferedIOBase_detach__doc__}, |
| 74 | |
| 75 | static PyObject * |
| 76 | _io__BufferedIOBase_detach_impl(PyObject *self); |
| 77 | |
| 78 | static PyObject * |
| 79 | _io__BufferedIOBase_detach(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 80 | { |
| 81 | return _io__BufferedIOBase_detach_impl(self); |
| 82 | } |
| 83 | |
| 84 | PyDoc_STRVAR(_io__Buffered_peek__doc__, |
| 85 | "peek($self, size=0, /)\n" |
| 86 | "--\n" |
| 87 | "\n"); |
| 88 | |
| 89 | #define _IO__BUFFERED_PEEK_METHODDEF \ |
| 90 | {"peek", (PyCFunction)_io__Buffered_peek, METH_VARARGS, _io__Buffered_peek__doc__}, |
| 91 | |
| 92 | static PyObject * |
| 93 | _io__Buffered_peek_impl(buffered *self, Py_ssize_t size); |
| 94 | |
| 95 | static PyObject * |
| 96 | _io__Buffered_peek(buffered *self, PyObject *args) |
| 97 | { |
| 98 | PyObject *return_value = NULL; |
| 99 | Py_ssize_t size = 0; |
| 100 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 101 | if (!PyArg_ParseTuple(args, "|n:peek", |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 102 | &size)) |
| 103 | goto exit; |
| 104 | return_value = _io__Buffered_peek_impl(self, size); |
| 105 | |
| 106 | exit: |
| 107 | return return_value; |
| 108 | } |
| 109 | |
| 110 | PyDoc_STRVAR(_io__Buffered_read__doc__, |
| 111 | "read($self, size=-1, /)\n" |
| 112 | "--\n" |
| 113 | "\n"); |
| 114 | |
| 115 | #define _IO__BUFFERED_READ_METHODDEF \ |
| 116 | {"read", (PyCFunction)_io__Buffered_read, METH_VARARGS, _io__Buffered_read__doc__}, |
| 117 | |
| 118 | static PyObject * |
| 119 | _io__Buffered_read_impl(buffered *self, Py_ssize_t n); |
| 120 | |
| 121 | static PyObject * |
| 122 | _io__Buffered_read(buffered *self, PyObject *args) |
| 123 | { |
| 124 | PyObject *return_value = NULL; |
| 125 | Py_ssize_t n = -1; |
| 126 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 127 | if (!PyArg_ParseTuple(args, "|O&:read", |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 128 | _PyIO_ConvertSsize_t, &n)) |
| 129 | goto exit; |
| 130 | return_value = _io__Buffered_read_impl(self, n); |
| 131 | |
| 132 | exit: |
| 133 | return return_value; |
| 134 | } |
| 135 | |
| 136 | PyDoc_STRVAR(_io__Buffered_read1__doc__, |
| 137 | "read1($self, size, /)\n" |
| 138 | "--\n" |
| 139 | "\n"); |
| 140 | |
| 141 | #define _IO__BUFFERED_READ1_METHODDEF \ |
| 142 | {"read1", (PyCFunction)_io__Buffered_read1, METH_O, _io__Buffered_read1__doc__}, |
| 143 | |
| 144 | static PyObject * |
| 145 | _io__Buffered_read1_impl(buffered *self, Py_ssize_t n); |
| 146 | |
| 147 | static PyObject * |
| 148 | _io__Buffered_read1(buffered *self, PyObject *arg) |
| 149 | { |
| 150 | PyObject *return_value = NULL; |
| 151 | Py_ssize_t n; |
| 152 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 153 | if (!PyArg_Parse(arg, "n:read1", &n)) |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 154 | goto exit; |
| 155 | return_value = _io__Buffered_read1_impl(self, n); |
| 156 | |
| 157 | exit: |
| 158 | return return_value; |
| 159 | } |
| 160 | |
| 161 | PyDoc_STRVAR(_io__Buffered_readinto__doc__, |
| 162 | "readinto($self, buffer, /)\n" |
| 163 | "--\n" |
| 164 | "\n"); |
| 165 | |
| 166 | #define _IO__BUFFERED_READINTO_METHODDEF \ |
| 167 | {"readinto", (PyCFunction)_io__Buffered_readinto, METH_O, _io__Buffered_readinto__doc__}, |
| 168 | |
| 169 | static PyObject * |
| 170 | _io__Buffered_readinto_impl(buffered *self, Py_buffer *buffer); |
| 171 | |
| 172 | static PyObject * |
| 173 | _io__Buffered_readinto(buffered *self, PyObject *arg) |
| 174 | { |
| 175 | PyObject *return_value = NULL; |
| 176 | Py_buffer buffer = {NULL, NULL}; |
| 177 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 178 | if (!PyArg_Parse(arg, "w*:readinto", &buffer)) |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 179 | goto exit; |
| 180 | return_value = _io__Buffered_readinto_impl(self, &buffer); |
| 181 | |
| 182 | exit: |
| 183 | /* Cleanup for buffer */ |
| 184 | if (buffer.obj) |
| 185 | PyBuffer_Release(&buffer); |
| 186 | |
| 187 | return return_value; |
| 188 | } |
| 189 | |
| 190 | PyDoc_STRVAR(_io__Buffered_readinto1__doc__, |
| 191 | "readinto1($self, buffer, /)\n" |
| 192 | "--\n" |
| 193 | "\n"); |
| 194 | |
| 195 | #define _IO__BUFFERED_READINTO1_METHODDEF \ |
| 196 | {"readinto1", (PyCFunction)_io__Buffered_readinto1, METH_O, _io__Buffered_readinto1__doc__}, |
| 197 | |
| 198 | static PyObject * |
| 199 | _io__Buffered_readinto1_impl(buffered *self, Py_buffer *buffer); |
| 200 | |
| 201 | static PyObject * |
| 202 | _io__Buffered_readinto1(buffered *self, PyObject *arg) |
| 203 | { |
| 204 | PyObject *return_value = NULL; |
| 205 | Py_buffer buffer = {NULL, NULL}; |
| 206 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 207 | if (!PyArg_Parse(arg, "w*:readinto1", &buffer)) |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 208 | goto exit; |
| 209 | return_value = _io__Buffered_readinto1_impl(self, &buffer); |
| 210 | |
| 211 | exit: |
| 212 | /* Cleanup for buffer */ |
| 213 | if (buffer.obj) |
| 214 | PyBuffer_Release(&buffer); |
| 215 | |
| 216 | return return_value; |
| 217 | } |
| 218 | |
| 219 | PyDoc_STRVAR(_io__Buffered_readline__doc__, |
| 220 | "readline($self, size=-1, /)\n" |
| 221 | "--\n" |
| 222 | "\n"); |
| 223 | |
| 224 | #define _IO__BUFFERED_READLINE_METHODDEF \ |
| 225 | {"readline", (PyCFunction)_io__Buffered_readline, METH_VARARGS, _io__Buffered_readline__doc__}, |
| 226 | |
| 227 | static PyObject * |
| 228 | _io__Buffered_readline_impl(buffered *self, Py_ssize_t size); |
| 229 | |
| 230 | static PyObject * |
| 231 | _io__Buffered_readline(buffered *self, PyObject *args) |
| 232 | { |
| 233 | PyObject *return_value = NULL; |
| 234 | Py_ssize_t size = -1; |
| 235 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 236 | if (!PyArg_ParseTuple(args, "|O&:readline", |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 237 | _PyIO_ConvertSsize_t, &size)) |
| 238 | goto exit; |
| 239 | return_value = _io__Buffered_readline_impl(self, size); |
| 240 | |
| 241 | exit: |
| 242 | return return_value; |
| 243 | } |
| 244 | |
| 245 | PyDoc_STRVAR(_io__Buffered_seek__doc__, |
| 246 | "seek($self, target, whence=0, /)\n" |
| 247 | "--\n" |
| 248 | "\n"); |
| 249 | |
| 250 | #define _IO__BUFFERED_SEEK_METHODDEF \ |
| 251 | {"seek", (PyCFunction)_io__Buffered_seek, METH_VARARGS, _io__Buffered_seek__doc__}, |
| 252 | |
| 253 | static PyObject * |
| 254 | _io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence); |
| 255 | |
| 256 | static PyObject * |
| 257 | _io__Buffered_seek(buffered *self, PyObject *args) |
| 258 | { |
| 259 | PyObject *return_value = NULL; |
| 260 | PyObject *targetobj; |
| 261 | int whence = 0; |
| 262 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 263 | if (!PyArg_ParseTuple(args, "O|i:seek", |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 264 | &targetobj, &whence)) |
| 265 | goto exit; |
| 266 | return_value = _io__Buffered_seek_impl(self, targetobj, whence); |
| 267 | |
| 268 | exit: |
| 269 | return return_value; |
| 270 | } |
| 271 | |
| 272 | PyDoc_STRVAR(_io__Buffered_truncate__doc__, |
| 273 | "truncate($self, pos=None, /)\n" |
| 274 | "--\n" |
| 275 | "\n"); |
| 276 | |
| 277 | #define _IO__BUFFERED_TRUNCATE_METHODDEF \ |
| 278 | {"truncate", (PyCFunction)_io__Buffered_truncate, METH_VARARGS, _io__Buffered_truncate__doc__}, |
| 279 | |
| 280 | static PyObject * |
| 281 | _io__Buffered_truncate_impl(buffered *self, PyObject *pos); |
| 282 | |
| 283 | static PyObject * |
| 284 | _io__Buffered_truncate(buffered *self, PyObject *args) |
| 285 | { |
| 286 | PyObject *return_value = NULL; |
| 287 | PyObject *pos = Py_None; |
| 288 | |
| 289 | if (!PyArg_UnpackTuple(args, "truncate", |
| 290 | 0, 1, |
| 291 | &pos)) |
| 292 | goto exit; |
| 293 | return_value = _io__Buffered_truncate_impl(self, pos); |
| 294 | |
| 295 | exit: |
| 296 | return return_value; |
| 297 | } |
| 298 | |
| 299 | PyDoc_STRVAR(_io_BufferedReader___init____doc__, |
| 300 | "BufferedReader(raw, buffer_size=DEFAULT_BUFFER_SIZE)\n" |
| 301 | "--\n" |
| 302 | "\n" |
| 303 | "Create a new buffered reader using the given readable raw IO object."); |
| 304 | |
| 305 | static int |
| 306 | _io_BufferedReader___init___impl(buffered *self, PyObject *raw, |
| 307 | Py_ssize_t buffer_size); |
| 308 | |
| 309 | static int |
| 310 | _io_BufferedReader___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
| 311 | { |
| 312 | int return_value = -1; |
| 313 | static char *_keywords[] = {"raw", "buffer_size", NULL}; |
| 314 | PyObject *raw; |
| 315 | Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; |
| 316 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 317 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|n:BufferedReader", _keywords, |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 318 | &raw, &buffer_size)) |
| 319 | goto exit; |
| 320 | return_value = _io_BufferedReader___init___impl((buffered *)self, raw, buffer_size); |
| 321 | |
| 322 | exit: |
| 323 | return return_value; |
| 324 | } |
| 325 | |
| 326 | PyDoc_STRVAR(_io_BufferedWriter___init____doc__, |
| 327 | "BufferedWriter(raw, buffer_size=DEFAULT_BUFFER_SIZE)\n" |
| 328 | "--\n" |
| 329 | "\n" |
| 330 | "A buffer for a writeable sequential RawIO object.\n" |
| 331 | "\n" |
| 332 | "The constructor creates a BufferedWriter for the given writeable raw\n" |
| 333 | "stream. If the buffer_size is not given, it defaults to\n" |
| 334 | "DEFAULT_BUFFER_SIZE."); |
| 335 | |
| 336 | static int |
| 337 | _io_BufferedWriter___init___impl(buffered *self, PyObject *raw, |
| 338 | Py_ssize_t buffer_size); |
| 339 | |
| 340 | static int |
| 341 | _io_BufferedWriter___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
| 342 | { |
| 343 | int return_value = -1; |
| 344 | static char *_keywords[] = {"raw", "buffer_size", NULL}; |
| 345 | PyObject *raw; |
| 346 | Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; |
| 347 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 348 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|n:BufferedWriter", _keywords, |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 349 | &raw, &buffer_size)) |
| 350 | goto exit; |
| 351 | return_value = _io_BufferedWriter___init___impl((buffered *)self, raw, buffer_size); |
| 352 | |
| 353 | exit: |
| 354 | return return_value; |
| 355 | } |
| 356 | |
| 357 | PyDoc_STRVAR(_io_BufferedWriter_write__doc__, |
| 358 | "write($self, buffer, /)\n" |
| 359 | "--\n" |
| 360 | "\n"); |
| 361 | |
| 362 | #define _IO_BUFFEREDWRITER_WRITE_METHODDEF \ |
| 363 | {"write", (PyCFunction)_io_BufferedWriter_write, METH_O, _io_BufferedWriter_write__doc__}, |
| 364 | |
| 365 | static PyObject * |
| 366 | _io_BufferedWriter_write_impl(buffered *self, Py_buffer *buffer); |
| 367 | |
| 368 | static PyObject * |
| 369 | _io_BufferedWriter_write(buffered *self, PyObject *arg) |
| 370 | { |
| 371 | PyObject *return_value = NULL; |
| 372 | Py_buffer buffer = {NULL, NULL}; |
| 373 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 374 | if (!PyArg_Parse(arg, "y*:write", &buffer)) |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 375 | goto exit; |
| 376 | return_value = _io_BufferedWriter_write_impl(self, &buffer); |
| 377 | |
| 378 | exit: |
| 379 | /* Cleanup for buffer */ |
| 380 | if (buffer.obj) |
| 381 | PyBuffer_Release(&buffer); |
| 382 | |
| 383 | return return_value; |
| 384 | } |
| 385 | |
| 386 | PyDoc_STRVAR(_io_BufferedRWPair___init____doc__, |
| 387 | "BufferedRWPair(reader, writer, buffer_size=DEFAULT_BUFFER_SIZE, /)\n" |
| 388 | "--\n" |
| 389 | "\n" |
| 390 | "A buffered reader and writer object together.\n" |
| 391 | "\n" |
| 392 | "A buffered reader object and buffered writer object put together to\n" |
| 393 | "form a sequential IO object that can read and write. This is typically\n" |
| 394 | "used with a socket or two-way pipe.\n" |
| 395 | "\n" |
| 396 | "reader and writer are RawIOBase objects that are readable and\n" |
| 397 | "writeable respectively. If the buffer_size is omitted it defaults to\n" |
| 398 | "DEFAULT_BUFFER_SIZE."); |
| 399 | |
| 400 | static int |
| 401 | _io_BufferedRWPair___init___impl(rwpair *self, PyObject *reader, |
| 402 | PyObject *writer, Py_ssize_t buffer_size); |
| 403 | |
| 404 | static int |
| 405 | _io_BufferedRWPair___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
| 406 | { |
| 407 | int return_value = -1; |
| 408 | PyObject *reader; |
| 409 | PyObject *writer; |
| 410 | Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; |
| 411 | |
| 412 | if ((Py_TYPE(self) == &PyBufferedRWPair_Type) && |
| 413 | !_PyArg_NoKeywords("BufferedRWPair", kwargs)) |
| 414 | goto exit; |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 415 | if (!PyArg_ParseTuple(args, "OO|n:BufferedRWPair", |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 416 | &reader, &writer, &buffer_size)) |
| 417 | goto exit; |
| 418 | return_value = _io_BufferedRWPair___init___impl((rwpair *)self, reader, writer, buffer_size); |
| 419 | |
| 420 | exit: |
| 421 | return return_value; |
| 422 | } |
| 423 | |
| 424 | PyDoc_STRVAR(_io_BufferedRandom___init____doc__, |
| 425 | "BufferedRandom(raw, buffer_size=DEFAULT_BUFFER_SIZE)\n" |
| 426 | "--\n" |
| 427 | "\n" |
| 428 | "A buffered interface to random access streams.\n" |
| 429 | "\n" |
| 430 | "The constructor creates a reader and writer for a seekable stream,\n" |
| 431 | "raw, given in the first argument. If the buffer_size is omitted it\n" |
| 432 | "defaults to DEFAULT_BUFFER_SIZE."); |
| 433 | |
| 434 | static int |
| 435 | _io_BufferedRandom___init___impl(buffered *self, PyObject *raw, |
| 436 | Py_ssize_t buffer_size); |
| 437 | |
| 438 | static int |
| 439 | _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
| 440 | { |
| 441 | int return_value = -1; |
| 442 | static char *_keywords[] = {"raw", "buffer_size", NULL}; |
| 443 | PyObject *raw; |
| 444 | Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; |
| 445 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 446 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|n:BufferedRandom", _keywords, |
Serhiy Storchaka | f24131f | 2015-04-16 11:19:43 +0300 | [diff] [blame] | 447 | &raw, &buffer_size)) |
| 448 | goto exit; |
| 449 | return_value = _io_BufferedRandom___init___impl((buffered *)self, raw, buffer_size); |
| 450 | |
| 451 | exit: |
| 452 | return return_value; |
| 453 | } |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 454 | /*[clinic end generated code: output=2bbb5e239b4ffe6f input=a9049054013a1b77]*/ |