[pypy-commit] pypy py3.5-newtext: hg merge a3f02433a915
arigo
pypy.commits at gmail.com
Tue Feb 14 11:05:05 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5-newtext
Changeset: r90113:6c401ebf28ef
Date: 2017-02-14 17:04 +0100
http://bitbucket.org/pypy/pypy/changeset/6c401ebf28ef/
Log: hg merge a3f02433a915
diff --git a/pypy/module/_multiprocessing/interp_semaphore.py b/pypy/module/_multiprocessing/interp_semaphore.py
--- a/pypy/module/_multiprocessing/interp_semaphore.py
+++ b/pypy/module/_multiprocessing/interp_semaphore.py
@@ -464,27 +464,27 @@
return space.wrap(h)
def get_count(self, space):
- return space.wrap(self.count)
+ return space.newint(self.count)
def _ismine(self):
return self.count > 0 and rthread.get_ident() == self.last_tid
def is_mine(self, space):
- return space.wrap(self._ismine())
+ return space.newbool(self._ismine())
def is_zero(self, space):
try:
res = semlock_iszero(self, space)
except OSError as e:
raise wrap_oserror(space, e)
- return space.wrap(res)
+ return space.newbool(res)
def get_value(self, space):
try:
val = semlock_getvalue(self, space)
except OSError as e:
raise wrap_oserror(space, e)
- return space.wrap(val)
+ return space.newint(val)
@unwrap_spec(block=bool)
def acquire(self, space, block=True, w_timeout=None):
@@ -540,7 +540,7 @@
#
self = space.allocate_instance(W_SemLock, w_cls)
self.__init__(space, handle, kind, maxvalue, name)
- return space.wrap(self)
+ return self
def enter(self, space):
return self.acquire(space, w_timeout=space.w_None)
@@ -570,7 +570,7 @@
self = space.allocate_instance(W_SemLock, w_subtype)
self.__init__(space, handle, kind, maxvalue, name)
- return space.wrap(self)
+ return self
W_SemLock.typedef = TypeDef(
"SemLock",
diff --git a/pypy/module/pwd/interp_pwd.py b/pypy/module/pwd/interp_pwd.py
--- a/pypy/module/pwd/interp_pwd.py
+++ b/pypy/module/pwd/interp_pwd.py
@@ -73,15 +73,15 @@
def make_struct_passwd(space, pw):
w_passwd_struct = space.getattr(space.getbuiltinmodule('pwd'),
- space.wrap('struct_passwd'))
+ space.newtext('struct_passwd'))
w_tuple = space.newtuple([
- space.wrap(rffi.charp2str(pw.c_pw_name)),
- space.wrap(rffi.charp2str(pw.c_pw_passwd)),
- space.int(space.wrap(pw.c_pw_uid)),
- space.int(space.wrap(pw.c_pw_gid)),
- space.wrap(rffi.charp2str(pw.c_pw_gecos)),
- space.wrap(rffi.charp2str(pw.c_pw_dir)),
- space.wrap(rffi.charp2str(pw.c_pw_shell)),
+ space.newtext(rffi.charp2str(pw.c_pw_name)),
+ space.newtext(rffi.charp2str(pw.c_pw_passwd)),
+ space.int(space.newint(pw.c_pw_uid)),
+ space.int(space.newint(pw.c_pw_gid)),
+ space.newtext(rffi.charp2str(pw.c_pw_gecos)),
+ space.newtext(rffi.charp2str(pw.c_pw_dir)),
+ space.newtext(rffi.charp2str(pw.c_pw_shell)),
])
return space.call_function(w_passwd_struct, w_tuple)
@@ -102,7 +102,7 @@
raise
pw = c_getpwuid(uid)
if not pw:
- raise OperationError(space.w_KeyError, space.wrap(
+ raise OperationError(space.w_KeyError, space.newtext(
"%s: %d" % (msg, widen(uid))))
return make_struct_passwd(space, pw)
diff --git a/pypy/module/zipimport/interp_zipimport.py b/pypy/module/zipimport/interp_zipimport.py
--- a/pypy/module/zipimport/interp_zipimport.py
+++ b/pypy/module/zipimport/interp_zipimport.py
@@ -55,16 +55,17 @@
except KeyError:
raise OperationError(space.w_KeyError, space.wrap_fsdecoded(name))
assert isinstance(w_zipimporter, W_ZipImporter)
- w = space.wrap
w_fs = space.wrap_fsdecoded
w_d = space.newdict()
for key, info in w_zipimporter.zip_file.NameToInfo.iteritems():
if ZIPSEP != os.path.sep:
key = key.replace(ZIPSEP, os.path.sep)
space.setitem(w_d, w_fs(key), space.newtuple([
- w_fs(info.filename), w(info.compress_type), w(info.compress_size),
- w(info.file_size), w(info.file_offset), w(info.dostime),
- w(info.dosdate), w(info.CRC)]))
+ w_fs(info.filename), space.newint(info.compress_type),
+ space.newint(info.compress_size),
+ space.newint(info.file_size), space.newint(info.file_offset),
+ space.newint(info.dostime),
+ space.newint(info.dosdate), space.newint(info.CRC)]))
return w_d
def keys(self, space):
@@ -148,10 +149,9 @@
return fname
def import_py_file(self, space, modname, filename, buf, pkgpath):
- w = space.wrap
- w_mod = w(Module(space, space.wrap_fsdecoded(modname)))
+ w_mod = Module(space, space.wrap_fsdecoded(modname))
real_name = self.filename + os.path.sep + self.corr_zname(filename)
- space.setattr(w_mod, w('__loader__'), space.wrap(self))
+ space.setattr(w_mod, space.newtext('__loader__'), self)
importing._prepare_module(space, w_mod, real_name, pkgpath)
co_filename = self.make_co_filename(filename)
code_w = importing.parse_source_module(space, co_filename, buf)
@@ -159,7 +159,6 @@
return w_mod
def _parse_mtime(self, space, filename):
- w = space.wrap
try:
info = self.zip_file.NameToInfo[filename]
t = info.date_time
@@ -167,13 +166,15 @@
return 0
else:
w_mktime = space.getattr(space.getbuiltinmodule('time'),
- w('mktime'))
+ space.newtext('mktime'))
# XXX this is incredible fishing around module limitations
# in order to compare timestamps of .py and .pyc files
# we need time.mktime support on rpython level
+ w = space.newint
all = [w(t[0]), w(t[1]), w(t[2]), w(t[3]), w(t[4]),
w(t[5]), w(0), w(1), w(-1)]
- mtime = int(space.float_w(space.call_function(w_mktime, space.newtuple(all))))
+ mtime = int(space.float_w(space.call_function(
+ w_mktime, space.newtuple(all))))
return mtime
def check_newer_pyfile(self, space, filename, timestamp):
@@ -198,18 +199,17 @@
return True
def import_pyc_file(self, space, modname, filename, buf, pkgpath):
- w = space.wrap
magic = importing._get_long(buf[:4])
timestamp = importing._get_long(buf[4:8])
if not self.can_use_pyc(space, filename, magic, timestamp):
return None
# zipimport ignores the size field
buf = buf[12:] # XXX ugly copy, should use sequential read instead
- w_mod = w(Module(space, w(modname)))
+ w_mod = Module(space, space.newtext(modname))
real_name = self.filename + os.path.sep + self.corr_zname(filename)
- space.setattr(w_mod, w('__loader__'), space.wrap(self))
+ space.setattr(w_mod, space.newtext('__loader__'), self)
importing._prepare_module(space, w_mod, real_name, pkgpath)
- result = importing.load_compiled_module(space, w(modname), w_mod,
+ result = importing.load_compiled_module(space, space.newtext(modname), w_mod,
real_name, magic, timestamp,
buf)
return result
@@ -228,7 +228,7 @@
filename = self.make_filename(fullname)
for _, _, ext in ENUMERATE_EXTS:
if self.have_modulefile(space, filename + ext):
- return space.wrap(self)
+ return self
def make_filename(self, fullname):
startpos = fullname.rfind('.') + 1 # 0 when not found
@@ -309,13 +309,13 @@
magic, timestamp):
continue
# zipimport ignores the size field
- code_w = importing.read_compiled_module(
+ w_code = importing.read_compiled_module(
space, filename + ext, source[12:])
else:
co_filename = self.make_co_filename(filename+ext)
- code_w = importing.parse_source_module(
+ w_code = importing.parse_source_module(
space, co_filename, source)
- return space.wrap(code_w)
+ return w_code
raise oefmt(get_error(space),
"Cannot find source or code for %R in %R",
w_fullname, space.wrap_fsdecoded(self.name))
@@ -359,7 +359,7 @@
filename = self.make_filename(fullname)
for _, is_package, ext in ENUMERATE_EXTS:
if self.have_modulefile(space, filename + ext):
- return space.wrap(is_package)
+ return space.newbool(is_package)
raise oefmt(get_error(space),
"Cannot find module %R in %R",
space.wrap_fsdecoded(filename),
@@ -436,7 +436,7 @@
prefix = prefix[1:]
if prefix and not prefix.endswith(ZIPSEP) and not prefix.endswith(os.path.sep):
prefix += ZIPSEP
- w_result = space.wrap(W_ZipImporter(space, name, filename, zip_file, prefix))
+ w_result = W_ZipImporter(space, name, filename, zip_file, prefix)
zip_cache.set(filename, w_result)
return w_result
More information about the pypy-commit
mailing list