Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
PureOS
Core Packages
python-apt
Commits
81f4aad3
Commit
81f4aad3
authored
Nov 25, 2020
by
Julian Andres Klode
Browse files
hashes: Release GIL while hashing stuff
parent
f087ac3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
python/hashes.cc
View file @
81f4aad3
...
...
@@ -45,11 +45,17 @@ static int hashes_init(PyObject *self, PyObject *args, PyObject *kwds)
char
*
s
;
Py_ssize_t
len
;
PyBytes_AsStringAndSize
(
object
,
&
s
,
&
len
);
Py_BEGIN_ALLOW_THREADS
hashes
.
Add
((
const
unsigned
char
*
)
s
,
len
);
Py_END_ALLOW_THREADS
}
else
if
((
Fd
=
PyObject_AsFileDescriptor
(
object
))
!=
-
1
)
{
struct
stat
St
;
if
(
fstat
(
Fd
,
&
St
)
!=
0
||
hashes
.
AddFD
(
Fd
,
St
.
st_size
)
==
false
)
{
bool
err
=
false
;
Py_BEGIN_ALLOW_THREADS
err
=
fstat
(
Fd
,
&
St
)
!=
0
||
hashes
.
AddFD
(
Fd
,
St
.
st_size
)
==
false
;
Py_END_ALLOW_THREADS
if
(
err
)
{
PyErr_SetFromErrno
(
PyAptError
);
return
-
1
;
}
...
...
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