|
10 | 10 | #include "Python.h"
|
11 | 11 | #include "pycore_bytesobject.h" // _PyBytes_Join()
|
12 | 12 | #include "pycore_call.h" // _PyObject_CallNoArgs()
|
13 |
| -#include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION() |
14 | 13 | #include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
15 | 14 | #include "pycore_pyerrors.h" // _Py_FatalErrorFormat()
|
16 | 15 | #include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
|
@@ -518,25 +517,20 @@ buffered_closed(buffered *self)
|
518 | 517 | return closed;
|
519 | 518 | }
|
520 | 519 |
|
| 520 | +/*[clinic input] |
| 521 | +@critical_section |
| 522 | +@getter |
| 523 | +_io._Buffered.closed |
| 524 | +[clinic start generated code]*/ |
| 525 | + |
521 | 526 | static PyObject *
|
522 |
| -buffered_closed_get_impl(buffered *self, void *context) |
| 527 | +_io__Buffered_closed_get_impl(buffered *self) |
| 528 | +/*[clinic end generated code: output=f08ce57290703a1a input=18eddefdfe4a3d2f]*/ |
523 | 529 | {
|
524 | 530 | CHECK_INITIALIZED(self)
|
525 | 531 | return PyObject_GetAttr(self->raw, &_Py_ID(closed));
|
526 | 532 | }
|
527 | 533 |
|
528 |
| -static PyObject * |
529 |
| -buffered_closed_get(buffered *self, void *context) |
530 |
| -{ |
531 |
| - PyObject *return_value = NULL; |
532 |
| - |
533 |
| - Py_BEGIN_CRITICAL_SECTION(self); |
534 |
| - return_value = buffered_closed_get_impl(self, context); |
535 |
| - Py_END_CRITICAL_SECTION(); |
536 |
| - |
537 |
| - return return_value; |
538 |
| -} |
539 |
| - |
540 | 534 | /*[clinic input]
|
541 | 535 | @critical_section
|
542 | 536 | _io._Buffered.close
|
@@ -662,44 +656,35 @@ _io__Buffered_writable_impl(buffered *self)
|
662 | 656 | return PyObject_CallMethodNoArgs(self->raw, &_Py_ID(writable));
|
663 | 657 | }
|
664 | 658 |
|
| 659 | + |
| 660 | +/*[clinic input] |
| 661 | +@critical_section |
| 662 | +@getter |
| 663 | +_io._Buffered.name |
| 664 | +[clinic start generated code]*/ |
| 665 | + |
665 | 666 | static PyObject *
|
666 |
| -buffered_name_get_impl(buffered *self, void *context) |
| 667 | +_io__Buffered_name_get_impl(buffered *self) |
| 668 | +/*[clinic end generated code: output=d2adf384051d3d10 input=6b84a0e6126f545e]*/ |
667 | 669 | {
|
668 | 670 | CHECK_INITIALIZED(self)
|
669 | 671 | return PyObject_GetAttr(self->raw, &_Py_ID(name));
|
670 | 672 | }
|
671 | 673 |
|
672 |
| -static PyObject * |
673 |
| -buffered_name_get(buffered *self, void *context) |
674 |
| -{ |
675 |
| - PyObject *return_value = NULL; |
676 |
| - |
677 |
| - Py_BEGIN_CRITICAL_SECTION(self); |
678 |
| - return_value = buffered_name_get_impl(self, context); |
679 |
| - Py_END_CRITICAL_SECTION(); |
680 |
| - |
681 |
| - return return_value; |
682 |
| -} |
| 674 | +/*[clinic input] |
| 675 | +@critical_section |
| 676 | +@getter |
| 677 | +_io._Buffered.mode |
| 678 | +[clinic start generated code]*/ |
683 | 679 |
|
684 | 680 | static PyObject *
|
685 |
| -buffered_mode_get_impl(buffered *self, void *context) |
| 681 | +_io__Buffered_mode_get_impl(buffered *self) |
| 682 | +/*[clinic end generated code: output=0feb205748892fa4 input=0762d5e28542fd8c]*/ |
686 | 683 | {
|
687 | 684 | CHECK_INITIALIZED(self)
|
688 | 685 | return PyObject_GetAttr(self->raw, &_Py_ID(mode));
|
689 | 686 | }
|
690 | 687 |
|
691 |
| -static PyObject * |
692 |
| -buffered_mode_get(buffered *self, void *context) |
693 |
| -{ |
694 |
| - PyObject *return_value = NULL; |
695 |
| - |
696 |
| - Py_BEGIN_CRITICAL_SECTION(self); |
697 |
| - return_value = buffered_mode_get_impl(self, context); |
698 |
| - Py_END_CRITICAL_SECTION(); |
699 |
| - |
700 |
| - return return_value; |
701 |
| -} |
702 |
| - |
703 | 688 | /* Lower-level APIs */
|
704 | 689 |
|
705 | 690 | /*[clinic input]
|
@@ -2541,9 +2526,9 @@ static PyMemberDef bufferedreader_members[] = {
|
2541 | 2526 | };
|
2542 | 2527 |
|
2543 | 2528 | static PyGetSetDef bufferedreader_getset[] = {
|
2544 |
| - {"closed", (getter)buffered_closed_get, NULL, NULL}, |
2545 |
| - {"name", (getter)buffered_name_get, NULL, NULL}, |
2546 |
| - {"mode", (getter)buffered_mode_get, NULL, NULL}, |
| 2529 | + _IO__BUFFERED_CLOSED_GETTERDEF |
| 2530 | + _IO__BUFFERED_NAME_GETTERDEF |
| 2531 | + _IO__BUFFERED_MODE_GETTERDEF |
2547 | 2532 | {NULL}
|
2548 | 2533 | };
|
2549 | 2534 |
|
@@ -2601,9 +2586,9 @@ static PyMemberDef bufferedwriter_members[] = {
|
2601 | 2586 | };
|
2602 | 2587 |
|
2603 | 2588 | static PyGetSetDef bufferedwriter_getset[] = {
|
2604 |
| - {"closed", (getter)buffered_closed_get, NULL, NULL}, |
2605 |
| - {"name", (getter)buffered_name_get, NULL, NULL}, |
2606 |
| - {"mode", (getter)buffered_mode_get, NULL, NULL}, |
| 2589 | + _IO__BUFFERED_CLOSED_GETTERDEF |
| 2590 | + _IO__BUFFERED_NAME_GETTERDEF |
| 2591 | + _IO__BUFFERED_MODE_GETTERDEF |
2607 | 2592 | {NULL}
|
2608 | 2593 | };
|
2609 | 2594 |
|
@@ -2719,9 +2704,9 @@ static PyMemberDef bufferedrandom_members[] = {
|
2719 | 2704 | };
|
2720 | 2705 |
|
2721 | 2706 | static PyGetSetDef bufferedrandom_getset[] = {
|
2722 |
| - {"closed", (getter)buffered_closed_get, NULL, NULL}, |
2723 |
| - {"name", (getter)buffered_name_get, NULL, NULL}, |
2724 |
| - {"mode", (getter)buffered_mode_get, NULL, NULL}, |
| 2707 | + _IO__BUFFERED_CLOSED_GETTERDEF |
| 2708 | + _IO__BUFFERED_NAME_GETTERDEF |
| 2709 | + _IO__BUFFERED_MODE_GETTERDEF |
2725 | 2710 | {NULL}
|
2726 | 2711 | };
|
2727 | 2712 |
|
|
0 commit comments