Author: Brian Kearns <[email protected]>
Branch: fix-version-tool
Changeset: r60562:a0295c6b1209
Date: 2013-01-27 16:41 -0500
http://bitbucket.org/pypy/pypy/changeset/a0295c6b1209/
Log: merge default
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -34,6 +34,9 @@
.. branch: kill-faking
.. branch: improved_ebnfparse_error
.. branch: task-decorator
+.. branch: fix-e4fa0b2
+.. branch: win32-fixes
+.. branch: fix-version-tool
.. branch: release-2.0-beta1
diff --git a/pypy/module/unicodedata/interp_ucd.py
b/pypy/module/unicodedata/interp_ucd.py
--- a/pypy/module/unicodedata/interp_ucd.py
+++ b/pypy/module/unicodedata/interp_ucd.py
@@ -9,7 +9,7 @@
from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.runicode import MAXUNICODE
from rpython.rlib.unicodedata import unicodedb_5_2_0, unicodedb_3_2_0
-from rpython.rlib.runicode import code_to_unichr, ORD
+from rpython.rlib.runicode import code_to_unichr, ord_accepts_surrogate
import sys
@@ -28,8 +28,6 @@
# handling: on narrow unicode builds, a surrogate pair is considered as one
# unicode code point.
-# The functions below are subtly different from the ones in runicode.py.
-# When PyPy implements Python 3 they should be merged.
if MAXUNICODE > 0xFFFF:
# Target is wide build
@@ -41,7 +39,7 @@
if not we_are_translated() and sys.maxunicode == 0xFFFF:
# Host CPython is narrow build, accept surrogates
try:
- return ORD(space.unicode_w(w_unichr))
+ return ord_accepts_surrogate(space.unicode_w(w_unichr))
except ValueError:
raise OperationError(space.w_TypeError, space.wrap(
'need a single Unicode character as parameter'))
@@ -68,7 +66,7 @@
else:
# Accept surrogates
try:
- return ORD(space.unicode_w(w_unichr))
+ return ord_accepts_surrogate(space.unicode_w(w_unichr))
except ValueError:
raise OperationError(space.w_TypeError, space.wrap(
'need a single Unicode character as parameter'))
diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -344,7 +344,7 @@
])
CConfig.WSAPROTOCOL_INFO = platform.Struct(
- 'struct WSAPROTOCOL_INFO',
+ 'WSAPROTOCOL_INFO',
[]) # Struct is just passed between functions
CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger(
'FROM_PROTOCOL_INFO')
@@ -617,7 +617,7 @@
WSASocket = external('WSASocket',
[rffi.INT, rffi.INT, rffi.INT,
lltype.Ptr(WSAPROTOCOL_INFO),
- rffi.DWORD, rffi.DWORD],
+ rwin32.DWORD, rwin32.DWORD],
socketfd_type)
if WIN32:
diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -13,6 +13,27 @@
BYTEORDER = sys.byteorder
+# python 2.7 has a preview of py3k behavior, so those functions
+# are used either when we're testing wide pypy on narrow cpython
+# or in unicodedata in pypy
+
+def unichr_returns_surrogate(c):
+ if c <= sys.maxunicode or c > MAXUNICODE:
+ return unichr(c)
+ else:
+ c -= 0x10000
+ return (unichr(0xD800 + (c >> 10)) +
+ unichr(0xDC00 + (c & 0x03FF)))
+
+def ord_accepts_surrogate(u):
+ if isinstance(u, unicode) and len(u) == 2:
+ ch1 = ord(u[0])
+ ch2 = ord(u[1])
+ if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF:
+ return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x10000
+ assert len(u) == 1
+ return ord(u[0])
+
if MAXUNICODE > sys.maxunicode:
# A version of unichr which allows codes outside the BMP
# even on narrow unicode builds.
@@ -21,12 +42,7 @@
# Note that Python3 uses a similar implementation.
def UNICHR(c):
assert not we_are_translated()
- if c <= sys.maxunicode or c > MAXUNICODE:
- return unichr(c)
- else:
- c -= 0x10000
- return (unichr(0xD800 + (c >> 10)) +
- unichr(0xDC00 + (c & 0x03FF)))
+ return unichr_returns_surrogate(c)
UNICHR._flowspace_rewrite_directly_as_ = unichr
# ^^^ NB.: for translation, it's essential to use this hack instead
# of calling unichr() from UNICHR(), because unichr() detects if there
@@ -34,12 +50,7 @@
def ORD(u):
assert not we_are_translated()
- if isinstance(u, unicode) and len(u) == 2:
- ch1 = ord(u[0])
- ch2 = ord(u[1])
- if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF:
- return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x10000
- return ord(u)
+ return ord_accepts_surrogate(u)
ORD._flowspace_rewrite_directly_as_ = ord
else:
@@ -50,13 +61,13 @@
def code_to_unichr(code):
if not we_are_translated() and sys.maxunicode == 0xFFFF:
# Host CPython is narrow build, generate surrogates
- return UNICHR(code)
+ return unichr_returns_surrogate(code)
else:
return unichr(code)
else:
def code_to_unichr(code):
# generate surrogates for large codes
- return UNICHR(code)
+ return unichr_returns_surrogate(code)
def _STORECHAR(result, CH, byteorder):
hi = chr(((CH) >> 8) & 0xff)
diff --git a/rpython/translator/platform/posix.py
b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -115,7 +115,7 @@
cflags = self.cflags + self.standalone_only
m = GnuMakefile(path)
- m.exe_name = path.join(target_name)
+ m.exe_name = path.join(exe_name.basename)
m.eci = eci
def rpyrel(fpath):
diff --git a/rpython/translator/platform/windows.py
b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -269,7 +269,7 @@
target_name = exe_name.basename
m = NMakefile(path)
- m.exe_name = path.join(target_name)
+ m.exe_name = path.join(exe_name.basename)
m.eci = eci
linkflags = list(self.link_flags)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit