Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
PyPy
pypy
Commits
64310f2f94aa
Commit
78ccf149
authored
Jan 09, 2023
by
Matti Picus
Browse files
add memory pressure for malloc allocations, fix OpenSSL context use
parent
787956c01fab
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib_pypy/_cffi_ssl/_stdssl/__init__.py
View file @
64310f2f
...
...
@@ -3,6 +3,7 @@ import os
import
time
import
thread
as
_thread
import
weakref
import
__pypy__
try
:
from
_pypy_openssl
import
ffi
...
...
@@ -1004,10 +1005,10 @@ class _SSLContext(object):
else
:
raise
ValueError
(
"invalid protocol version"
)
ctx
=
lib
.
SSL_CTX_new
(
method
)
if
ctx
==
ffi
.
NULL
:
raise
ssl_error
(
"failed to allocate SSL context"
)
self
.
ctx
=
ffi
.
gc
(
lib
.
SSL_CTX_new
(
method
),
lib
.
SSL_CTX_free
)
__pypy__
.
add_memory_pressure
(
1000
)
if
self
.
ctx
==
ffi
.
NULL
:
raise
ssl_error
(
"failed to allocate SSL context"
)
self
.
_post_handshake_auth
=
0
;
self
.
_protocol
=
protocol
self
.
hostflags
=
lib
.
X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS
...
...
@@ -1041,7 +1042,7 @@ class _SSLContext(object):
default_ciphers
=
b
"HIGH:!aNULL:!eNULL"
else
:
default_ciphers
=
b
"HIGH:!aNULL:!eNULL:!MD5"
if
not
lib
.
SSL_CTX_set_cipher_list
(
ctx
,
default_ciphers
):
if
not
lib
.
SSL_CTX_set_cipher_list
(
self
.
ctx
,
default_ciphers
):
lib
.
ERR_clear_error
()
raise
SSLError
(
"No cipher can be selected."
)
...
...
lib_pypy/_pypy_util_cffi.py
View file @
64310f2f
import
__pypy__
from
_pypy_util_cffi_inner
import
ffi
,
lib
class
StackNew
(
object
):
...
...
@@ -13,6 +13,7 @@ class StackNew(object):
if
tp
.
endswith
(
"[]"
):
tp
=
tp
[:
-
2
]
+
"*"
# XXX dodgu?
self
.
_p
=
ffi
.
cast
(
tp
,
lib
.
malloc
(
total_size
))
__pypy__
.
add_memory_pressure
(
total_size
)
def
__enter__
(
self
):
return
self
.
_p
...
...
Write
Preview
Supports
Markdown
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