[pypy-commit] pypy release-1.8.x: merge default up to 820edf258da9
fijal
noreply at buildbot.pypy.org
Wed Feb 8 11:33:19 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: release-1.8.x
Changeset: r52221:9d3e67742b56
Date: 2012-02-08 12:28 +0200
http://bitbucket.org/pypy/pypy/changeset/9d3e67742b56/
Log: merge default up to 820edf258da9
diff --git a/py/_io/terminalwriter.py b/py/_io/terminalwriter.py
--- a/py/_io/terminalwriter.py
+++ b/py/_io/terminalwriter.py
@@ -271,16 +271,24 @@
('srWindow', SMALL_RECT),
('dwMaximumWindowSize', COORD)]
+ _GetStdHandle = ctypes.windll.kernel32.GetStdHandle
+ _GetStdHandle.argtypes = [wintypes.DWORD]
+ _GetStdHandle.restype = wintypes.HANDLE
def GetStdHandle(kind):
- return ctypes.windll.kernel32.GetStdHandle(kind)
+ return _GetStdHandle(kind)
- SetConsoleTextAttribute = \
- ctypes.windll.kernel32.SetConsoleTextAttribute
-
+ SetConsoleTextAttribute = ctypes.windll.kernel32.SetConsoleTextAttribute
+ SetConsoleTextAttribute.argtypes = [wintypes.HANDLE, wintypes.WORD]
+ SetConsoleTextAttribute.restype = wintypes.BOOL
+
+ _GetConsoleScreenBufferInfo = \
+ ctypes.windll.kernel32.GetConsoleScreenBufferInfo
+ _GetConsoleScreenBufferInfo.argtypes = [wintypes.HANDLE,
+ ctypes.POINTER(CONSOLE_SCREEN_BUFFER_INFO)]
+ _GetConsoleScreenBufferInfo.restype = wintypes.BOOL
def GetConsoleInfo(handle):
info = CONSOLE_SCREEN_BUFFER_INFO()
- ctypes.windll.kernel32.GetConsoleScreenBufferInfo(\
- handle, ctypes.byref(info))
+ _GetConsoleScreenBufferInfo(handle, ctypes.byref(info))
return info
def _getdimensions():
diff --git a/pypy/doc/Makefile b/pypy/doc/Makefile
--- a/pypy/doc/Makefile
+++ b/pypy/doc/Makefile
@@ -81,6 +81,7 @@
"run these through (pdf)latex."
man:
+ python config/generate.py
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man"
diff --git a/pypy/doc/commandline_ref.rst b/pypy/doc/commandline_ref.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/commandline_ref.rst
@@ -0,0 +1,10 @@
+Command line reference
+======================
+
+Manual pages
+------------
+
+.. toctree::
+ :maxdepth: 1
+
+ man/pypy.1.rst
diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -45,9 +45,9 @@
# built documents.
#
# The short X.Y version.
-version = '1.7'
+version = '1.8'
# The full version, including alpha/beta/rc tags.
-release = '1.7'
+release = '1.8'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/pypy/doc/config/translation.log.txt b/pypy/doc/config/translation.log.txt
--- a/pypy/doc/config/translation.log.txt
+++ b/pypy/doc/config/translation.log.txt
@@ -2,4 +2,4 @@
These must be enabled by setting the PYPYLOG environment variable.
The exact set of features supported by PYPYLOG is described in
-pypy/translation/c/src/debug.h.
+pypy/translation/c/src/debug_print.h.
diff --git a/pypy/doc/garbage_collection.rst b/pypy/doc/garbage_collection.rst
--- a/pypy/doc/garbage_collection.rst
+++ b/pypy/doc/garbage_collection.rst
@@ -142,10 +142,9 @@
So as a first approximation, when compared to the Hybrid GC, the
Minimark GC saves one word of memory per old object.
-There are a number of environment variables that can be tweaked to
-influence the GC. (Their default value should be ok for most usages.)
-You can read more about them at the start of
-`pypy/rpython/memory/gc/minimark.py`_.
+There are :ref:`a number of environment variables
+<minimark-environment-variables>` that can be tweaked to influence the
+GC. (Their default value should be ok for most usages.)
In more detail:
@@ -211,5 +210,4 @@
are preserved. If the object dies then the pre-reserved location
becomes free garbage, to be collected at the next major collection.
-
.. include:: _ref.txt
diff --git a/pypy/doc/gc_info.rst b/pypy/doc/gc_info.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/gc_info.rst
@@ -0,0 +1,53 @@
+Garbage collector configuration
+===============================
+
+.. _minimark-environment-variables:
+
+Minimark
+--------
+
+PyPy's default ``minimark`` garbage collector is configurable through
+several environment variables:
+
+``PYPY_GC_NURSERY``
+ The nursery size.
+ Defaults to ``4MB``.
+ Small values (like 1 or 1KB) are useful for debugging.
+
+``PYPY_GC_MAJOR_COLLECT``
+ Major collection memory factor.
+ Default is ``1.82``, which means trigger a major collection when the
+ memory consumed equals 1.82 times the memory really used at the end
+ of the previous major collection.
+
+``PYPY_GC_GROWTH``
+ Major collection threshold's max growth rate.
+ Default is ``1.4``.
+ Useful to collect more often than normally on sudden memory growth,
+ e.g. when there is a temporary peak in memory usage.
+
+``PYPY_GC_MAX``
+ The max heap size.
+ If coming near this limit, it will first collect more often, then
+ raise an RPython MemoryError, and if that is not enough, crash the
+ program with a fatal error.
+ Try values like ``1.6GB``.
+
+``PYPY_GC_MAX_DELTA``
+ The major collection threshold will never be set to more than
+ ``PYPY_GC_MAX_DELTA`` the amount really used after a collection.
+ Defaults to 1/8th of the total RAM size (which is constrained to be
+ at most 2/3/4GB on 32-bit systems).
+ Try values like ``200MB``.
+
+``PYPY_GC_MIN``
+ Don't collect while the memory size is below this limit.
+ Useful to avoid spending all the time in the GC in very small
+ programs.
+ Defaults to 8 times the nursery.
+
+``PYPY_GC_DEBUG``
+ Enable extra checks around collections that are too slow for normal
+ use.
+ Values are ``0`` (off), ``1`` (on major collections) or ``2`` (also
+ on minor collections).
diff --git a/pypy/doc/index.rst b/pypy/doc/index.rst
--- a/pypy/doc/index.rst
+++ b/pypy/doc/index.rst
@@ -353,10 +353,12 @@
getting-started-dev.rst
windows.rst
faq.rst
+ commandline_ref.rst
architecture.rst
coding-guide.rst
cpython_differences.rst
garbage_collection.rst
+ gc_info.rst
interpreter.rst
objspace.rst
__pypy__-module.rst
diff --git a/pypy/doc/man/pypy.1.rst b/pypy/doc/man/pypy.1.rst
--- a/pypy/doc/man/pypy.1.rst
+++ b/pypy/doc/man/pypy.1.rst
@@ -24,6 +24,9 @@
-S
Do not ``import site`` on initialization.
+-s
+ Don't add the user site directory to `sys.path`.
+
-u
Unbuffered binary ``stdout`` and ``stderr``.
@@ -39,6 +42,9 @@
-E
Ignore environment variables (such as ``PYTHONPATH``).
+-B
+ Disable writing bytecode (``.pyc``) files.
+
--version
Print the PyPy version.
@@ -84,6 +90,64 @@
Optimizations to enabled or ``all``.
Warning, this option is dangerous, and should be avoided.
+ENVIRONMENT
+===========
+
+``PYTHONPATH``
+ Add directories to pypy's module search path.
+ The format is the same as shell's ``PATH``.
+
+``PYTHONSTARTUP``
+ A script referenced by this variable will be executed before the
+ first prompt is displayed, in interactive mode.
+
+``PYTHONDONTWRITEBYTECODE``
+ If set to a non-empty value, equivalent to the ``-B`` option.
+ Disable writing ``.pyc`` files.
+
+``PYTHONINSPECT``
+ If set to a non-empty value, equivalent to the ``-i`` option.
+ Inspect interactively after running the specified script.
+
+``PYTHONIOENCODING``
+ If this is set, it overrides the encoding used for
+ *stdin*/*stdout*/*stderr*.
+ The syntax is *encodingname*:*errorhandler*
+ The *errorhandler* part is optional and has the same meaning as in
+ `str.encode`.
+
+``PYTHONNOUSERSITE``
+ If set to a non-empty value, equivalent to the ``-s`` option.
+ Don't add the user site directory to `sys.path`.
+
+``PYTHONWARNINGS``
+ If set, equivalent to the ``-W`` option (warning control).
+ The value should be a comma-separated list of ``-W`` parameters.
+
+``PYPYLOG``
+ If set to a non-empty value, enable logging, the format is:
+
+ *fname*
+ logging for profiling: includes all
+ ``debug_start``/``debug_stop`` but not any nested
+ ``debug_print``.
+ *fname* can be ``-`` to log to *stderr*.
+
+ ``:``\ *fname*
+ Full logging, including ``debug_print``.
+
+ *prefix*\ ``:``\ *fname*
+ Conditional logging.
+ Multiple prefixes can be specified, comma-separated.
+ Only sections whose name match the prefix will be logged.
+
+ ``PYPYLOG``\ =\ ``jit-log-opt,jit-backend:``\ *logfile* will
+ generate a log suitable for *jitviewer*, a tool for debugging
+ performance issues under PyPy.
+
+.. include:: ../gc_info.rst
+ :start-line: 7
+
SEE ALSO
========
diff --git a/pypy/doc/release-1.8.0.rst b/pypy/doc/release-1.8.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-1.8.0.rst
@@ -0,0 +1,52 @@
+============================
+PyPy 1.8 - business as usual
+============================
+
+We're pleased to announce the 1.8 release of PyPy. As became a habit, this
+release brings a lot of bugfixes, performance and memory improvements over
+the 1.7 release. The main highlight of the release is the introduction of
+list strategies which makes homogenous lists more efficient both in terms
+of performance and memory. Otherwise it's "business as usual" in the sense
+that performance improved roughly 10% on average since the previous release.
+You can download the PyPy 1.8 release here:
+
+ http://pypy.org/download.html
+
+What is PyPy?
+=============
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7. It's fast (`pypy 1.8 and cpython 2.7.1`_ performance comparison)
+due to its integrated tracing JIT compiler.
+
+This release supports x86 machines running Linux 32/64, Mac OS X 32/64 or
+Windows 32. Windows 64 work is ongoing, but not yet natively supported.
+
+.. _`pypy 1.8 and cpython 2.7.1`: http://speed.pypy.org
+
+
+Highlights
+==========
+
+* List strategies. Now lists that contain only ints or only floats should
+ be as efficient as storing them in a binary-packed array. It also improves
+ the JIT performance in places that use such lists. There are also special
+ strategies for unicode and string lists.
+
+* As usual, numerous performance improvements. There are too many examples
+ of python constructs that now should behave faster to list them.
+
+* Bugfixes and compatibility fixes with CPython.
+
+* Windows fixes.
+
+* NumPy effort progress; for the exact list of things that have been done,
+ consult the `numpy status page`_. A tentative list of things that has
+ been done:
+
+ xxxx # list it, multidim arrays in particular
+
+* Fundraising XXX
+
+.. _`numpy status page`: xxx
+.. _`numpy status update blog report`: xxx
diff --git a/pypy/interpreter/astcompiler/optimize.py b/pypy/interpreter/astcompiler/optimize.py
--- a/pypy/interpreter/astcompiler/optimize.py
+++ b/pypy/interpreter/astcompiler/optimize.py
@@ -302,8 +302,7 @@
# narrow builds will return a surrogate. In both
# the cases skip the optimization in order to
# produce compatible pycs.
- if (self.space.isinstance_w(w_obj, self.space.w_unicode)
- and
+ if (self.space.isinstance_w(w_obj, self.space.w_unicode) and
self.space.isinstance_w(w_const, self.space.w_unicode)):
unistr = self.space.unicode_w(w_const)
if len(unistr) == 1:
@@ -311,7 +310,7 @@
else:
ch = 0
if (ch > 0xFFFF or
- (MAXUNICODE == 0xFFFF and 0xD800 <= ch <= 0xDFFFF)):
+ (MAXUNICODE == 0xFFFF and 0xD800 <= ch <= 0xDFFF)):
return subs
return ast.Const(w_const, subs.lineno, subs.col_offset)
diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -838,7 +838,7 @@
# Just checking this doesn't crash out
self.count_instructions(source)
- def test_const_fold_unicode_subscr(self):
+ def test_const_fold_unicode_subscr(self, monkeypatch):
source = """def f():
return u"abc"[0]
"""
@@ -853,6 +853,14 @@
assert counts == {ops.LOAD_CONST: 2, ops.BINARY_SUBSCR: 1,
ops.RETURN_VALUE: 1}
+ monkeypatch.setattr(optimize, "MAXUNICODE", 0xFFFF)
+ source = """def f():
+ return u"\uE01F"[0]
+ """
+ counts = self.count_instructions(source)
+ assert counts == {ops.LOAD_CONST: 1, ops.RETURN_VALUE: 1}
+ monkeypatch.undo()
+
# getslice is not yet optimized.
# Still, check a case which yields the empty string.
source = """def f():
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1340,6 +1340,15 @@
def unicode_w(self, w_obj):
return w_obj.unicode_w(self)
+ def unicode0_w(self, w_obj):
+ "Like unicode_w, but rejects strings with NUL bytes."
+ from pypy.rlib import rstring
+ result = w_obj.unicode_w(self)
+ if u'\x00' in result:
+ raise OperationError(self.w_TypeError, self.wrap(
+ 'argument must be a unicode string without NUL characters'))
+ return rstring.assert_str0(result)
+
def realunicode_w(self, w_obj):
# Like unicode_w, but only works if w_obj is really of type
# 'unicode'.
@@ -1638,6 +1647,9 @@
'UnicodeEncodeError',
'UnicodeDecodeError',
]
+
+if sys.platform.startswith("win"):
+ ObjSpace.ExceptionTable += ['WindowsError']
## Irregular part of the interface:
#
diff --git a/pypy/interpreter/test/test_objspace.py b/pypy/interpreter/test/test_objspace.py
--- a/pypy/interpreter/test/test_objspace.py
+++ b/pypy/interpreter/test/test_objspace.py
@@ -178,6 +178,14 @@
res = self.space.interp_w(Function, w(None), can_be_None=True)
assert res is None
+ def test_str0_w(self):
+ space = self.space
+ w = space.wrap
+ assert space.str0_w(w("123")) == "123"
+ exc = space.raises_w(space.w_TypeError, space.str0_w, w("123\x004"))
+ assert space.unicode0_w(w(u"123")) == u"123"
+ exc = space.raises_w(space.w_TypeError, space.unicode0_w, w(u"123\x004"))
+
def test_getindex_w(self):
w_instance1 = self.space.appexec([], """():
class X(object):
diff --git a/pypy/jit/codewriter/flatten.py b/pypy/jit/codewriter/flatten.py
--- a/pypy/jit/codewriter/flatten.py
+++ b/pypy/jit/codewriter/flatten.py
@@ -162,7 +162,9 @@
if len(block.exits) == 1:
# A single link, fall-through
link = block.exits[0]
- assert link.exitcase is None
+ assert link.exitcase in (None, False, True)
+ # the cases False or True should not really occur, but can show
+ # up in the manually hacked graphs for generators...
self.make_link(link)
#
elif block.exitswitch is c_last_exception:
diff --git a/pypy/jit/codewriter/policy.py b/pypy/jit/codewriter/policy.py
--- a/pypy/jit/codewriter/policy.py
+++ b/pypy/jit/codewriter/policy.py
@@ -48,7 +48,7 @@
mod = func.__module__ or '?'
if mod.startswith('pypy.rpython.module.'):
return True
- if mod.startswith('pypy.translator.'): # XXX wtf?
+ if mod == 'pypy.translator.goal.nanos': # more helpers
return True
return False
diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -3706,6 +3706,18 @@
# here it works again
self.check_operations_history(guard_class=0, record_known_class=1)
+ def test_generator(self):
+ def g(n):
+ yield n+1
+ yield n+2
+ yield n+3
+ def f(n):
+ gen = g(n)
+ return gen.next() * gen.next() * gen.next()
+ res = self.interp_operations(f, [10])
+ assert res == 11 * 12 * 13
+ self.check_operations_history(int_add=3, int_mul=2)
+
class TestLLtype(BaseLLtypeTests, LLJitMixin):
def test_tagged(self):
diff --git a/pypy/module/_ffi/test/test__ffi.py b/pypy/module/_ffi/test/test__ffi.py
--- a/pypy/module/_ffi/test/test__ffi.py
+++ b/pypy/module/_ffi/test/test__ffi.py
@@ -190,6 +190,7 @@
def test_convert_strings_to_char_p(self):
"""
+ DLLEXPORT
long mystrlen(char* s)
{
long len = 0;
@@ -215,6 +216,7 @@
def test_convert_unicode_to_unichar_p(self):
"""
#include <wchar.h>
+ DLLEXPORT
long mystrlen_u(wchar_t* s)
{
long len = 0;
@@ -241,6 +243,7 @@
def test_keepalive_temp_buffer(self):
"""
+ DLLEXPORT
char* do_nothing(char* s)
{
return s;
@@ -525,5 +528,7 @@
from _ffi import CDLL, types
libfoo = CDLL(self.libfoo_name)
raises(AttributeError, "libfoo.getfunc('I_do_not_exist', [], types.void)")
+ if self.iswin32:
+ skip("unix specific")
libnone = CDLL(None)
raises(AttributeError, "libnone.getfunc('I_do_not_exist', [], types.void)")
diff --git a/pypy/module/_file/test/test_file.py b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -265,6 +265,13 @@
if option.runappdirect:
py.test.skip("works with internals of _file impl on py.py")
+ import platform
+ if platform.system() == 'Windows':
+ # XXX This test crashes until someone implements something like
+ # XXX verify_fd from
+ # XXX http://hg.python.org/cpython/file/80ddbd822227/Modules/posixmodule.c#l434
+ # XXX and adds it to fopen
+ assert False
state = [0]
def read(fd, n=None):
diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -80,6 +80,7 @@
descr_sub = _binop_impl("subtract")
descr_mul = _binop_impl("multiply")
descr_div = _binop_impl("divide")
+ descr_truediv = _binop_impl("true_divide")
descr_pow = _binop_impl("power")
descr_eq = _binop_impl("equal")
descr_ne = _binop_impl("not_equal")
@@ -174,6 +175,7 @@
__sub__ = interp2app(W_GenericBox.descr_sub),
__mul__ = interp2app(W_GenericBox.descr_mul),
__div__ = interp2app(W_GenericBox.descr_div),
+ __truediv__ = interp2app(W_GenericBox.descr_truediv),
__pow__ = interp2app(W_GenericBox.descr_pow),
__radd__ = interp2app(W_GenericBox.descr_radd),
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -401,3 +401,9 @@
else:
assert issubclass(int64, int)
assert int_ is int64
+
+ def test_operators(self):
+ from operator import truediv
+ from _numpypy import float64, int_
+
+ assert truediv(int_(3), int_(2)) == float64(1.5)
diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -48,7 +48,7 @@
return fsencode_w(self.space, self.w_obj)
def as_unicode(self):
- return self.space.unicode_w(self.w_obj)
+ return self.space.unicode0_w(self.w_obj)
class FileDecoder(object):
def __init__(self, space, w_obj):
@@ -62,7 +62,7 @@
space = self.space
w_unicode = space.call_method(self.w_obj, 'decode',
getfilesystemencoding(space))
- return space.unicode_w(w_unicode)
+ return space.unicode0_w(w_unicode)
@specialize.memo()
def dispatch_filename(func, tag=0):
diff --git a/pypy/module/posix/test/test_ztranslation.py b/pypy/module/posix/test/test_ztranslation.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/posix/test/test_ztranslation.py
@@ -0,0 +1,4 @@
+from pypy.objspace.fake.checkmodule import checkmodule
+
+def test_posix_translates():
+ checkmodule('posix')
\ No newline at end of file
diff --git a/pypy/module/pypyjit/test_pypy_c/test_call.py b/pypy/module/pypyjit/test_pypy_c/test_call.py
--- a/pypy/module/pypyjit/test_pypy_c/test_call.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_call.py
@@ -27,6 +27,7 @@
...
p53 = call_assembler(..., descr=...)
guard_not_forced(descr=...)
+ keepalive(...)
guard_no_exception(descr=...)
...
""")
diff --git a/pypy/module/zipimport/interp_zipimport.py b/pypy/module/zipimport/interp_zipimport.py
--- a/pypy/module/zipimport/interp_zipimport.py
+++ b/pypy/module/zipimport/interp_zipimport.py
@@ -123,7 +123,9 @@
self.prefix = prefix
def getprefix(self, space):
- return space.wrap(self.prefix)
+ if ZIPSEP == os.path.sep:
+ return space.wrap(self.prefix)
+ return space.wrap(self.prefix.replace(ZIPSEP, os.path.sep))
def _find_relative_path(self, filename):
if filename.startswith(self.filename):
@@ -381,7 +383,7 @@
prefix = name[len(filename):]
if prefix.startswith(os.path.sep) or prefix.startswith(ZIPSEP):
prefix = prefix[1:]
- if prefix and not prefix.endswith(ZIPSEP):
+ if prefix and not prefix.endswith(ZIPSEP) and not prefix.endswith(os.path.sep):
prefix += ZIPSEP
w_result = space.wrap(W_ZipImporter(space, name, filename, zip_file, prefix))
zip_cache.set(filename, w_result)
diff --git a/pypy/module/zipimport/test/test_undocumented.py b/pypy/module/zipimport/test/test_undocumented.py
--- a/pypy/module/zipimport/test/test_undocumented.py
+++ b/pypy/module/zipimport/test/test_undocumented.py
@@ -119,7 +119,7 @@
zip_importer = zipimport.zipimporter(path)
assert isinstance(zip_importer, zipimport.zipimporter)
assert zip_importer.archive == zip_path
- assert zip_importer.prefix == prefix
+ assert zip_importer.prefix == prefix.replace('/', os.path.sep)
assert zip_path in zipimport._zip_directory_cache
finally:
self.cleanup_zipfile(self.created_paths)
diff --git a/pypy/module/zipimport/test/test_zipimport.py b/pypy/module/zipimport/test/test_zipimport.py
--- a/pypy/module/zipimport/test/test_zipimport.py
+++ b/pypy/module/zipimport/test/test_zipimport.py
@@ -15,7 +15,7 @@
cpy's regression tests
"""
compression = ZIP_STORED
- pathsep = '/'
+ pathsep = os.path.sep
def make_pyc(cls, space, co, mtime):
data = marshal.dumps(co)
@@ -129,7 +129,7 @@
self.writefile('sub/__init__.py', '')
self.writefile('sub/yy.py', '')
from zipimport import _zip_directory_cache, zipimporter
- sub_importer = zipimporter(self.zipfile + '/sub')
+ sub_importer = zipimporter(self.zipfile + os.path.sep + 'sub')
main_importer = zipimporter(self.zipfile)
assert main_importer is not sub_importer
diff --git a/pypy/rlib/ropenssl.py b/pypy/rlib/ropenssl.py
--- a/pypy/rlib/ropenssl.py
+++ b/pypy/rlib/ropenssl.py
@@ -54,6 +54,7 @@
ASN1_STRING = lltype.Ptr(lltype.ForwardReference())
ASN1_ITEM = rffi.COpaquePtr('ASN1_ITEM')
+ASN1_ITEM_EXP = lltype.Ptr(lltype.FuncType([], ASN1_ITEM))
X509_NAME = rffi.COpaquePtr('X509_NAME')
class CConfig:
@@ -101,12 +102,11 @@
X509_extension_st = rffi_platform.Struct(
'struct X509_extension_st',
[('value', ASN1_STRING)])
- ASN1_ITEM_EXP = lltype.FuncType([], ASN1_ITEM)
X509V3_EXT_D2I = lltype.FuncType([rffi.VOIDP, rffi.CCHARPP, rffi.LONG],
rffi.VOIDP)
v3_ext_method = rffi_platform.Struct(
'struct v3_ext_method',
- [('it', lltype.Ptr(ASN1_ITEM_EXP)),
+ [('it', ASN1_ITEM_EXP),
('d2i', lltype.Ptr(X509V3_EXT_D2I))])
GENERAL_NAME_st = rffi_platform.Struct(
'struct GENERAL_NAME_st',
@@ -118,6 +118,8 @@
('block_size', rffi.INT)])
EVP_MD_SIZE = rffi_platform.SizeOf('EVP_MD')
EVP_MD_CTX_SIZE = rffi_platform.SizeOf('EVP_MD_CTX')
+ OPENSSL_EXPORT_VAR_AS_FUNCTION = rffi_platform.Defined(
+ "OPENSSL_EXPORT_VAR_AS_FUNCTION")
for k, v in rffi_platform.configure(CConfig).items():
@@ -224,7 +226,10 @@
ssl_external('i2a_ASN1_INTEGER', [BIO, ASN1_INTEGER], rffi.INT)
ssl_external('ASN1_item_d2i',
[rffi.VOIDP, rffi.CCHARPP, rffi.LONG, ASN1_ITEM], rffi.VOIDP)
-ssl_external('ASN1_ITEM_ptr', [rffi.VOIDP], ASN1_ITEM, macro=True)
+if OPENSSL_EXPORT_VAR_AS_FUNCTION:
+ ssl_external('ASN1_ITEM_ptr', [ASN1_ITEM_EXP], ASN1_ITEM, macro=True)
+else:
+ ssl_external('ASN1_ITEM_ptr', [rffi.VOIDP], ASN1_ITEM, macro=True)
ssl_external('sk_GENERAL_NAME_num', [GENERAL_NAMES], rffi.INT,
macro=True)
diff --git a/pypy/rpython/module/ll_os.py b/pypy/rpython/module/ll_os.py
--- a/pypy/rpython/module/ll_os.py
+++ b/pypy/rpython/module/ll_os.py
@@ -43,7 +43,7 @@
arglist = ['arg%d' % (i,) for i in range(len(signature))]
transformed_arglist = arglist[:]
for i, arg in enumerate(signature):
- if arg is unicode:
+ if arg in (unicode, unicode0):
transformed_arglist[i] = transformed_arglist[i] + '.as_unicode()'
args = ', '.join(arglist)
@@ -67,7 +67,7 @@
exec source.compile() in miniglobals
new_func = miniglobals[func_name]
specialized_args = [i for i in range(len(signature))
- if signature[i] in (unicode, None)]
+ if signature[i] in (unicode, unicode0, None)]
new_func = specialize.argtype(*specialized_args)(new_func)
# Monkeypatch the function in pypy.rlib.rposix
diff --git a/pypy/translator/c/gc.py b/pypy/translator/c/gc.py
--- a/pypy/translator/c/gc.py
+++ b/pypy/translator/c/gc.py
@@ -11,7 +11,6 @@
from pypy.translator.tool.cbuild import ExternalCompilationInfo
class BasicGcPolicy(object):
- stores_hash_at_the_end = False
def __init__(self, db, thread_enabled=False):
self.db = db
@@ -47,8 +46,7 @@
return ExternalCompilationInfo(
pre_include_bits=['/* using %s */' % (gct.__class__.__name__,),
'#define MALLOC_ZERO_FILLED %d' % (gct.malloc_zero_filled,),
- ],
- post_include_bits=['typedef void *GC_hidden_pointer;']
+ ]
)
def get_prebuilt_hash(self, obj):
@@ -308,7 +306,6 @@
class FrameworkGcPolicy(BasicGcPolicy):
transformerclass = framework.FrameworkGCTransformer
- stores_hash_at_the_end = True
def struct_setup(self, structdefnode, rtti):
if rtti is not None and hasattr(rtti._obj, 'destructor_funcptr'):
More information about the pypy-commit
mailing list