[pypy-commit] pypy py3k: merge default
pjenvey
noreply at buildbot.pypy.org
Wed May 29 03:26:33 CEST 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r64660:32e7d1cf273c
Date: 2013-05-28 18:24 -0700
http://bitbucket.org/pypy/pypy/changeset/32e7d1cf273c/
Log: merge default
diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -12,7 +12,6 @@
from pypy.interpreter.astcompiler import optimize # For side effects
from pypy.interpreter.pyparser.error import SyntaxError
from pypy.tool import stdlib_opcode as ops
-from pypy.interpreter.error import OperationError
C_INT_MAX = (2 ** (struct.calcsize('i') * 8)) / 2 - 1
@@ -23,86 +22,86 @@
name_ops_default = misc.dict_to_switch({
- ast.Load : ops.LOAD_NAME,
- ast.Store : ops.STORE_NAME,
- ast.Del : ops.DELETE_NAME
+ ast.Load: ops.LOAD_NAME,
+ ast.Store: ops.STORE_NAME,
+ ast.Del: ops.DELETE_NAME
})
name_ops_fast = misc.dict_to_switch({
- ast.Load : ops.LOAD_FAST,
- ast.Store : ops.STORE_FAST,
- ast.Del : ops.DELETE_FAST
+ ast.Load: ops.LOAD_FAST,
+ ast.Store: ops.STORE_FAST,
+ ast.Del: ops.DELETE_FAST
})
name_ops_deref = misc.dict_to_switch({
- ast.Load : ops.LOAD_DEREF,
- ast.Store : ops.STORE_DEREF,
- ast.Del : ops.DELETE_DEREF,
+ ast.Load: ops.LOAD_DEREF,
+ ast.Store: ops.STORE_DEREF,
+ ast.Del: ops.DELETE_DEREF,
})
name_ops_global = misc.dict_to_switch({
- ast.Load : ops.LOAD_GLOBAL,
- ast.Store : ops.STORE_GLOBAL,
- ast.Del : ops.DELETE_GLOBAL
+ ast.Load: ops.LOAD_GLOBAL,
+ ast.Store: ops.STORE_GLOBAL,
+ ast.Del: ops.DELETE_GLOBAL
})
unary_operations = misc.dict_to_switch({
- ast.Invert : ops.UNARY_INVERT,
- ast.Not : ops.UNARY_NOT,
- ast.UAdd : ops.UNARY_POSITIVE,
- ast.USub : ops.UNARY_NEGATIVE
+ ast.Invert: ops.UNARY_INVERT,
+ ast.Not: ops.UNARY_NOT,
+ ast.UAdd: ops.UNARY_POSITIVE,
+ ast.USub: ops.UNARY_NEGATIVE
})
binary_operations = misc.dict_to_switch({
- ast.Add : ops.BINARY_ADD,
- ast.Sub : ops.BINARY_SUBTRACT,
- ast.Mult : ops.BINARY_MULTIPLY,
- ast.Div : ops.BINARY_TRUE_DIVIDE,
- ast.Mod : ops.BINARY_MODULO,
- ast.Pow : ops.BINARY_POWER,
- ast.LShift : ops.BINARY_LSHIFT,
- ast.RShift : ops.BINARY_RSHIFT,
- ast.BitOr : ops.BINARY_OR,
- ast.BitAnd : ops.BINARY_AND,
- ast.BitXor : ops.BINARY_XOR,
- ast.FloorDiv : ops.BINARY_FLOOR_DIVIDE
+ ast.Add: ops.BINARY_ADD,
+ ast.Sub: ops.BINARY_SUBTRACT,
+ ast.Mult: ops.BINARY_MULTIPLY,
+ ast.Div: ops.BINARY_TRUE_DIVIDE,
+ ast.Mod: ops.BINARY_MODULO,
+ ast.Pow: ops.BINARY_POWER,
+ ast.LShift: ops.BINARY_LSHIFT,
+ ast.RShift: ops.BINARY_RSHIFT,
+ ast.BitOr: ops.BINARY_OR,
+ ast.BitAnd: ops.BINARY_AND,
+ ast.BitXor: ops.BINARY_XOR,
+ ast.FloorDiv: ops.BINARY_FLOOR_DIVIDE
})
inplace_operations = misc.dict_to_switch({
- ast.Add : ops.INPLACE_ADD,
- ast.Sub : ops.INPLACE_SUBTRACT,
- ast.Mult : ops.INPLACE_MULTIPLY,
- ast.Div : ops.INPLACE_TRUE_DIVIDE,
- ast.Mod : ops.INPLACE_MODULO,
- ast.Pow : ops.INPLACE_POWER,
- ast.LShift : ops.INPLACE_LSHIFT,
- ast.RShift : ops.INPLACE_RSHIFT,
- ast.BitOr : ops.INPLACE_OR,
- ast.BitAnd : ops.INPLACE_AND,
- ast.BitXor : ops.INPLACE_XOR,
- ast.FloorDiv : ops.INPLACE_FLOOR_DIVIDE
+ ast.Add: ops.INPLACE_ADD,
+ ast.Sub: ops.INPLACE_SUBTRACT,
+ ast.Mult: ops.INPLACE_MULTIPLY,
+ ast.Div: ops.INPLACE_TRUE_DIVIDE,
+ ast.Mod: ops.INPLACE_MODULO,
+ ast.Pow: ops.INPLACE_POWER,
+ ast.LShift: ops.INPLACE_LSHIFT,
+ ast.RShift: ops.INPLACE_RSHIFT,
+ ast.BitOr: ops.INPLACE_OR,
+ ast.BitAnd: ops.INPLACE_AND,
+ ast.BitXor: ops.INPLACE_XOR,
+ ast.FloorDiv: ops.INPLACE_FLOOR_DIVIDE
})
compare_operations = misc.dict_to_switch({
- ast.Eq : 2,
- ast.NotEq : 3,
- ast.Lt : 0,
- ast.LtE : 1,
- ast.Gt : 4,
- ast.GtE : 5,
- ast.In : 6,
- ast.NotIn : 7,
- ast.Is : 8,
- ast.IsNot : 9
+ ast.Eq: 2,
+ ast.NotEq: 3,
+ ast.Lt: 0,
+ ast.LtE: 1,
+ ast.Gt: 4,
+ ast.GtE: 5,
+ ast.In: 6,
+ ast.NotIn: 7,
+ ast.Is: 8,
+ ast.IsNot: 9
})
subscr_operations = misc.dict_to_switch({
- ast.AugLoad : ops.BINARY_SUBSCR,
- ast.Load : ops.BINARY_SUBSCR,
- ast.AugStore : ops.STORE_SUBSCR,
- ast.Store : ops.STORE_SUBSCR,
- ast.Del : ops.DELETE_SUBSCR
+ ast.AugLoad: ops.BINARY_SUBSCR,
+ ast.Load: ops.BINARY_SUBSCR,
+ ast.AugStore: ops.STORE_SUBSCR,
+ ast.Store: ops.STORE_SUBSCR,
+ ast.Del: ops.DELETE_SUBSCR
})
@@ -510,9 +509,8 @@
self.emit_jump(ops.CONTINUE_LOOP, block, True)
break
if f_type == F_BLOCK_FINALLY_END:
- self.error("'continue' not supported inside 'finally' " \
- "clause",
- cont)
+ self.error("'continue' not supported inside 'finally' "
+ "clause", cont)
else:
self.error("'continue' not properly in loop", cont)
elif current_block == F_BLOCK_FINALLY_END:
@@ -708,7 +706,7 @@
last_line, last_offset = self.compile_info.last_future_import
if imp.lineno > last_line or \
imp.lineno == last_line and imp.col_offset > last_offset:
- self.error("__future__ statements must appear at beginning " \
+ self.error("__future__ statements must appear at beginning "
"of file", imp)
if star_import:
self.error("* not valid in __future__ imports", imp)
@@ -876,7 +874,6 @@
def visit_Const(self, const):
self.update_position(const.lineno)
- space = self.space
self.load_const(const.value)
def visit_Ellipsis(self, e):
@@ -1095,7 +1092,6 @@
def _comp_generator(self, node, generators, gen_index):
start = self.new_block()
- skip = self.new_block()
if_cleanup = self.new_block()
anchor = self.new_block()
gen = generators[gen_index]
@@ -1111,12 +1107,9 @@
self.use_next_block()
gen.target.walkabout(self)
if gen.ifs:
- ifs_count = len(gen.ifs)
for if_ in gen.ifs:
if_.accept_jump_if(self, False, if_cleanup)
self.use_next_block()
- else:
- ifs_count = 0
gen_index += 1
if gen_index < len(generators):
self._comp_generator(node, generators, gen_index)
@@ -1193,15 +1186,12 @@
def _compile_slice(self, slc, ctx):
if isinstance(slc, ast.Index):
- kind = "index"
if ctx != ast.AugStore:
slc.value.walkabout(self)
elif isinstance(slc, ast.Slice):
- kind = "slice"
if ctx != ast.AugStore:
self._complex_slice(slc, ctx)
elif isinstance(slc, ast.ExtSlice):
- kind = "extended slice"
if ctx != ast.AugStore:
for dim in slc.dims:
self._nested_slice(dim, ctx)
diff --git a/pypy/module/_multiprocessing/__init__.py b/pypy/module/_multiprocessing/__init__.py
--- a/pypy/module/_multiprocessing/__init__.py
+++ b/pypy/module/_multiprocessing/__init__.py
@@ -1,11 +1,11 @@
+import sys
+
from pypy.interpreter.mixedmodule import MixedModule
-import sys
class Module(MixedModule):
interpleveldefs = {
'Connection' : 'interp_connection.W_FileConnection',
- 'PipeConnection' : 'interp_connection.W_PipeConnection',
'SemLock' : 'interp_semaphore.W_SemLock',
'address_of_buffer' : 'interp_memory.address_of_buffer',
@@ -15,4 +15,6 @@
}
if sys.platform == 'win32':
+ interpleveldefs['PipeConnection'] = \
+ 'interp_connection.W_PipeConnection'
interpleveldefs['win32'] = 'interp_win32.win32_namespace(space)'
diff --git a/pypy/module/_multiprocessing/interp_connection.py b/pypy/module/_multiprocessing/interp_connection.py
--- a/pypy/module/_multiprocessing/interp_connection.py
+++ b/pypy/module/_multiprocessing/interp_connection.py
@@ -1,17 +1,17 @@
-from __future__ import with_statement
-from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.typedef import TypeDef, GetSetProperty
-from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
-from pypy.interpreter.error import (
- OperationError, wrap_oserror, operationerrfmt)
-from rpython.rtyper.lltypesystem import rffi, lltype
-from rpython.rlib.rarithmetic import intmask
-from rpython.rlib import rpoll, rsocket
import sys
-READABLE = 1
-WRITABLE = 2
+from rpython.rlib import rpoll, rsocket
+from rpython.rlib.rarithmetic import intmask
+from rpython.rtyper.lltypesystem import lltype, rffi
+from pypy.interpreter.baseobjspace import W_Root
+from pypy.interpreter.error import (
+ OperationError, operationerrfmt, wrap_oserror)
+from pypy.interpreter.gateway import (
+ WrappedDefault, interp2app, interpindirect2app, unwrap_spec)
+from pypy.interpreter.typedef import GetSetProperty, TypeDef
+
+READABLE, WRITABLE = range(1, 3)
PY_SSIZE_T_MAX = sys.maxint
PY_SSIZE_T_MIN = -sys.maxint - 1
@@ -46,10 +46,12 @@
raise NotImplementedError
def is_valid(self):
return False
- def do_send_string(self, space, buffer, offset, size):
+ def do_send_string(self, space, buf, offset, size):
raise NotImplementedError
def do_recv_string(self, space, buflength, maxlength):
raise NotImplementedError
+ def do_poll(self, space, timeout):
+ raise NotImplementedError
def close(self):
self.do_close()
@@ -61,6 +63,14 @@
def writable_get(self, space):
return space.newbool(bool(self.flags & WRITABLE))
+ def _repr(self, space, handle):
+ conn_type = ["read-only", "write-only", "read-write"][self.flags - 1]
+ return space.wrap("<%s %s, handle %d>" % (
+ conn_type, space.type(self).getname(space), handle))
+
+ def descr_repr(self, space):
+ raise NotImplementedError
+
def _check_readable(self, space):
if not self.flags & READABLE:
raise OperationError(space.w_IOError,
@@ -70,9 +80,9 @@
raise OperationError(space.w_IOError,
space.wrap("connection is read-only"))
- @unwrap_spec(buffer='bufferstr', offset='index', size='index')
- def send_bytes(self, space, buffer, offset=0, size=PY_SSIZE_T_MIN):
- length = len(buffer)
+ @unwrap_spec(buf='bufferstr', offset='index', size='index')
+ def send_bytes(self, space, buf, offset=0, size=PY_SSIZE_T_MIN):
+ length = len(buf)
self._check_writable(space)
if offset < 0:
raise OperationError(space.w_ValueError,
@@ -90,7 +100,7 @@
raise OperationError(space.w_ValueError,
space.wrap("buffer length > offset + size"))
- self.do_send_string(space, buffer, offset, size)
+ self.do_send_string(space, buf, offset, size)
@unwrap_spec(maxlength='index')
def recv_bytes(self, space, maxlength=PY_SSIZE_T_MAX):
@@ -139,8 +149,8 @@
w_pickled = space.call_method(
w_picklemodule, "dumps", w_obj, w_protocol)
- buffer = space.bufferstr_w(w_pickled)
- self.do_send_string(space, buffer, 0, len(buffer))
+ buf = space.bufferstr_w(w_pickled)
+ self.do_send_string(space, buf, 0, len(buf))
def recv(self, space):
self._check_readable(space)
@@ -177,6 +187,7 @@
W_BaseConnection.typedef = TypeDef(
'BaseConnection',
+ __repr__ = interpindirect2app(W_BaseConnection.descr_repr),
closed = GetSetProperty(W_BaseConnection.closed_get),
readable = GetSetProperty(W_BaseConnection.readable_get),
writable = GetSetProperty(W_BaseConnection.writable_get),
@@ -226,7 +237,8 @@
def __init__(self, space, fd, flags):
if fd == self.INVALID_HANDLE_VALUE or fd < 0:
- raise OperationError(space.w_IOError, space.wrap("invalid handle %d" % fd))
+ raise OperationError(space.w_IOError,
+ space.wrap("invalid handle %d" % fd))
W_BaseConnection.__init__(self, flags)
self.fd = fd
@@ -238,6 +250,9 @@
W_FileConnection.__init__(self, space, fd, flags)
return space.wrap(self)
+ def descr_repr(self, space):
+ return self._repr(space, self.fd)
+
def fileno(self, space):
return space.wrap(self.fd)
@@ -249,8 +264,8 @@
self.CLOSE()
self.fd = self.INVALID_HANDLE_VALUE
- def do_send_string(self, space, buffer, offset, size):
- # Since str2charp copies the buffer anyway, always combine the
+ def do_send_string(self, space, buf, offset, size):
+ # Since str2charp copies the buf anyway, always combine the
# "header" and the "body" of the message and send them at once.
message = lltype.malloc(rffi.CCHARP.TO, size + 4, flavor='raw')
try:
@@ -259,7 +274,7 @@
rffi.cast(rffi.UINTP, message)[0] = length
i = size - 1
while i >= 0:
- message[4 + i] = buffer[offset + i]
+ message[4 + i] = buf[offset + i]
i -= 1
self._sendall(space, message, size + 4)
finally:
@@ -296,7 +311,7 @@
size -= count
message = rffi.ptradd(message, count)
- def _recvall(self, space, buffer, length):
+ def _recvall(self, space, buf, length):
length = intmask(length)
remaining = length
while remaining > 0:
@@ -313,9 +328,9 @@
"got end of file during message"))
# XXX inefficient
for i in range(count):
- buffer[i] = data[i]
+ buf[i] = data[i]
remaining -= count
- buffer = rffi.ptradd(buffer, count)
+ buf = rffi.ptradd(buf, count)
if sys.platform == 'win32':
def _check_fd(self):
@@ -330,10 +345,7 @@
"handle out of range in select()"))
r, w, e = rpoll.select([self.fd], [], [], timeout)
- if r:
- return True
- else:
- return False
+ return bool(r)
W_FileConnection.typedef = TypeDef(
'Connection', W_BaseConnection.typedef,
@@ -351,7 +363,8 @@
self.handle = handle
@unwrap_spec(readable=bool, writable=bool)
- def descr_new_pipe(space, w_subtype, w_handle, readable=True, writable=True):
+ def descr_new_pipe(space, w_subtype, w_handle, readable=True,
+ writable=True):
from pypy.module._multiprocessing.interp_win32 import handle_w
handle = handle_w(space, w_handle)
flags = (readable and READABLE) | (writable and WRITABLE)
@@ -361,10 +374,7 @@
return space.wrap(self)
def descr_repr(self, space):
- conn_type = ["read-only", "write-only", "read-write"][self.flags]
-
- return space.wrap("<%s %s, handle %zd>" % (
- conn_type, space.type(self).getname(space), self.do_fileno()))
+ return self._repr(space, self.handle)
def is_valid(self):
return self.handle != self.INVALID_HANDLE_VALUE
@@ -378,12 +388,12 @@
CloseHandle(self.handle)
self.handle = self.INVALID_HANDLE_VALUE
- def do_send_string(self, space, buffer, offset, size):
+ def do_send_string(self, space, buf, offset, size):
from pypy.module._multiprocessing.interp_win32 import (
_WriteFile, ERROR_NO_SYSTEM_RESOURCES)
from rpython.rlib import rwin32
- charp = rffi.str2charp(buffer)
+ charp = rffi.str2charp(buf)
written_ptr = lltype.malloc(rffi.CArrayPtr(rwin32.DWORD).TO, 1,
flavor='raw')
try:
diff --git a/pypy/module/_multiprocessing/interp_memory.py b/pypy/module/_multiprocessing/interp_memory.py
--- a/pypy/module/_multiprocessing/interp_memory.py
+++ b/pypy/module/_multiprocessing/interp_memory.py
@@ -1,5 +1,6 @@
+from rpython.rtyper.lltypesystem import rffi
+
from pypy.interpreter.error import OperationError
-from rpython.rtyper.lltypesystem import rffi
from pypy.module.mmap.interp_mmap import W_MMap
def address_of_buffer(space, w_obj):
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
@@ -1,23 +1,26 @@
-from __future__ import with_statement
+import errno
+import os
+import sys
+import time
+
+from rpython.rlib import rgc, rthread
+from rpython.rlib.rarithmetic import r_uint
+from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.rtyper.tool import rffi_platform as platform
+from rpython.translator.tool.cbuild import ExternalCompilationInfo
+
from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.typedef import TypeDef, GetSetProperty
+from pypy.interpreter.error import OperationError, wrap_oserror
from pypy.interpreter.gateway import interp2app, unwrap_spec
-from pypy.interpreter.error import wrap_oserror, OperationError
-from rpython.rtyper.lltypesystem import rffi, lltype
-from rpython.rlib import rgc
-from rpython.rlib.rarithmetic import r_uint
-from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from rpython.rtyper.tool import rffi_platform as platform
-from rpython.rlib import rthread
+from pypy.interpreter.typedef import GetSetProperty, TypeDef
from pypy.module._multiprocessing.interp_connection import w_handle
-import sys, os, time, errno
RECURSIVE_MUTEX, SEMAPHORE = range(2)
if sys.platform == 'win32':
from rpython.rlib import rwin32
from pypy.module._multiprocessing.interp_win32 import (
- handle_w, _GetTickCount)
+ _GetTickCount, handle_w)
SEM_VALUE_MAX = sys.maxint
@@ -62,7 +65,8 @@
TIMEVALP = rffi.CArrayPtr(TIMEVAL)
TIMESPECP = rffi.CArrayPtr(TIMESPEC)
SEM_T = rffi.COpaquePtr('sem_t', compilation_info=eci)
- SEM_FAILED = config['SEM_FAILED'] # rffi.cast(SEM_T, config['SEM_FAILED'])
+ # rffi.cast(SEM_T, config['SEM_FAILED'])
+ SEM_FAILED = config['SEM_FAILED']
SEM_VALUE_MAX = config['SEM_VALUE_MAX']
SEM_TIMED_WAIT = config['SEM_TIMED_WAIT']
SEM_T_SIZE = config['SEM_T_SIZE']
@@ -160,7 +164,8 @@
return -1
if SEM_TIMED_WAIT:
- _sem_timedwait = external('sem_timedwait', [SEM_T, TIMESPECP], rffi.INT)
+ _sem_timedwait = external('sem_timedwait', [SEM_T, TIMESPECP],
+ rffi.INT)
else:
_sem_timedwait = _sem_timedwait_save
@@ -185,7 +190,8 @@
res = _gettimeofday(now, None)
if res < 0:
raise OSError(rposix.get_errno(), "gettimeofday failed")
- return rffi.getintfield(now[0], 'c_tv_sec'), rffi.getintfield(now[0], 'c_tv_usec')
+ return (rffi.getintfield(now[0], 'c_tv_sec'),
+ rffi.getintfield(now[0], 'c_tv_usec'))
finally:
lltype.free(now, flavor='raw')
@@ -330,8 +336,8 @@
deadline = lltype.malloc(TIMESPECP.TO, 1, flavor='raw')
rffi.setintfield(deadline[0], 'c_tv_sec', now_sec + sec)
rffi.setintfield(deadline[0], 'c_tv_nsec', now_usec * 1000 + nsec)
- val = rffi.getintfield(deadline[0], 'c_tv_sec') + \
- rffi.getintfield(deadline[0], 'c_tv_nsec') / 1000000000
+ val = (rffi.getintfield(deadline[0], 'c_tv_sec') +
+ rffi.getintfield(deadline[0], 'c_tv_nsec') / 1000000000)
rffi.setintfield(deadline[0], 'c_tv_sec', val)
val = rffi.getintfield(deadline[0], 'c_tv_nsec') % 1000000000
rffi.setintfield(deadline[0], 'c_tv_nsec', val)
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
@@ -1,11 +1,12 @@
-from pypy.interpreter.gateway import unwrap_spec, interp2app
-from pypy.interpreter.function import StaticMethod
-from pypy.interpreter.error import wrap_windowserror, OperationError
from rpython.rlib import rwin32
from rpython.rlib.rarithmetic import r_uint
-from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.rtyper.tool import rffi_platform
from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from rpython.rtyper.tool import rffi_platform
+
+from pypy.interpreter.error import OperationError, wrap_windowserror
+from pypy.interpreter.function import StaticMethod
+from pypy.interpreter.gateway import interp2app, unwrap_spec
from pypy.module._multiprocessing.interp_connection import w_handle
CONSTANTS = """
@@ -130,10 +131,12 @@
if not _ConnectNamedPipe(handle, rffi.NULL):
raise wrap_windowserror(space, rwin32.lastWindowsError())
-def SetNamedPipeHandleState(space, w_handle, w_pipemode, w_maxinstances, w_timeout):
+def SetNamedPipeHandleState(space, w_handle, w_pipemode, w_maxinstances,
+ w_timeout):
handle = handle_w(space, w_handle)
state = lltype.malloc(rffi.CArrayPtr(rffi.UINT).TO, 3, flavor='raw')
- statep = lltype.malloc(rffi.CArrayPtr(rffi.UINTP).TO, 3, flavor='raw', zero=True)
+ statep = lltype.malloc(rffi.CArrayPtr(rffi.UINTP).TO, 3, flavor='raw',
+ zero=True)
try:
if not space.is_w(w_pipemode, space.w_None):
state[0] = space.uint_w(w_pipemode)
@@ -144,7 +147,8 @@
if not space.is_w(w_timeout, space.w_None):
state[2] = space.uint_w(w_timeout)
statep[2] = rffi.ptradd(state, 2)
- if not _SetNamedPipeHandleState(handle, statep[0], statep[1], statep[2]):
+ if not _SetNamedPipeHandleState(handle, statep[0], statep[1],
+ statep[2]):
raise wrap_windowserror(space, rwin32.lastWindowsError())
finally:
lltype.free(state, flavor='raw')
diff --git a/pypy/module/_multiprocessing/test/test_connection.py b/pypy/module/_multiprocessing/test/test_connection.py
--- a/pypy/module/_multiprocessing/test/test_connection.py
+++ b/pypy/module/_multiprocessing/test/test_connection.py
@@ -172,3 +172,11 @@
assert data1 == b'\x00\x00\x00\x03abc'
data2 = sock.recv(8)
assert data2 == b'\x00\x00\x00\x04defg'
+
+ def test_repr(self):
+ import _multiprocessing
+ c = _multiprocessing.Connection(1)
+ assert repr(c) == '<read-write Connection, handle 1>'
+ if hasattr(_multiprocessing, 'PipeConnection'):
+ c = _multiprocessing.PipeConnection(1)
+ assert repr(c) == '<read-write Connection, handle 1>'
diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -830,6 +830,30 @@
out = cbuilder.cmdexec('')
assert out.strip() == '789'
+ def test_llhelper_stored_in_struct(self):
+ from rpython.rtyper.annlowlevel import llhelper
+
+ def f(x):
+ return x + 3
+
+ FUNC_TP = lltype.Ptr(lltype.FuncType([lltype.Signed], lltype.Signed))
+
+ S = lltype.GcStruct('s', ('f', FUNC_TP))
+
+ class Glob(object):
+ pass
+
+ glob = Glob()
+
+ def entry_point(argv):
+ x = llhelper(FUNC_TP, f)
+ s = lltype.malloc(S)
+ s.f = x
+ glob.s = s # escape
+ return 0
+
+ self.compile(entry_point)
+ # assert did not explode
class TestMaemo(TestStandalone):
def setup_class(cls):
More information about the pypy-commit
mailing list