[pypy-commit] pypy py3.5-newtext: hg merge dedd16a4f65a
arigo
pypy.commits at gmail.com
Tue Feb 14 13:00:59 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5-newtext
Changeset: r90130:6d55b94fef3a
Date: 2017-02-14 18:59 +0100
http://bitbucket.org/pypy/pypy/changeset/6d55b94fef3a/
Log: hg merge dedd16a4f65a
diff --git a/pypy/interpreter/test/test_typedef.py b/pypy/interpreter/test/test_typedef.py
--- a/pypy/interpreter/test/test_typedef.py
+++ b/pypy/interpreter/test/test_typedef.py
@@ -244,8 +244,10 @@
class W_C(W_A):
b = 3
W_A.typedef = typedef.TypeDef("A",
- a = typedef.interp_attrproperty("a", cls=W_A),
- b = typedef.interp_attrproperty("b", cls=W_A),
+ a = typedef.interp_attrproperty("a", cls=W_A,
+ wrapfn="newint"),
+ b = typedef.interp_attrproperty("b", cls=W_A,
+ wrapfn="newint"),
)
class W_B(W_Root):
pass
diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py
--- a/pypy/module/_multiprocessing/interp_win32.py
+++ b/pypy/module/_multiprocessing/interp_win32.py
@@ -109,7 +109,7 @@
raise wrap_windowserror(space, rwin32.lastSavedWindowsError())
def GetLastError(space):
- return space.wrap(rwin32.GetLastError_saved())
+ return space.newint(rwin32.GetLastError_saved())
# __________________________________________________________
# functions for the "win32" namespace
diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py
--- a/pypy/module/_rawffi/interp_rawffi.py
+++ b/pypy/module/_rawffi/interp_rawffi.py
@@ -625,7 +625,7 @@
if _MS_WINDOWS:
@unwrap_spec(code=int)
def FormatError(space, code):
- return space.wrap(rwin32.FormatError(code))
+ return space.newtext(rwin32.FormatError(code))
@unwrap_spec(hresult=int)
def check_HRESULT(space, hresult):
@@ -648,7 +648,7 @@
# see also
# https://bitbucket.org/pypy/pypy/issue/1944/ctypes-on-windows-getlasterror
def get_last_error(space):
- return space.wrap(rwin32.GetLastError_alt_saved())
+ return space.newint(rwin32.GetLastError_alt_saved())
@unwrap_spec(error=int)
def set_last_error(space, error):
rwin32.SetLastError_alt_saved(error)
diff --git a/pypy/module/_winreg/interp_winreg.py b/pypy/module/_winreg/interp_winreg.py
--- a/pypy/module/_winreg/interp_winreg.py
+++ b/pypy/module/_winreg/interp_winreg.py
@@ -10,8 +10,8 @@
def raiseWindowsError(space, errcode, context):
message = rwin32.FormatError(errcode)
raise OperationError(space.w_WindowsError,
- space.newtuple([space.wrap(errcode),
- space.wrap(message)]))
+ space.newtuple([space.newint(errcode),
+ space.newtext(message)]))
class W_HKEY(W_Root):
def __init__(self, space, hkey):
@@ -26,16 +26,16 @@
return rffi.cast(rffi.SIZE_T, self.hkey)
def descr_bool(self, space):
- return space.wrap(self.as_int() != 0)
+ return space.newbool(self.as_int() != 0)
def descr_handle_get(self, space):
- return space.wrap(self.as_int())
+ return space.newint(self.as_int())
def descr_repr(self, space):
- return space.wrap("<PyHKEY:0x%x>" % (self.as_int(),))
+ return space.newtext("<PyHKEY:0x%x>" % (self.as_int(),))
def descr_int(self, space):
- return space.wrap(self.as_int())
+ return space.newint(self.as_int())
def descr__enter__(self, space):
return self
@@ -61,12 +61,12 @@
On 64 bit windows, the result of this function is a long integer"""
key = self.as_int()
self.hkey = rwin32.NULL_HANDLE
- return space.wrap(key)
+ return space.newint(key)
@unwrap_spec(key=int)
def new_HKEY(space, w_subtype, key):
hkey = rffi.cast(rwinreg.HKEY, key)
- return space.wrap(W_HKEY(space, hkey))
+ return W_HKEY(space, hkey)
descr_HKEY_new = interp2app(new_HKEY)
W_HKEY.typedef = TypeDef(
@@ -260,7 +260,7 @@
if ret != 0:
raiseWindowsError(space, ret, 'RegQueryValue')
length = intmask(bufsize_p[0] - 1)
- return space.wrap(rffi.charp2strn(buf, length))
+ return space.newtext(rffi.charp2strn(buf, length))
def convert_to_regdata(space, w_value, typ):
buf = None
@@ -284,7 +284,7 @@
else:
if space.isinstance_w(w_value, space.w_unicode):
w_value = space.call_method(w_value, 'encode',
- space.wrap('mbcs'))
+ space.newtext('mbcs'))
buf = rffi.str2charp(space.str_w(w_value))
buflen = space.len_w(w_value) + 1
@@ -304,7 +304,7 @@
w_item = space.next(w_iter)
if space.isinstance_w(w_item, space.w_unicode):
w_item = space.call_method(w_item, 'encode',
- space.wrap('mbcs'))
+ space.newtext('mbcs'))
item = space.str_w(w_item)
strings.append(item)
buflen += len(item) + 1
@@ -351,9 +351,9 @@
def convert_from_regdata(space, buf, buflen, typ):
if typ == rwinreg.REG_DWORD:
if not buflen:
- return space.wrap(0)
+ return space.newint(0)
d = rffi.cast(rwin32.LPDWORD, buf)[0]
- return space.wrap(d)
+ return space.newint(d)
elif typ == rwinreg.REG_SZ or typ == rwinreg.REG_EXPAND_SZ:
if not buflen:
@@ -364,8 +364,8 @@
if buf[buflen - 1] == '\x00':
buflen -= 1
s = rffi.charp2strn(buf, buflen)
- w_s = space.wrap(s)
- return space.call_method(w_s, 'decode', space.wrap('mbcs'))
+ w_s = space.newbytes(s)
+ return space.call_method(w_s, 'decode', space.newtext('mbcs'))
elif typ == rwinreg.REG_MULTI_SZ:
if not buflen:
@@ -380,7 +380,7 @@
if len(s) == 0:
break
s = ''.join(s)
- l.append(space.wrap(s))
+ l.append(space.newtext(s))
i += 1
return space.newlist(l)
@@ -465,7 +465,7 @@
return space.newtuple([
convert_from_regdata(space, databuf,
length, retType[0]),
- space.wrap(intmask(retType[0])),
+ space.newint(intmask(retType[0])),
])
@unwrap_spec(subkey=str)
@@ -486,7 +486,7 @@
ret = rwinreg.RegCreateKey(hkey, subkey, rethkey)
if ret != 0:
raiseWindowsError(space, ret, 'CreateKey')
- return space.wrap(W_HKEY(space, rethkey[0]))
+ return W_HKEY(space, rethkey[0])
@unwrap_spec(sub_key=str, reserved=int, access=rffi.r_uint)
def CreateKeyEx(space, w_key, sub_key, reserved=0, access=rwinreg.KEY_WRITE):
@@ -508,7 +508,7 @@
lltype.nullptr(rwin32.LPDWORD.TO))
if ret != 0:
raiseWindowsError(space, ret, 'CreateKeyEx')
- return space.wrap(W_HKEY(space, rethkey[0]))
+ return W_HKEY(space, rethkey[0])
@unwrap_spec(subkey=str)
def DeleteKey(space, w_hkey, subkey):
@@ -555,7 +555,7 @@
ret = rwinreg.RegOpenKeyEx(hkey, sub_key, reserved, access, rethkey)
if ret != 0:
raiseWindowsError(space, ret, 'RegOpenKeyEx')
- return space.wrap(W_HKEY(space, rethkey[0]))
+ return W_HKEY(space, rethkey[0])
@unwrap_spec(index=int)
def EnumValue(space, w_hkey, index):
@@ -614,10 +614,10 @@
length = intmask(retDataSize[0])
return space.newtuple([
- space.wrap(rffi.charp2str(valuebuf)),
+ space.newtext(rffi.charp2str(valuebuf)),
convert_from_regdata(space, databuf,
length, retType[0]),
- space.wrap(intmask(retType[0])),
+ space.newint(intmask(retType[0])),
])
@unwrap_spec(index=int)
@@ -647,7 +647,7 @@
lltype.nullptr(rwin32.PFILETIME.TO))
if ret != 0:
raiseWindowsError(space, ret, 'RegEnumKeyEx')
- return space.wrap(rffi.charp2str(buf))
+ return space.newtext(rffi.charp2str(buf))
def QueryInfoKey(space, w_hkey):
"""tuple = QueryInfoKey(key) - Returns information about a key.
@@ -673,9 +673,9 @@
raiseWindowsError(space, ret, 'RegQueryInfoKey')
l = ((lltype.r_longlong(ft[0].c_dwHighDateTime) << 32) +
lltype.r_longlong(ft[0].c_dwLowDateTime))
- return space.newtuple([space.wrap(nSubKeys[0]),
- space.wrap(nValues[0]),
- space.wrap(l)])
+ return space.newtuple([space.newint(nSubKeys[0]),
+ space.newint(nValues[0]),
+ space.newint(l)])
def ConnectRegistry(space, w_machine, w_hkey):
"""key = ConnectRegistry(computer_name, key)
@@ -694,13 +694,13 @@
ret = rwinreg.RegConnectRegistry(machine, hkey, rethkey)
if ret != 0:
raiseWindowsError(space, ret, 'RegConnectRegistry')
- return space.wrap(W_HKEY(space, rethkey[0]))
+ return W_HKEY(space, rethkey[0])
@unwrap_spec(source=unicode)
def ExpandEnvironmentStrings(space, source):
"string = ExpandEnvironmentStrings(string) - Expand environment vars."
try:
- return space.wrap(rwinreg.ExpandEnvironmentStrings(source))
+ return space.newtext(rwinreg.ExpandEnvironmentStrings(source))
except WindowsError as e:
raise wrap_windowserror(space, e)
More information about the pypy-commit
mailing list