[pypy-commit] pypy space-newtext: _hashlib (also refactor NameFetcher to not need a space)
cfbolz
pypy.commits at gmail.com
Thu Nov 10 12:04:17 EST 2016
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: space-newtext
Changeset: r88298:425adc283f7d
Date: 2016-11-10 18:03 +0100
http://bitbucket.org/pypy/pypy/changeset/425adc283f7d/
Log: _hashlib (also refactor NameFetcher to not need a space)
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
@@ -88,7 +88,7 @@
def descr_repr(self, space):
addrstring = self.getaddrstring(space)
- return space.wrap("<%s HASH object at 0x%s>" % (
+ return space.newtext("<%s HASH object at 0x%s>" % (
self.name, addrstring))
@unwrap_spec(string='bufferstr')
@@ -116,18 +116,18 @@
for c in digest:
result.append(hexdigits[(ord(c) >> 4) & 0xf])
result.append(hexdigits[ ord(c) & 0xf])
- return space.wrap(result.build())
+ return space.newtext(result.build())
def get_digest_size(self, space):
- return space.wrap(self.digest_size)
+ return space.newint(self.digest_size)
def get_block_size(self, space):
digest_type = self.digest_type_by_name(space)
block_size = ropenssl.EVP_MD_block_size(digest_type)
- return space.wrap(block_size)
+ return space.newint(block_size)
def get_name(self, space):
- return space.wrap(self.name)
+ return space.newtext(self.name)
def _digest(self, space):
ctx = ropenssl.EVP_MD_CTX_new()
@@ -164,7 +164,7 @@
def new(space, name, string=''):
w_hash = W_Hash(space, name)
w_hash.update(space, string)
- return space.wrap(w_hash)
+ return w_hash
# shortcut functions
def make_new_hash(name, funcname):
@@ -200,4 +200,4 @@
dklen, buf.raw)
if not r:
raise ValueError
- return space.wrap(buf.str(dklen))
+ return space.newbytes(buf.str(dklen))
More information about the pypy-commit
mailing list