@@ -15582,7 +15582,7 @@ typedef struct {
15582
15582
ino_t d_ino ;
15583
15583
int dir_fd ;
15584
15584
#endif
15585
- PyMutex mutex ;
15585
+ _PyRecursiveMutex mutex ;
15586
15586
} DirEntry ;
15587
15587
15588
15588
#define DirEntry_CAST (op ) ((DirEntry *)(op))
@@ -15592,12 +15592,12 @@ DirEntry_dealloc(PyObject *op)
15592
15592
{
15593
15593
DirEntry * entry = DirEntry_CAST (op );
15594
15594
PyTypeObject * tp = Py_TYPE (entry );
15595
- PyMutex_Lock (& entry -> mutex );
15595
+ _PyRecursiveMutex_Lock (& entry -> mutex );
15596
15596
Py_XDECREF (entry -> name );
15597
15597
Py_XDECREF (entry -> path );
15598
15598
Py_XDECREF (entry -> stat );
15599
15599
Py_XDECREF (entry -> lstat );
15600
- PyMutex_Unlock (& entry -> mutex );
15600
+ _PyRecursiveMutex_Unlock (& entry -> mutex );
15601
15601
freefunc free_func = PyType_GetSlot (tp , Py_tp_free );
15602
15602
free_func (entry );
15603
15603
Py_DECREF (tp );
@@ -15743,17 +15743,17 @@ os_DirEntry_stat_impl(DirEntry *self, PyTypeObject *defining_class,
15743
15743
/*[clinic end generated code: output=23f803e19c3e780e input=e816273c4e67ee98]*/
15744
15744
{
15745
15745
if (!follow_symlinks ) {
15746
- PyMutex_Lock (& self -> mutex );
15746
+ _PyRecursiveMutex_Lock (& self -> mutex );
15747
15747
PyObject * stat = DirEntry_get_lstat (defining_class , self );
15748
- PyMutex_Unlock (& self -> mutex );
15748
+ _PyRecursiveMutex_Unlock (& self -> mutex );
15749
15749
return stat ;
15750
15750
}
15751
15751
15752
- PyMutex_Lock (& self -> mutex );
15752
+ _PyRecursiveMutex_Lock (& self -> mutex );
15753
15753
if (!self -> stat ) {
15754
15754
int result = os_DirEntry_is_symlink_impl (self , defining_class );
15755
15755
if (result == -1 ) {
15756
- PyMutex_Unlock (& self -> mutex );
15756
+ _PyRecursiveMutex_Unlock (& self -> mutex );
15757
15757
return NULL ;
15758
15758
}
15759
15759
if (result ) {
@@ -15764,7 +15764,7 @@ os_DirEntry_stat_impl(DirEntry *self, PyTypeObject *defining_class,
15764
15764
self -> stat = DirEntry_get_lstat (defining_class , self );
15765
15765
}
15766
15766
}
15767
- PyMutex_Unlock (& self -> mutex );
15767
+ _PyRecursiveMutex_Unlock (& self -> mutex );
15768
15768
15769
15769
return Py_XNewRef (self -> stat );
15770
15770
}
@@ -16039,7 +16039,7 @@ DirEntry_from_find_data(PyObject *module, path_t *path, WIN32_FIND_DATAW *dataW)
16039
16039
entry -> stat = NULL ;
16040
16040
entry -> lstat = NULL ;
16041
16041
entry -> got_file_index = 0 ;
16042
- entry -> mutex = (PyMutex ){0 };
16042
+ entry -> mutex = (_PyRecursiveMutex ){0 };
16043
16043
16044
16044
entry -> name = PyUnicode_FromWideChar (dataW -> cFileName , -1 );
16045
16045
if (!entry -> name )
@@ -16132,7 +16132,7 @@ DirEntry_from_posix_info(PyObject *module, path_t *path, const char *name,
16132
16132
entry -> path = NULL ;
16133
16133
entry -> stat = NULL ;
16134
16134
entry -> lstat = NULL ;
16135
- entry -> mutex = (PyMutex ){0 };
16135
+ entry -> mutex = (_PyRecursiveMutex ){0 };
16136
16136
16137
16137
if (path -> fd != -1 ) {
16138
16138
entry -> dir_fd = path -> fd ;
@@ -16193,7 +16193,7 @@ typedef struct {
16193
16193
#ifdef HAVE_FDOPENDIR
16194
16194
int fd ;
16195
16195
#endif
16196
- PyMutex mutex ;
16196
+ _PyRecursiveMutex mutex ;
16197
16197
} ScandirIterator ;
16198
16198
16199
16199
#define ScandirIterator_CAST (op ) ((ScandirIterator *)(op))
@@ -16209,10 +16209,10 @@ ScandirIterator_is_closed(ScandirIterator *iterator)
16209
16209
static void
16210
16210
ScandirIterator_closedir (ScandirIterator * iterator )
16211
16211
{
16212
- PyMutex_Lock (& iterator -> mutex );
16212
+ _PyRecursiveMutex_Lock (& iterator -> mutex );
16213
16213
HANDLE handle = iterator -> handle ;
16214
16214
iterator -> handle = INVALID_HANDLE_VALUE ;
16215
- PyMutex_Unlock (& iterator -> mutex );
16215
+ _PyRecursiveMutex_Unlock (& iterator -> mutex );
16216
16216
16217
16217
if (handle == INVALID_HANDLE_VALUE ) {
16218
16218
return ;
@@ -16231,7 +16231,7 @@ ScandirIterator_iternext(PyObject *op)
16231
16231
BOOL success ;
16232
16232
PyObject * entry ;
16233
16233
16234
- PyMutex_Lock (& iterator -> mutex );
16234
+ _PyRecursiveMutex_Lock (& iterator -> mutex );
16235
16235
while (iterator -> handle != INVALID_HANDLE_VALUE ) {
16236
16236
if (!iterator -> first_time ) {
16237
16237
Py_BEGIN_ALLOW_THREADS
@@ -16254,15 +16254,15 @@ ScandirIterator_iternext(PyObject *op)
16254
16254
entry = DirEntry_from_find_data (module , & iterator -> path , file_data );
16255
16255
if (!entry )
16256
16256
break ;
16257
- PyMutex_Unlock (& iterator -> mutex );
16257
+ _PyRecursiveMutex_Unlock (& iterator -> mutex );
16258
16258
return entry ;
16259
16259
}
16260
16260
16261
16261
/* Loop till we get a non-dot directory or finish iterating */
16262
16262
}
16263
16263
16264
16264
/* Already closed, error, or no more files */
16265
- PyMutex_Unlock (& iterator -> mutex );
16265
+ _PyRecursiveMutex_Unlock (& iterator -> mutex );
16266
16266
ScandirIterator_closedir (iterator );
16267
16267
return NULL ;
16268
16268
}
@@ -16278,10 +16278,10 @@ ScandirIterator_is_closed(ScandirIterator *iterator)
16278
16278
static void
16279
16279
ScandirIterator_closedir (ScandirIterator * iterator )
16280
16280
{
16281
- PyMutex_Lock (& iterator -> mutex );
16281
+ _PyRecursiveMutex_Lock (& iterator -> mutex );
16282
16282
DIR * dirp = iterator -> dirp ;
16283
16283
iterator -> dirp = NULL ;
16284
- PyMutex_Unlock (& iterator -> mutex );
16284
+ _PyRecursiveMutex_Unlock (& iterator -> mutex );
16285
16285
16286
16286
if (!dirp ) {
16287
16287
return ;
@@ -16306,7 +16306,7 @@ ScandirIterator_iternext(PyObject *op)
16306
16306
int is_dot ;
16307
16307
PyObject * entry ;
16308
16308
16309
- PyMutex_Lock (& iterator -> mutex );
16309
+ _PyRecursiveMutex_Lock (& iterator -> mutex );
16310
16310
while (iterator -> dirp ) {
16311
16311
errno = 0 ;
16312
16312
Py_BEGIN_ALLOW_THREADS
@@ -16335,15 +16335,15 @@ ScandirIterator_iternext(PyObject *op)
16335
16335
);
16336
16336
if (!entry )
16337
16337
break ;
16338
- PyMutex_Unlock (& iterator -> mutex );
16338
+ _PyRecursiveMutex_Unlock (& iterator -> mutex );
16339
16339
return entry ;
16340
16340
}
16341
16341
16342
16342
/* Loop till we get a non-dot directory or finish iterating */
16343
16343
}
16344
16344
16345
16345
/* Already closed, error, or no more files */
16346
- PyMutex_Unlock (& iterator -> mutex );
16346
+ _PyRecursiveMutex_Unlock (& iterator -> mutex );
16347
16347
ScandirIterator_closedir (iterator );
16348
16348
return NULL ;
16349
16349
}
@@ -16476,7 +16476,7 @@ os_scandir_impl(PyObject *module, path_t *path)
16476
16476
if (!iterator )
16477
16477
return NULL ;
16478
16478
16479
- iterator -> mutex = (PyMutex ){0 };
16479
+ iterator -> mutex = (_PyRecursiveMutex ){0 };
16480
16480
#ifdef MS_WINDOWS
16481
16481
iterator -> handle = INVALID_HANDLE_VALUE ;
16482
16482
#else
0 commit comments