Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
622927b8
Commit
622927b8
authored
Mar 07, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1432525: os.listdir now releases the GIL while calling
readdir().
parent
725507b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
Modules/posixmodule.c
Modules/posixmodule.c
+15
-3
No files found.
Modules/posixmodule.c
View file @
622927b8
...
...
@@ -1640,6 +1640,7 @@ posix_listdir(PyObject *self, PyObject *args)
PyObject
*
d
,
*
v
;
HANDLE
hFindFile
;
BOOL
result
;
WIN32_FIND_DATA
FileData
;
/* MAX_PATH characters could mean a bigger encoded string */
char
namebuf
[
MAX_PATH
*
2
+
5
];
...
...
@@ -1692,7 +1693,10 @@ posix_listdir(PyObject *self, PyObject *args)
break
;
}
Py_DECREF
(
v
);
}
while
(
FindNextFileW
(
hFindFile
,
&
wFileData
)
==
TRUE
);
Py_BEGIN_ALLOW_THREADS
result
=
FindNextFileW
(
hFindFile
,
&
wFileData
);
Py_END_ALLOW_THREADS
}
while
(
result
==
TRUE
);
if
(
FindClose
(
hFindFile
)
==
FALSE
)
{
Py_DECREF
(
d
);
...
...
@@ -1746,7 +1750,10 @@ posix_listdir(PyObject *self, PyObject *args)
break
;
}
Py_DECREF
(
v
);
}
while
(
FindNextFile
(
hFindFile
,
&
FileData
)
==
TRUE
);
Py_BEGIN_ALLOW_THREADS
result
=
FindNextFile
(
hFindFile
,
&
FileData
);
Py_END_ALLOW_THREADS
}
while
(
result
==
TRUE
);
if
(
FindClose
(
hFindFile
)
==
FALSE
)
{
Py_DECREF
(
d
);
...
...
@@ -1848,7 +1855,12 @@ posix_listdir(PyObject *self, PyObject *args)
PyMem_Free
(
name
);
return
NULL
;
}
while
((
ep
=
readdir
(
dirp
))
!=
NULL
)
{
for
(;;)
{
Py_BEGIN_ALLOW_THREADS
ep
=
readdir
(
dirp
);
Py_END_ALLOW_THREADS
if
(
ep
==
NULL
)
break
;
if
(
ep
->
d_name
[
0
]
==
'.'
&&
(
NAMLEN
(
ep
)
==
1
||
(
ep
->
d_name
[
1
]
==
'.'
&&
NAMLEN
(
ep
)
==
2
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment