| 1 |
/*[clinic input] |
| 2 |
preserve |
| 3 |
[clinic start generated code]*/ |
| 4 |
|
| 5 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 6 |
# include "pycore_gc.h" // PyGC_Head |
| 7 |
# include "pycore_runtime.h" // _Py_ID() |
| 8 |
#endif |
| 9 |
#include "pycore_abstract.h" // _Py_convert_optional_to_ssize_t() |
| 10 |
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION() |
| 11 |
#include "pycore_modsupport.h" // _PyArg_CheckPositional() |
| 12 |
|
| 13 |
PyDoc_STRVAR(_io_StringIO_getvalue__doc__, |
| 14 |
"getvalue($self, /)\n" |
| 15 |
"--\n" |
| 16 |
"\n" |
| 17 |
"Retrieve the entire contents of the object."); |
| 18 |
|
| 19 |
#define _IO_STRINGIO_GETVALUE_METHODDEF \ |
| 20 |
{"getvalue", (PyCFunction)_io_StringIO_getvalue, METH_NOARGS, _io_StringIO_getvalue__doc__}, |
| 21 |
|
| 22 |
static PyObject * |
| 23 |
_io_StringIO_getvalue_impl(stringio *self); |
| 24 |
|
| 25 |
static PyObject * |
| 26 |
_io_StringIO_getvalue(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 27 |
{ |
| 28 |
PyObject *return_value = NULL; |
| 29 |
|
| 30 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 31 |
return_value = _io_StringIO_getvalue_impl((stringio *)self); |
| 32 |
Py_END_CRITICAL_SECTION(); |
| 33 |
|
| 34 |
return return_value; |
| 35 |
} |
| 36 |
|
| 37 |
PyDoc_STRVAR(_io_StringIO_tell__doc__, |
| 38 |
"tell($self, /)\n" |
| 39 |
"--\n" |
| 40 |
"\n" |
| 41 |
"Tell the current file position."); |
| 42 |
|
| 43 |
#define _IO_STRINGIO_TELL_METHODDEF \ |
| 44 |
{"tell", (PyCFunction)_io_StringIO_tell, METH_NOARGS, _io_StringIO_tell__doc__}, |
| 45 |
|
| 46 |
static PyObject * |
| 47 |
_io_StringIO_tell_impl(stringio *self); |
| 48 |
|
| 49 |
static PyObject * |
| 50 |
_io_StringIO_tell(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 51 |
{ |
| 52 |
PyObject *return_value = NULL; |
| 53 |
|
| 54 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 55 |
return_value = _io_StringIO_tell_impl((stringio *)self); |
| 56 |
Py_END_CRITICAL_SECTION(); |
| 57 |
|
| 58 |
return return_value; |
| 59 |
} |
| 60 |
|
| 61 |
PyDoc_STRVAR(_io_StringIO_read__doc__, |
| 62 |
"read($self, size=-1, /)\n" |
| 63 |
"--\n" |
| 64 |
"\n" |
| 65 |
"Read at most size characters, returned as a string.\n" |
| 66 |
"\n" |
| 67 |
"If the argument is negative or omitted, read until EOF\n" |
| 68 |
"is reached. Return an empty string at EOF."); |
| 69 |
|
| 70 |
#define _IO_STRINGIO_READ_METHODDEF \ |
| 71 |
{"read", _PyCFunction_CAST(_io_StringIO_read), METH_FASTCALL, _io_StringIO_read__doc__}, |
| 72 |
|
| 73 |
static PyObject * |
| 74 |
_io_StringIO_read_impl(stringio *self, Py_ssize_t size); |
| 75 |
|
| 76 |
static PyObject * |
| 77 |
_io_StringIO_read(PyObject *self, PyObject *const *args, Py_ssize_t nargs) |
| 78 |
{ |
| 79 |
PyObject *return_value = NULL; |
| 80 |
Py_ssize_t size = -1; |
| 81 |
|
| 82 |
if (!_PyArg_CheckPositional("read", nargs, 0, 1)) { |
| 83 |
goto exit; |
| 84 |
} |
| 85 |
if (nargs < 1) { |
| 86 |
goto skip_optional; |
| 87 |
} |
| 88 |
if (!_Py_convert_optional_to_ssize_t(args[0], &size)) { |
| 89 |
goto exit; |
| 90 |
} |
| 91 |
skip_optional: |
| 92 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 93 |
return_value = _io_StringIO_read_impl((stringio *)self, size); |
| 94 |
Py_END_CRITICAL_SECTION(); |
| 95 |
|
| 96 |
exit: |
| 97 |
return return_value; |
| 98 |
} |
| 99 |
|
| 100 |
PyDoc_STRVAR(_io_StringIO_readline__doc__, |
| 101 |
"readline($self, size=-1, /)\n" |
| 102 |
"--\n" |
| 103 |
"\n" |
| 104 |
"Read until newline or EOF.\n" |
| 105 |
"\n" |
| 106 |
"Returns an empty string if EOF is hit immediately."); |
| 107 |
|
| 108 |
#define _IO_STRINGIO_READLINE_METHODDEF \ |
| 109 |
{"readline", _PyCFunction_CAST(_io_StringIO_readline), METH_FASTCALL, _io_StringIO_readline__doc__}, |
| 110 |
|
| 111 |
static PyObject * |
| 112 |
_io_StringIO_readline_impl(stringio *self, Py_ssize_t size); |
| 113 |
|
| 114 |
static PyObject * |
| 115 |
_io_StringIO_readline(PyObject *self, PyObject *const *args, Py_ssize_t nargs) |
| 116 |
{ |
| 117 |
PyObject *return_value = NULL; |
| 118 |
Py_ssize_t size = -1; |
| 119 |
|
| 120 |
if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) { |
| 121 |
goto exit; |
| 122 |
} |
| 123 |
if (nargs < 1) { |
| 124 |
goto skip_optional; |
| 125 |
} |
| 126 |
if (!_Py_convert_optional_to_ssize_t(args[0], &size)) { |
| 127 |
goto exit; |
| 128 |
} |
| 129 |
skip_optional: |
| 130 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 131 |
return_value = _io_StringIO_readline_impl((stringio *)self, size); |
| 132 |
Py_END_CRITICAL_SECTION(); |
| 133 |
|
| 134 |
exit: |
| 135 |
return return_value; |
| 136 |
} |
| 137 |
|
| 138 |
PyDoc_STRVAR(_io_StringIO_truncate__doc__, |
| 139 |
"truncate($self, pos=None, /)\n" |
| 140 |
"--\n" |
| 141 |
"\n" |
| 142 |
"Truncate size to pos.\n" |
| 143 |
"\n" |
| 144 |
"The pos argument defaults to the current file position, as\n" |
| 145 |
"returned by tell(). The current file position is unchanged.\n" |
| 146 |
"Returns the new absolute position."); |
| 147 |
|
| 148 |
#define _IO_STRINGIO_TRUNCATE_METHODDEF \ |
| 149 |
{"truncate", _PyCFunction_CAST(_io_StringIO_truncate), METH_FASTCALL, _io_StringIO_truncate__doc__}, |
| 150 |
|
| 151 |
static PyObject * |
| 152 |
_io_StringIO_truncate_impl(stringio *self, Py_ssize_t size); |
| 153 |
|
| 154 |
static PyObject * |
| 155 |
_io_StringIO_truncate(PyObject *self, PyObject *const *args, Py_ssize_t nargs) |
| 156 |
{ |
| 157 |
PyObject *return_value = NULL; |
| 158 |
Py_ssize_t size = ((stringio *)self)->pos; |
| 159 |
|
| 160 |
if (!_PyArg_CheckPositional("truncate", nargs, 0, 1)) { |
| 161 |
goto exit; |
| 162 |
} |
| 163 |
if (nargs < 1) { |
| 164 |
goto skip_optional; |
| 165 |
} |
| 166 |
if (!_Py_convert_optional_to_ssize_t(args[0], &size)) { |
| 167 |
goto exit; |
| 168 |
} |
| 169 |
skip_optional: |
| 170 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 171 |
return_value = _io_StringIO_truncate_impl((stringio *)self, size); |
| 172 |
Py_END_CRITICAL_SECTION(); |
| 173 |
|
| 174 |
exit: |
| 175 |
return return_value; |
| 176 |
} |
| 177 |
|
| 178 |
PyDoc_STRVAR(_io_StringIO_seek__doc__, |
| 179 |
"seek($self, pos, whence=0, /)\n" |
| 180 |
"--\n" |
| 181 |
"\n" |
| 182 |
"Change stream position.\n" |
| 183 |
"\n" |
| 184 |
"Seek to character offset pos relative to position indicated by whence:\n" |
| 185 |
" 0 Start of stream (the default). pos should be >= 0;\n" |
| 186 |
" 1 Current position - pos must be 0;\n" |
| 187 |
" 2 End of stream - pos must be 0.\n" |
| 188 |
"Returns the new absolute position."); |
| 189 |
|
| 190 |
#define _IO_STRINGIO_SEEK_METHODDEF \ |
| 191 |
{"seek", _PyCFunction_CAST(_io_StringIO_seek), METH_FASTCALL, _io_StringIO_seek__doc__}, |
| 192 |
|
| 193 |
static PyObject * |
| 194 |
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence); |
| 195 |
|
| 196 |
static PyObject * |
| 197 |
_io_StringIO_seek(PyObject *self, PyObject *const *args, Py_ssize_t nargs) |
| 198 |
{ |
| 199 |
PyObject *return_value = NULL; |
| 200 |
Py_ssize_t pos; |
| 201 |
int whence = 0; |
| 202 |
|
| 203 |
if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) { |
| 204 |
goto exit; |
| 205 |
} |
| 206 |
{ |
| 207 |
Py_ssize_t ival = -1; |
| 208 |
PyObject *iobj = _PyNumber_Index(args[0]); |
| 209 |
if (iobj != NULL) { |
| 210 |
ival = PyLong_AsSsize_t(iobj); |
| 211 |
Py_DECREF(iobj); |
| 212 |
} |
| 213 |
if (ival == -1 && PyErr_Occurred()) { |
| 214 |
goto exit; |
| 215 |
} |
| 216 |
pos = ival; |
| 217 |
} |
| 218 |
if (nargs < 2) { |
| 219 |
goto skip_optional; |
| 220 |
} |
| 221 |
whence = PyLong_AsInt(args[1]); |
| 222 |
if (whence == -1 && PyErr_Occurred()) { |
| 223 |
goto exit; |
| 224 |
} |
| 225 |
skip_optional: |
| 226 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 227 |
return_value = _io_StringIO_seek_impl((stringio *)self, pos, whence); |
| 228 |
Py_END_CRITICAL_SECTION(); |
| 229 |
|
| 230 |
exit: |
| 231 |
return return_value; |
| 232 |
} |
| 233 |
|
| 234 |
PyDoc_STRVAR(_io_StringIO_write__doc__, |
| 235 |
"write($self, s, /)\n" |
| 236 |
"--\n" |
| 237 |
"\n" |
| 238 |
"Write string to file.\n" |
| 239 |
"\n" |
| 240 |
"Returns the number of characters written, which is always equal to\n" |
| 241 |
"the length of the string."); |
| 242 |
|
| 243 |
#define _IO_STRINGIO_WRITE_METHODDEF \ |
| 244 |
{"write", (PyCFunction)_io_StringIO_write, METH_O, _io_StringIO_write__doc__}, |
| 245 |
|
| 246 |
static PyObject * |
| 247 |
_io_StringIO_write_impl(stringio *self, PyObject *obj); |
| 248 |
|
| 249 |
static PyObject * |
| 250 |
_io_StringIO_write(PyObject *self, PyObject *obj) |
| 251 |
{ |
| 252 |
PyObject *return_value = NULL; |
| 253 |
|
| 254 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 255 |
return_value = _io_StringIO_write_impl((stringio *)self, obj); |
| 256 |
Py_END_CRITICAL_SECTION(); |
| 257 |
|
| 258 |
return return_value; |
| 259 |
} |
| 260 |
|
| 261 |
PyDoc_STRVAR(_io_StringIO_close__doc__, |
| 262 |
"close($self, /)\n" |
| 263 |
"--\n" |
| 264 |
"\n" |
| 265 |
"Close the IO object.\n" |
| 266 |
"\n" |
| 267 |
"Attempting any further operation after the object is closed\n" |
| 268 |
"will raise a ValueError.\n" |
| 269 |
"\n" |
| 270 |
"This method has no effect if the file is already closed."); |
| 271 |
|
| 272 |
#define _IO_STRINGIO_CLOSE_METHODDEF \ |
| 273 |
{"close", (PyCFunction)_io_StringIO_close, METH_NOARGS, _io_StringIO_close__doc__}, |
| 274 |
|
| 275 |
static PyObject * |
| 276 |
_io_StringIO_close_impl(stringio *self); |
| 277 |
|
| 278 |
static PyObject * |
| 279 |
_io_StringIO_close(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 280 |
{ |
| 281 |
PyObject *return_value = NULL; |
| 282 |
|
| 283 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 284 |
return_value = _io_StringIO_close_impl((stringio *)self); |
| 285 |
Py_END_CRITICAL_SECTION(); |
| 286 |
|
| 287 |
return return_value; |
| 288 |
} |
| 289 |
|
| 290 |
PyDoc_STRVAR(_io_StringIO___init____doc__, |
| 291 |
"StringIO(initial_value=\'\', newline=\'\\n\')\n" |
| 292 |
"--\n" |
| 293 |
"\n" |
| 294 |
"Text I/O implementation using an in-memory buffer.\n" |
| 295 |
"\n" |
| 296 |
"The initial_value argument sets the value of object. The newline\n" |
| 297 |
"argument is like the one of TextIOWrapper\'s constructor."); |
| 298 |
|
| 299 |
static int |
| 300 |
_io_StringIO___init___impl(stringio *self, PyObject *value, |
| 301 |
PyObject *newline_obj); |
| 302 |
|
| 303 |
static int |
| 304 |
_io_StringIO___init__(PyObject *self, PyObject *args, PyObject *kwargs) |
| 305 |
{ |
| 306 |
int return_value = -1; |
| 307 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 308 |
|
| 309 |
#define NUM_KEYWORDS 2 |
| 310 |
static struct { |
| 311 |
PyGC_Head _this_is_not_used; |
| 312 |
PyObject_VAR_HEAD |
| 313 |
Py_hash_t ob_hash; |
| 314 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 315 |
} _kwtuple = { |
| 316 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 317 |
.ob_hash = -1, |
| 318 |
.ob_item = { &_Py_ID(initial_value), &_Py_ID(newline), }, |
| 319 |
}; |
| 320 |
#undef NUM_KEYWORDS |
| 321 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 322 |
|
| 323 |
#else // !Py_BUILD_CORE |
| 324 |
# define KWTUPLE NULL |
| 325 |
#endif // !Py_BUILD_CORE |
| 326 |
|
| 327 |
static const char * const _keywords[] = {"initial_value", "newline", NULL}; |
| 328 |
static _PyArg_Parser _parser = { |
| 329 |
.keywords = _keywords, |
| 330 |
.fname = "StringIO", |
| 331 |
.kwtuple = KWTUPLE, |
| 332 |
}; |
| 333 |
#undef KWTUPLE |
| 334 |
PyObject *argsbuf[2]; |
| 335 |
PyObject * const *fastargs; |
| 336 |
Py_ssize_t nargs = PyTuple_GET_SIZE(args); |
| 337 |
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0; |
| 338 |
PyObject *value = NULL; |
| 339 |
PyObject *newline_obj = NULL; |
| 340 |
|
| 341 |
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, |
| 342 |
/*minpos*/ 0, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 343 |
if (!fastargs) { |
| 344 |
goto exit; |
| 345 |
} |
| 346 |
if (!noptargs) { |
| 347 |
goto skip_optional_pos; |
| 348 |
} |
| 349 |
if (fastargs[0]) { |
| 350 |
value = fastargs[0]; |
| 351 |
if (!--noptargs) { |
| 352 |
goto skip_optional_pos; |
| 353 |
} |
| 354 |
} |
| 355 |
newline_obj = fastargs[1]; |
| 356 |
skip_optional_pos: |
| 357 |
return_value = _io_StringIO___init___impl((stringio *)self, value, newline_obj); |
| 358 |
|
| 359 |
exit: |
| 360 |
return return_value; |
| 361 |
} |
| 362 |
|
| 363 |
PyDoc_STRVAR(_io_StringIO_readable__doc__, |
| 364 |
"readable($self, /)\n" |
| 365 |
"--\n" |
| 366 |
"\n" |
| 367 |
"Returns True if the IO object can be read."); |
| 368 |
|
| 369 |
#define _IO_STRINGIO_READABLE_METHODDEF \ |
| 370 |
{"readable", (PyCFunction)_io_StringIO_readable, METH_NOARGS, _io_StringIO_readable__doc__}, |
| 371 |
|
| 372 |
static PyObject * |
| 373 |
_io_StringIO_readable_impl(stringio *self); |
| 374 |
|
| 375 |
static PyObject * |
| 376 |
_io_StringIO_readable(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 377 |
{ |
| 378 |
PyObject *return_value = NULL; |
| 379 |
|
| 380 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 381 |
return_value = _io_StringIO_readable_impl((stringio *)self); |
| 382 |
Py_END_CRITICAL_SECTION(); |
| 383 |
|
| 384 |
return return_value; |
| 385 |
} |
| 386 |
|
| 387 |
PyDoc_STRVAR(_io_StringIO_writable__doc__, |
| 388 |
"writable($self, /)\n" |
| 389 |
"--\n" |
| 390 |
"\n" |
| 391 |
"Returns True if the IO object can be written."); |
| 392 |
|
| 393 |
#define _IO_STRINGIO_WRITABLE_METHODDEF \ |
| 394 |
{"writable", (PyCFunction)_io_StringIO_writable, METH_NOARGS, _io_StringIO_writable__doc__}, |
| 395 |
|
| 396 |
static PyObject * |
| 397 |
_io_StringIO_writable_impl(stringio *self); |
| 398 |
|
| 399 |
static PyObject * |
| 400 |
_io_StringIO_writable(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 401 |
{ |
| 402 |
PyObject *return_value = NULL; |
| 403 |
|
| 404 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 405 |
return_value = _io_StringIO_writable_impl((stringio *)self); |
| 406 |
Py_END_CRITICAL_SECTION(); |
| 407 |
|
| 408 |
return return_value; |
| 409 |
} |
| 410 |
|
| 411 |
PyDoc_STRVAR(_io_StringIO_seekable__doc__, |
| 412 |
"seekable($self, /)\n" |
| 413 |
"--\n" |
| 414 |
"\n" |
| 415 |
"Returns True if the IO object can be seeked."); |
| 416 |
|
| 417 |
#define _IO_STRINGIO_SEEKABLE_METHODDEF \ |
| 418 |
{"seekable", (PyCFunction)_io_StringIO_seekable, METH_NOARGS, _io_StringIO_seekable__doc__}, |
| 419 |
|
| 420 |
static PyObject * |
| 421 |
_io_StringIO_seekable_impl(stringio *self); |
| 422 |
|
| 423 |
static PyObject * |
| 424 |
_io_StringIO_seekable(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 425 |
{ |
| 426 |
PyObject *return_value = NULL; |
| 427 |
|
| 428 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 429 |
return_value = _io_StringIO_seekable_impl((stringio *)self); |
| 430 |
Py_END_CRITICAL_SECTION(); |
| 431 |
|
| 432 |
return return_value; |
| 433 |
} |
| 434 |
|
| 435 |
PyDoc_STRVAR(_io_StringIO___getstate____doc__, |
| 436 |
"__getstate__($self, /)\n" |
| 437 |
"--\n" |
| 438 |
"\n"); |
| 439 |
|
| 440 |
#define _IO_STRINGIO___GETSTATE___METHODDEF \ |
| 441 |
{"__getstate__", (PyCFunction)_io_StringIO___getstate__, METH_NOARGS, _io_StringIO___getstate____doc__}, |
| 442 |
|
| 443 |
static PyObject * |
| 444 |
_io_StringIO___getstate___impl(stringio *self); |
| 445 |
|
| 446 |
static PyObject * |
| 447 |
_io_StringIO___getstate__(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 448 |
{ |
| 449 |
PyObject *return_value = NULL; |
| 450 |
|
| 451 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 452 |
return_value = _io_StringIO___getstate___impl((stringio *)self); |
| 453 |
Py_END_CRITICAL_SECTION(); |
| 454 |
|
| 455 |
return return_value; |
| 456 |
} |
| 457 |
|
| 458 |
PyDoc_STRVAR(_io_StringIO___setstate____doc__, |
| 459 |
"__setstate__($self, state, /)\n" |
| 460 |
"--\n" |
| 461 |
"\n"); |
| 462 |
|
| 463 |
#define _IO_STRINGIO___SETSTATE___METHODDEF \ |
| 464 |
{"__setstate__", (PyCFunction)_io_StringIO___setstate__, METH_O, _io_StringIO___setstate____doc__}, |
| 465 |
|
| 466 |
static PyObject * |
| 467 |
_io_StringIO___setstate___impl(stringio *self, PyObject *state); |
| 468 |
|
| 469 |
static PyObject * |
| 470 |
_io_StringIO___setstate__(PyObject *self, PyObject *state) |
| 471 |
{ |
| 472 |
PyObject *return_value = NULL; |
| 473 |
|
| 474 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 475 |
return_value = _io_StringIO___setstate___impl((stringio *)self, state); |
| 476 |
Py_END_CRITICAL_SECTION(); |
| 477 |
|
| 478 |
return return_value; |
| 479 |
} |
| 480 |
|
| 481 |
#if !defined(_io_StringIO_closed_DOCSTR) |
| 482 |
# define _io_StringIO_closed_DOCSTR NULL |
| 483 |
#endif |
| 484 |
#if defined(_IO_STRINGIO_CLOSED_GETSETDEF) |
| 485 |
# undef _IO_STRINGIO_CLOSED_GETSETDEF |
| 486 |
# define _IO_STRINGIO_CLOSED_GETSETDEF {"closed", (getter)_io_StringIO_closed_get, (setter)_io_StringIO_closed_set, _io_StringIO_closed_DOCSTR}, |
| 487 |
#else |
| 488 |
# define _IO_STRINGIO_CLOSED_GETSETDEF {"closed", (getter)_io_StringIO_closed_get, NULL, _io_StringIO_closed_DOCSTR}, |
| 489 |
#endif |
| 490 |
|
| 491 |
static PyObject * |
| 492 |
_io_StringIO_closed_get_impl(stringio *self); |
| 493 |
|
| 494 |
static PyObject * |
| 495 |
_io_StringIO_closed_get(PyObject *self, void *Py_UNUSED(context)) |
| 496 |
{ |
| 497 |
PyObject *return_value = NULL; |
| 498 |
|
| 499 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 500 |
return_value = _io_StringIO_closed_get_impl((stringio *)self); |
| 501 |
Py_END_CRITICAL_SECTION(); |
| 502 |
|
| 503 |
return return_value; |
| 504 |
} |
| 505 |
|
| 506 |
#if !defined(_io_StringIO_line_buffering_DOCSTR) |
| 507 |
# define _io_StringIO_line_buffering_DOCSTR NULL |
| 508 |
#endif |
| 509 |
#if defined(_IO_STRINGIO_LINE_BUFFERING_GETSETDEF) |
| 510 |
# undef _IO_STRINGIO_LINE_BUFFERING_GETSETDEF |
| 511 |
# define _IO_STRINGIO_LINE_BUFFERING_GETSETDEF {"line_buffering", (getter)_io_StringIO_line_buffering_get, (setter)_io_StringIO_line_buffering_set, _io_StringIO_line_buffering_DOCSTR}, |
| 512 |
#else |
| 513 |
# define _IO_STRINGIO_LINE_BUFFERING_GETSETDEF {"line_buffering", (getter)_io_StringIO_line_buffering_get, NULL, _io_StringIO_line_buffering_DOCSTR}, |
| 514 |
#endif |
| 515 |
|
| 516 |
static PyObject * |
| 517 |
_io_StringIO_line_buffering_get_impl(stringio *self); |
| 518 |
|
| 519 |
static PyObject * |
| 520 |
_io_StringIO_line_buffering_get(PyObject *self, void *Py_UNUSED(context)) |
| 521 |
{ |
| 522 |
PyObject *return_value = NULL; |
| 523 |
|
| 524 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 525 |
return_value = _io_StringIO_line_buffering_get_impl((stringio *)self); |
| 526 |
Py_END_CRITICAL_SECTION(); |
| 527 |
|
| 528 |
return return_value; |
| 529 |
} |
| 530 |
|
| 531 |
#if !defined(_io_StringIO_newlines_DOCSTR) |
| 532 |
# define _io_StringIO_newlines_DOCSTR NULL |
| 533 |
#endif |
| 534 |
#if defined(_IO_STRINGIO_NEWLINES_GETSETDEF) |
| 535 |
# undef _IO_STRINGIO_NEWLINES_GETSETDEF |
| 536 |
# define _IO_STRINGIO_NEWLINES_GETSETDEF {"newlines", (getter)_io_StringIO_newlines_get, (setter)_io_StringIO_newlines_set, _io_StringIO_newlines_DOCSTR}, |
| 537 |
#else |
| 538 |
# define _IO_STRINGIO_NEWLINES_GETSETDEF {"newlines", (getter)_io_StringIO_newlines_get, NULL, _io_StringIO_newlines_DOCSTR}, |
| 539 |
#endif |
| 540 |
|
| 541 |
static PyObject * |
| 542 |
_io_StringIO_newlines_get_impl(stringio *self); |
| 543 |
|
| 544 |
static PyObject * |
| 545 |
_io_StringIO_newlines_get(PyObject *self, void *Py_UNUSED(context)) |
| 546 |
{ |
| 547 |
PyObject *return_value = NULL; |
| 548 |
|
| 549 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 550 |
return_value = _io_StringIO_newlines_get_impl((stringio *)self); |
| 551 |
Py_END_CRITICAL_SECTION(); |
| 552 |
|
| 553 |
return return_value; |
| 554 |
} |
| 555 |
/*[clinic end generated code: output=5bfaaab7f41ee6b5 input=a9049054013a1b77]*/ |