Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r76638:dbe9bd42d773
Date: 2015-03-30 13:56 +0200
http://bitbucket.org/pypy/pypy/changeset/dbe9bd42d773/

Log:    _hashlib.openssl_md_meth_names is not a set, but a frozenset in
        cpython

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
@@ -27,14 +27,14 @@
     try:
         space = global_name_fetcher.space
         w_name = space.wrap(rffi.charp2str(obj_name[0].c_name))
-        space.call_method(global_name_fetcher.w_meth_names, "add", w_name)
+        global_name_fetcher.meth_names.append(w_name)
     except OperationError, e:
         global_name_fetcher.w_error = e
 
 class NameFetcher:
     def setup(self, space):
         self.space = space
-        self.w_meth_names = space.call_function(space.w_set)
+        self.meth_names = []
         self.w_error = None
     def _cleanup_(self):
         self.__dict__.clear()
@@ -47,7 +47,9 @@
                              hash_name_mapper_callback, None)
     if global_name_fetcher.w_error:
         raise global_name_fetcher.w_error
-    return global_name_fetcher.w_meth_names
+    meth_names = global_name_fetcher.meth_names
+    global_name_fetcher.meth_names = None
+    return space.call_function(space.w_frozenset, space.newlist(meth_names))
 
 class W_Hash(W_Root):
     NULL_CTX = lltype.nullptr(ropenssl.EVP_MD_CTX.TO)
diff --git a/pypy/module/_hashlib/test/test_hashlib.py 
b/pypy/module/_hashlib/test/test_hashlib.py
--- a/pypy/module/_hashlib/test/test_hashlib.py
+++ b/pypy/module/_hashlib/test/test_hashlib.py
@@ -5,7 +5,7 @@
 
     def test_method_names(self):
         import _hashlib
-        assert isinstance(_hashlib.openssl_md_meth_names, set)
+        assert isinstance(_hashlib.openssl_md_meth_names, frozenset)
         assert "md5" in _hashlib.openssl_md_meth_names
 
     def test_simple(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to