1. thomie
  2. pypy

Commits

Armin Rigo  committed 6bb09a1

Add the (undocumented & untested) attribute 'name' on the hash objects.

  • Participants
  • Parent commits 169eb17
  • Branches default

Comments (0)

Files changed (2)

File pypy/module/_hashlib/interp_hashlib.py

View file
         block_size = rffi.getintfield(digest_type, 'c_block_size')
         return space.wrap(block_size)
 
+    def get_name(self, space):
+        return space.wrap(self.name)
+
     def _digest(self, space):
         with lltype.scoped_alloc(ropenssl.EVP_MD_CTX.TO) as ctx:
             with self.lock:
     digest_size=GetSetProperty(W_Hash.get_digest_size),
     digestsize=GetSetProperty(W_Hash.get_digest_size),
     block_size=GetSetProperty(W_Hash.get_block_size),
+    name=GetSetProperty(W_Hash.get_name),
     )
 W_Hash.acceptable_as_base_class = False
 

File pypy/module/_hashlib/test/test_hashlib.py

View file
                                     'sha512': 64,
                                     }.items():
             h = hashlib.new(name)
+            assert h.name == name
             assert h.digest_size == expected_size
             assert h.digestsize == expected_size
             #