Author: Alexander Hesse <webmas...@aquanasoft.de>
Branch: split-rpython
Changeset: r59937:90e32a0b1c06
Date: 2013-01-10 23:18 +0100
http://bitbucket.org/pypy/pypy/changeset/90e32a0b1c06/

Log:    Moved HASH_MALLOC_SIZE to ropenssl

diff --git a/pypy/module/_hashlib/interp_hashlib.py 
b/pypy/module/_hashlib/interp_hashlib.py
--- a/pypy/module/_hashlib/interp_hashlib.py
+++ b/pypy/module/_hashlib/interp_hashlib.py
@@ -12,13 +12,6 @@
 
 algorithms = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')
 
-# HASH_MALLOC_SIZE is the size of EVP_MD, EVP_MD_CTX plus their points
-# Used for adding memory pressure. Last number is an (under?)estimate of
-# EVP_PKEY_CTX's size.
-# XXX: Make a better estimate here
-HASH_MALLOC_SIZE = ropenssl.EVP_MD_SIZE + ropenssl.EVP_MD_CTX_SIZE \
-        + rffi.sizeof(ropenssl.EVP_MD) * 2 + 208
-
 class W_Hash(Wrappable):
     NULL_CTX = lltype.nullptr(ropenssl.EVP_MD_CTX.TO)
     ctx = NULL_CTX
diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
--- a/rpython/rlib/ropenssl.py
+++ b/rpython/rlib/ropenssl.py
@@ -316,6 +316,13 @@
 EVP_MD_CTX_cleanup = external(
     'EVP_MD_CTX_cleanup', [EVP_MD_CTX], rffi.INT, threadsafe=False)
 
+# HASH_MALLOC_SIZE is the size of EVP_MD, EVP_MD_CTX plus their points
+# Used for adding memory pressure. Last number is an (under?)estimate of
+# EVP_PKEY_CTX's size.
+# XXX: Make a better estimate here
+HASH_MALLOC_SIZE = EVP_MD_SIZE + EVP_MD_CTX_SIZE \
+        + rffi.sizeof(EVP_MD) * 2 + 208
+
 def init_ssl():
     libssl_SSL_load_error_strings()
     libssl_SSL_library_init()
diff --git a/rpython/translator/c/test/test_newgc.py 
b/rpython/translator/c/test/test_newgc.py
--- a/rpython/translator/c/test/test_newgc.py
+++ b/rpython/translator/c/test/test_newgc.py
@@ -1440,7 +1440,6 @@
         assert res == -99997
 
     def define_nongc_opaque_attached_to_gc(cls):
-        from pypy.module._hashlib.interp_hashlib import HASH_MALLOC_SIZE
         from rpython.rlib import rgc, ropenssl
 
         class A:
@@ -1449,7 +1448,7 @@
                     flavor='raw')
                 digest = ropenssl.EVP_get_digestbyname('sha1')
                 ropenssl.EVP_DigestInit(self.ctx, digest)
-                rgc.add_memory_pressure(HASH_MALLOC_SIZE + 64)
+                rgc.add_memory_pressure(ropenssl.HASH_MALLOC_SIZE + 64)
 
             def __del__(self):
                 ropenssl.EVP_MD_CTX_cleanup(self.ctx)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to