File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -746,26 +746,26 @@ _buffered_init(buffered *self)
746
746
int
747
747
_PyIO_trap_eintr (void )
748
748
{
749
- static PyObject * eintr_int = NULL ;
750
749
PyObject * typ , * val , * tb ;
751
750
PyOSErrorObject * env_err ;
752
-
753
- if (eintr_int == NULL ) {
754
- eintr_int = PyLong_FromLong (EINTR );
755
- assert (eintr_int != NULL );
756
- }
757
751
if (!PyErr_ExceptionMatches (PyExc_OSError ))
758
752
return 0 ;
759
753
PyErr_Fetch (& typ , & val , & tb );
760
754
PyErr_NormalizeException (& typ , & val , & tb );
761
755
env_err = (PyOSErrorObject * ) val ;
762
756
assert (env_err != NULL );
763
- if (env_err -> myerrno != NULL &&
764
- PyObject_RichCompareBool (env_err -> myerrno , eintr_int , Py_EQ ) > 0 ) {
765
- Py_DECREF (typ );
766
- Py_DECREF (val );
767
- Py_XDECREF (tb );
768
- return 1 ;
757
+ if (env_err -> myerrno != NULL ) {
758
+ assert (EINTR > 0 && EINTR < INT_MAX );
759
+ assert (PyLong_CheckExact (env_err -> myerrno ));
760
+ int overflow ;
761
+ int myerrno = PyLong_AsLongAndOverflow (env_err -> myerrno , & overflow );
762
+ PyErr_Clear ();
763
+ if (myerrno == EINTR ) {
764
+ Py_DECREF (typ );
765
+ Py_DECREF (val );
766
+ Py_XDECREF (tb );
767
+ return 1 ;
768
+ }
769
769
}
770
770
/* This silences any error set by PyObject_RichCompareBool() */
771
771
PyErr_Restore (typ , val , tb );
Original file line number Diff line number Diff line change @@ -393,7 +393,6 @@ Modules/faulthandler.c - old_stack -
393
393
# #-----------------------
394
394
# # initialized once
395
395
396
- Modules/_io/bufferedio.c _PyIO_trap_eintr eintr_int -
397
396
Modules/posixmodule.c os_dup2_impl dup3_works -
398
397
Modules/posixmodule.c - structseq_new -
399
398
Modules/posixmodule.c - ticks_per_second -
You can’t perform that action at this time.
0 commit comments