[pypy-commit] pypy more-rposix: Fix tests (and translation of small targets)
amauryfa
noreply at buildbot.pypy.org
Mon Nov 10 19:45:58 CET 2014
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: more-rposix
Changeset: r74431:77ea270bb7a5
Date: 2014-11-10 19:45 +0100
http://bitbucket.org/pypy/pypy/changeset/77ea270bb7a5/
Log: Fix tests (and translation of small targets)
diff --git a/rpython/flowspace/specialcase.py b/rpython/flowspace/specialcase.py
--- a/rpython/flowspace/specialcase.py
+++ b/rpython/flowspace/specialcase.py
@@ -59,7 +59,7 @@
return SPECIAL_CASES[fn] # TypeError if 'fn' not hashable
except (KeyError, TypeError):
# Try to import modules containing special cases
- for modname in SPECIAL_MODULES.get(fn.__module__, []):
+ for modname in SPECIAL_MODULES.get(getattr(fn, '__module__', None), []):
__import__(modname)
try:
return SPECIAL_CASES[fn]
diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
--- a/rpython/rlib/rfile.py
+++ b/rpython/rlib/rfile.py
@@ -160,7 +160,6 @@
def create_fdopen_rfile(fd, mode="r", buffering=-1):
newmode = _sanitize_mode(mode)
- fd = rffi.cast(rffi.INT, fd)
rposix.validate_fd(fd)
ll_mode = rffi.str2charp(newmode)
try:
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -335,6 +335,7 @@
releasegil=False)
@replace_os_function('read')
+ at enforceargs(int, int)
def read(fd, count):
if count < 0:
raise OSError(errno.EINVAL, None)
@@ -345,6 +346,7 @@
return buf.str(got)
@replace_os_function('write')
+ at enforceargs(int, None)
def write(fd, data):
count = len(data)
validate_fd(fd)
More information about the pypy-commit
mailing list