[pypy-commit] pypy release-5.x: Untranslated, we can't reliably call c_open()
arigo
pypy.commits at gmail.com
Sun Mar 27 16:43:21 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: release-5.x
Changeset: r83403:c71f672e9491
Date: 2016-03-27 22:41 +0200
http://bitbucket.org/pypy/pypy/changeset/c71f672e9491/
Log: Untranslated, we can't reliably call c_open() because its precise
signature is (char*, int, ...) but we're pretending it is (char*,
int, mode_t). Usually it makes no difference, but on some platforms
it does.
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -10,7 +10,8 @@
_CYGWIN, _MACRO_ON_POSIX, UNDERSCORE_ON_WIN32, _WIN32,
_prefer_unicode, _preferred_traits)
from rpython.rlib.objectmodel import (
- specialize, enforceargs, register_replacement_for, NOT_CONSTANT)
+ specialize, enforceargs, register_replacement_for, NOT_CONSTANT,
+ we_are_translated)
from rpython.rlib.rarithmetic import intmask, widen
from rpython.rlib.signature import signature
from rpython.tool.sourcetools import func_renamer
@@ -375,8 +376,15 @@
def open(path, flags, mode):
if _prefer_unicode(path):
fd = c_wopen(_as_unicode0(path), flags, mode)
+ elif we_are_translated():
+ fd = c_open(_as_bytes0(path), flags, mode)
else:
- fd = c_open(_as_bytes0(path), flags, mode)
+ # Untranslated, we can't reliably call c_open()
+ # because its precise signature is (char*, int, ...)
+ # but we're pretending it is (char*, int, mode_t).
+ # Usually it makes no difference, but on some
+ # platforms it does.
+ fd = os.open(_as_bytes0(path), flags, mode)
return handle_posix_error('open', fd)
c_read = external(UNDERSCORE_ON_WIN32 + 'read',
More information about the pypy-commit
mailing list