[pypy-commit] pypy default: cleanup
pjenvey
noreply at buildbot.pypy.org
Sun Dec 8 00:45:42 CET 2013
Author: Philip Jenvey <pjenvey at underboss.org>
Branch:
Changeset: r68397:2a5c9b39d31f
Date: 2013-12-07 12:00 -0800
http://bitbucket.org/pypy/pypy/changeset/2a5c9b39d31f/
Log: cleanup
diff --git a/rpython/memory/gc/inspector.py b/rpython/memory/gc/inspector.py
--- a/rpython/memory/gc/inspector.py
+++ b/rpython/memory/gc/inspector.py
@@ -3,7 +3,7 @@
"""
from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
from rpython.rlib.objectmodel import free_non_gc_object
-from rpython.rtyper.module.ll_os import underscore_on_windows
+from rpython.rtyper.module.ll_os import UNDERSCORE_ON_WIN32
from rpython.rlib import rposix, rgc
from rpython.memory.support import AddressDict, get_address_stack
@@ -94,7 +94,7 @@
# ----------
-raw_os_write = rffi.llexternal(underscore_on_windows+'write',
+raw_os_write = rffi.llexternal(UNDERSCORE_ON_WIN32 + 'write',
[rffi.INT, llmemory.Address, rffi.SIZE_T],
rffi.SIZE_T,
sandboxsafe=True, _nowrapper=True)
diff --git a/rpython/rtyper/lltypesystem/module/ll_math.py b/rpython/rtyper/lltypesystem/module/ll_math.py
--- a/rpython/rtyper/lltypesystem/module/ll_math.py
+++ b/rpython/rtyper/lltypesystem/module/ll_math.py
@@ -10,6 +10,7 @@
from rpython.translator.tool.cbuild import ExternalCompilationInfo
from rpython.translator.platform import platform
from rpython.rlib.rfloat import isfinite, isinf, isnan, INFINITY, NAN
+from rpython.rtyper.module.support import UNDERSCORE_ON_WIN32
use_library_isinf_isnan = False
if sys.platform == "win32":
@@ -50,16 +51,11 @@
compilation_info=math_eci,
sandboxsafe=True)
-if sys.platform == 'win32':
- underscore = '_'
-else:
- underscore = ''
-
math_fabs = llexternal('fabs', [rffi.DOUBLE], rffi.DOUBLE)
math_log = llexternal('log', [rffi.DOUBLE], rffi.DOUBLE)
math_log10 = llexternal('log10', [rffi.DOUBLE], rffi.DOUBLE)
math_log1p = math_llexternal('log1p', [rffi.DOUBLE], rffi.DOUBLE)
-math_copysign = llexternal(underscore + 'copysign',
+math_copysign = llexternal(UNDERSCORE_ON_WIN32 + 'copysign',
[rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE,
elidable_function=True)
math_atan2 = llexternal('atan2', [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
@@ -68,7 +64,7 @@
math_ldexp = llexternal('ldexp', [rffi.DOUBLE, rffi.INT], rffi.DOUBLE)
math_pow = llexternal('pow', [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
math_fmod = llexternal('fmod', [rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
-math_hypot = llexternal(underscore + 'hypot',
+math_hypot = llexternal(UNDERSCORE_ON_WIN32 + 'hypot',
[rffi.DOUBLE, rffi.DOUBLE], rffi.DOUBLE)
math_floor = llexternal('floor', [rffi.DOUBLE], rffi.DOUBLE, elidable_function=True)
math_sqrt = llexternal('sqrt', [rffi.DOUBLE], rffi.DOUBLE)
diff --git a/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py b/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py
@@ -15,6 +15,7 @@
from rpython.tool.udir import udir
from rpython.rtyper.test.test_llinterp import interpret
from rpython.annotator.annrpython import RPythonAnnotator
+from rpython.rtyper.module.support import UNDERSCORE_ON_WIN32
from rpython.rtyper.rtyper import RPythonTyper
from rpython.rlib.rarithmetic import r_uint, get_long_pattern, is_emulated_long
from rpython.rlib.rarithmetic import is_valid_int
@@ -744,7 +745,6 @@
def test_get_errno(self):
eci = ExternalCompilationInfo(includes=['string.h'])
if sys.platform.startswith('win'):
- underscore_on_windows = '_'
# Note that cpython before 2.7 installs an _invalid_parameter_handler,
# which is why the test passes there, but this is no longer
# accepted practice.
@@ -753,11 +753,9 @@
old_err_mode = ctypes.windll.kernel32.GetErrorMode()
new_err_mode = old_err_mode | SEM_NOGPFAULTERRORBOX
ctypes.windll.kernel32.SetErrorMode(new_err_mode)
- else:
- underscore_on_windows = ''
strlen = rffi.llexternal('strlen', [rffi.CCHARP], rffi.SIZE_T,
compilation_info=eci)
- os_write = rffi.llexternal(underscore_on_windows+'write',
+ os_write = rffi.llexternal(UNDERSCORE_ON_WIN32 + 'write',
[rffi.INT, rffi.CCHARP, rffi.SIZE_T],
rffi.SIZE_T)
buffer = lltype.malloc(rffi.CCHARP.TO, 5, flavor='raw')
diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -8,7 +8,7 @@
import os, sys, errno
import py
from rpython.rtyper.module.support import (
- _WIN32, StringTraits, UnicodeTraits, underscore_on_windows)
+ UNDERSCORE_ON_WIN32, _WIN32, StringTraits, UnicodeTraits)
from rpython.tool.sourcetools import func_renamer
from rpython.rlib.rarithmetic import r_longlong
from rpython.rtyper.extfunc import (
@@ -138,9 +138,9 @@
SEEK_CUR = platform.DefinedConstantInteger('SEEK_CUR')
SEEK_END = platform.DefinedConstantInteger('SEEK_END')
- UTIMBUF = platform.Struct('struct '+underscore_on_windows+'utimbuf',
- [('actime', rffi.INT),
- ('modtime', rffi.INT)])
+ UTIMBUF = platform.Struct('struct %sutimbuf' % UNDERSCORE_ON_WIN32,
+ [('actime', rffi.INT),
+ ('modtime', rffi.INT)])
class RegisterOs(BaseLazyRegistering):
@@ -347,7 +347,8 @@
@registering(os.dup)
def register_os_dup(self):
- os_dup = self.llexternal(underscore_on_windows+'dup', [rffi.INT], rffi.INT)
+ os_dup = self.llexternal(UNDERSCORE_ON_WIN32 + 'dup',
+ [rffi.INT], rffi.INT)
def dup_llimpl(fd):
rposix.validate_fd(fd)
@@ -360,7 +361,7 @@
@registering(os.dup2)
def register_os_dup2(self):
- os_dup2 = self.llexternal(underscore_on_windows+'dup2',
+ os_dup2 = self.llexternal(UNDERSCORE_ON_WIN32 + 'dup2',
[rffi.INT, rffi.INT], rffi.INT)
def dup2_llimpl(fd, newfd):
@@ -1002,7 +1003,7 @@
@registering(os.read)
def register_os_read(self):
- os_read = self.llexternal(underscore_on_windows+'read',
+ os_read = self.llexternal(UNDERSCORE_ON_WIN32 + 'read',
[rffi.INT, rffi.VOIDP, rffi.SIZE_T],
rffi.SIZE_T)
@@ -1027,7 +1028,7 @@
@registering(os.write)
def register_os_write(self):
- os_write = self.llexternal(underscore_on_windows+'write',
+ os_write = self.llexternal(UNDERSCORE_ON_WIN32 + 'write',
[rffi.INT, rffi.VOIDP, rffi.SIZE_T],
rffi.SIZE_T)
@@ -1050,7 +1051,7 @@
@registering(os.close)
def register_os_close(self):
- os_close = self.llexternal(underscore_on_windows+'close', [rffi.INT],
+ os_close = self.llexternal(UNDERSCORE_ON_WIN32 + 'close', [rffi.INT],
rffi.INT, releasegil=False)
def close_llimpl(fd):
@@ -1199,7 +1200,7 @@
@registering(os.getcwd)
def register_os_getcwd(self):
- os_getcwd = self.llexternal(underscore_on_windows + 'getcwd',
+ os_getcwd = self.llexternal(UNDERSCORE_ON_WIN32 + 'getcwd',
[rffi.CCHARP, rffi.SIZE_T],
rffi.CCHARP)
@@ -1227,7 +1228,7 @@
@registering(os.getcwdu, condition=sys.platform=='win32')
def register_os_getcwdu(self):
- os_wgetcwd = self.llexternal(underscore_on_windows + 'wgetcwd',
+ os_wgetcwd = self.llexternal(UNDERSCORE_ON_WIN32 + 'wgetcwd',
[rffi.CWCHARP, rffi.SIZE_T],
rffi.CWCHARP)
@@ -1479,7 +1480,8 @@
@registering(os.isatty)
def register_os_isatty(self):
- os_isatty = self.llexternal(underscore_on_windows+'isatty', [rffi.INT], rffi.INT)
+ os_isatty = self.llexternal(UNDERSCORE_ON_WIN32 + 'isatty',
+ [rffi.INT], rffi.INT)
def isatty_llimpl(fd):
if not rposix.is_valid_fd(fd):
@@ -1672,7 +1674,8 @@
@registering(os.umask)
def register_os_umask(self):
- os_umask = self.llexternal(underscore_on_windows+'umask', [rffi.MODE_T], rffi.MODE_T)
+ os_umask = self.llexternal(UNDERSCORE_ON_WIN32 + 'umask',
+ [rffi.MODE_T], rffi.MODE_T)
def umask_llimpl(newmask):
res = os_umask(rffi.cast(rffi.MODE_T, newmask))
diff --git a/rpython/rtyper/module/support.py b/rpython/rtyper/module/support.py
--- a/rpython/rtyper/module/support.py
+++ b/rpython/rtyper/module/support.py
@@ -4,7 +4,7 @@
from rpython.rtyper.lltypesystem import lltype, rffi
_WIN32 = sys.platform.startswith('win')
-underscore_on_windows = '_' if _WIN32 else ''
+UNDERSCORE_ON_WIN32 = '_' if _WIN32 else ''
# utility conversion functions
class LLSupport:
@@ -56,7 +56,7 @@
@staticmethod
def posix_function_name(name):
- return underscore_on_windows + name
+ return UNDERSCORE_ON_WIN32 + name
@staticmethod
def ll_os_name(name):
@@ -75,7 +75,7 @@
@staticmethod
def posix_function_name(name):
- return underscore_on_windows + 'w' + name
+ return UNDERSCORE_ON_WIN32 + 'w' + name
@staticmethod
def ll_os_name(name):
More information about the pypy-commit
mailing list