@@ -713,37 +713,6 @@ static PyStructSequence_Desc stat_result_desc = {
713
713
};
714
714
715
715
716
- static int
717
- _fd_converter (PyObject * o , int * p , const char * allowed )
718
- {
719
- int overflow ;
720
- long long_value ;
721
-
722
- PyObject * index = PyNumber_Index (o );
723
- if (index == NULL ) {
724
- PyErr_Format (PyExc_TypeError ,
725
- "argument should be %s, not %.200s" ,
726
- allowed , Py_TYPE (o )-> tp_name );
727
- return 0 ;
728
- }
729
-
730
- long_value = PyLong_AsLongAndOverflow (index , & overflow );
731
- Py_DECREF (index );
732
- if (overflow > 0 || long_value > INT_MAX ) {
733
- PyErr_SetString (PyExc_OverflowError ,
734
- "fd is greater than maximum" );
735
- return 0 ;
736
- }
737
- if (overflow < 0 || long_value < INT_MIN ) {
738
- PyErr_SetString (PyExc_OverflowError ,
739
- "fd is less than minimum" );
740
- return 0 ;
741
- }
742
-
743
- * p = (int )long_value ;
744
- return 1 ;
745
- }
746
-
747
716
#ifdef MS_WINDOWS
748
717
static int
749
718
win32_warn_bytes_api ()
@@ -759,7 +728,6 @@ typedef struct {
759
728
const char * function_name ;
760
729
const char * argument_name ;
761
730
int nullable ;
762
- int allow_fd ;
763
731
wchar_t * wide ;
764
732
char * narrow ;
765
733
int fd ;
@@ -768,9 +736,6 @@ typedef struct {
768
736
PyObject * cleanup ;
769
737
} path_t ;
770
738
771
- #define PATH_T_INITIALIZE (function_name , argument_name , nullable , allow_fd ) \
772
- {function_name, argument_name, nullable, allow_fd, NULL, NULL, -1, 0, NULL, NULL}
773
-
774
739
static void
775
740
path_cleanup (path_t * path ) {
776
741
if (path -> cleanup ) {
@@ -868,19 +833,6 @@ path_converter(PyObject *o, void *p) {
868
833
bytes = NULL ;
869
834
if (!bytes ) {
870
835
PyErr_Clear ();
871
- if (path -> allow_fd ) {
872
- int fd ;
873
- int result = _fd_converter (o , & fd ,
874
- "string, bytes or integer" );
875
- if (result ) {
876
- path -> wide = NULL ;
877
- path -> narrow = NULL ;
878
- path -> length = 0 ;
879
- path -> object = o ;
880
- path -> fd = fd ;
881
- return result ;
882
- }
883
- }
884
836
}
885
837
}
886
838
0 commit comments