[pypy-commit] pypy py3.3: Remove trailing whitespace.

2016-01-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r81942:9b1940890dc0
Date: 2016-01-26 02:59 +0100
http://bitbucket.org/pypy/pypy/changeset/9b1940890dc0/

Log:Remove trailing whitespace.

diff --git a/pypy/module/zlib/test/test_zlib.py 
b/pypy/module/zlib/test/test_zlib.py
--- a/pypy/module/zlib/test/test_zlib.py
+++ b/pypy/module/zlib/test/test_zlib.py
@@ -183,7 +183,7 @@
 assert dco.eof == True
 dco.flush()
 assert dco.eof == True
-
+
 def test_decompress_eof_incomplete_stream(self):
 import zlib
 x = b'x\x9cK\xcb\xcf\x07\x00\x02\x82\x01E'  # 'foo'
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Close this head.

2016-01-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r81941:8abc47287812
Date: 2016-01-26 02:51 +0100
http://bitbucket.org/pypy/pypy/changeset/8abc47287812/

Log:Close this head.

Something went wrong with the last merge from py3k. I'm trying to
fix this by redoing the merge and all subsequent commits.

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy llvm-translation-backend: Add a hack to make functions linked in from C code inlinable.

2016-01-25 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r81940:697b7fe15e58
Date: 2016-01-16 01:34 +0100
http://bitbucket.org/pypy/pypy/changeset/697b7fe15e58/

Log:Add a hack to make functions linked in from C code inlinable.

To make inlining these functions possible, their callers must
(simplified) have the same target specified. This commits adds a
hack to get the necessary attributes from clang.

diff --git a/rpython/translator/llvm/genllvm.py 
b/rpython/translator/llvm/genllvm.py
--- a/rpython/translator/llvm/genllvm.py
+++ b/rpython/translator/llvm/genllvm.py
@@ -942,13 +942,14 @@
 
 def write_graph(self, ptr_type, name, graph, export):
 prevent_inline, llvmgcroot = self.prepare_graph(ptr_type, name, graph)
-self.w('define {linkage}{retvar.T} {name}({a}){add}{gc} {{'.format(
+self.w('define {linkage}{retvar.T} {name}({a}) {attrs}{gc} {{'.format(
linkage='' if export else 'internal ',
retvar=get_repr(graph.getreturnvar()),
name=name,
a=', '.join(get_repr(arg).TV for arg in graph.getargs()
if arg.concretetype is not lltype.Void),
-   add=' noinline' if prevent_inline else '',
+   attrs=database.target_attributes +
+ (' noinline' if prevent_inline else ''),
gc=' gc "pypy"' if llvmgcroot else ''),
'')
 
@@ -1842,6 +1843,32 @@
 
 self.gcpolicy.finish()
 
+def _get_target_information(self):
+"""
+Get datalayout, triple, and "target-cpu" and "target-features"
+attributes for a generic version of the CPU we are compiling on.
+
+This passes a small C code snippet to clang and parses the output in a
+way that could easily break with any future LLVM version.
+"""
+output = cmdexec(
+'echo "void test() {{}}" | clang -x c - -emit-llvm -S -o -'
+.format(devnull))
+for line in output.splitlines(True):
+if line.startswith('target '):
+yield line
+if line.startswith('attributes'):
+assert line.startswith('attributes #0 = { ')
+assert line.endswith(' }\n')
+attributes_str = line[len('attributes #0 = { '):-len(' }\n')]
+for attribute in attributes_str.split():
+if attribute.startswith('"target-cpu"='):
+target_cpu_attribute = attribute
+if attribute.startswith('"target-features"='):
+target_features_attribute = attribute
+database.target_attributes = '{} {}'.format(
+target_cpu_attribute, target_features_attribute)
+
 def _write_special_declarations(self, f):
 compiler_info_str = "LLVM " + cmdexec('llvm-config --version').strip()
 cstr_type = '[{} x i8]'.format(len(compiler_info_str) + 1)
@@ -1877,13 +1904,10 @@
 self.work_dir.mkdir()
 self.main_ll_file = self.work_dir.join('main.ll')
 with self.main_ll_file.open('w') as f:
-output = cmdexec('clang -emit-llvm -S -x c {} -o -'
-.format(devnull))
-for line in output.splitlines(True):
-if line.startswith('target '):
-f.write(line)
+database = Database(self, f)
 
-database = Database(self, f)
+for line in self._get_target_information():
+f.write(line)
 
 from rpython.translator.c.database import LowLevelDatabase
 from rpython.translator.c.genc import gen_threadlocal_structdef
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Redo 88aafcb7c318: hg merge py3k (+ fixes)

2016-01-27 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r81987:4fea3e2ca354
Date: 2016-01-27 21:14 +0100
http://bitbucket.org/pypy/pypy/changeset/4fea3e2ca354/

Log:Redo 88aafcb7c318: hg merge py3k (+ fixes)

That merge (88aafcb7c318) went wrong because someone merged from the
default branch directly into the py3.3 branch instead of merging it
into the py3k branch and then from the py3k branch into the py3.3
branch. This confused mercurial.

The actual command was: hg merge --config
merge.preferancestor=aeafe30eac60 6da866a9e7d5

diff too long, truncating to 2000 out of 102662 lines

diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,14 @@
 .hg
 .svn
 
+# VIM
+*.swp
+*.swo
+
 *.pyc
 *.pyo
 *~
+__pycache__/
 
 bin/pypy-c
 include/*.h
@@ -22,4 +27,6 @@
 pypy/translator/goal/pypy-c
 pypy/translator/goal/target*-c
 release/
+!pypy/tool/release/
 rpython/_cache/
+__pycache__/
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -15,3 +15,5 @@
 e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0
 e03971291f3a0729ecd3ee7fae7ddb0bb82d476c release-2.6.0
 295ee98b69288471b0fcf2e0ede82ce5209eb90b release-2.6.0
+f3ad1e1e1d6215e20d34bb65ab85ff9188c9f559 release-2.6.1
+850edf14b2c75573720f59e95767335fb1affe55 release-4.0.0
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -56,14 +56,15 @@
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
+  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
+  Remi Meier
   Aurelien Campeas
-  Remi Meier
   Niklaus Haldimann
   Camillo Bruni
   Laura Creighton
@@ -87,7 +88,6 @@
   Ludovic Aubry
   Jacob Hallen
   Jason Creighton
-  Richard Plangger
   Alex Martelli
   Michal Bendowski
   stian
@@ -168,7 +168,6 @@
   Michael Twomey
   Lucian Branescu Mihaila
   Yichao Yu
-  Anton Gulenko
   Gabriel Lavoie
   Olivier Dormond
   Jared Grubb
@@ -201,9 +200,12 @@
   Alex Perry
   Vincent Legoll
   Alan McIntyre
+  Spenser Bauman
   Alexander Sedov
   Attila Gobi
   Christopher Pope
+  Devin Jeanpierre
+  Vaibhav Sood
   Christian Tismer 
   Marc Abramowitz
   Dan Stromberg
@@ -215,6 +217,7 @@
   Carl Meyer
   Karl Ramm
   Pieter Zieschang
+  Anton Gulenko
   Gabriel
   Lukas Vacek
   Andrew Dalke
@@ -234,6 +237,7 @@
   Lutz Paelike
   Lucio Torre
   Lars Wassermann
+  Philipp Rustemeuer
   Henrik Vendelbo
   Dan Buch
   Miguel de Val Borro
@@ -244,14 +248,17 @@
   Martin Blais
   Lene Wagner
   Tomo Cocoa
+  Kim Jin Su
   Toni Mattis
   Lucas Stadler
   Julian Berman
+  Markus Holtermann
   roberto@goyle
   Yury V. Zaytsev
   Anna Katrina Dominguez
   William Leslie
   Bobby Impollonia
+  Faye Zhao
   t...@eistee.fritz.box
   Andrew Thompson
   Yusei Tahara
@@ -282,6 +289,7 @@
   shoma hosaka
   Daniel Neuhäuser
   Ben Mather
+  Niclas Olofsson
   halgari
   Boglarka Vezer
   Chris Pressey
@@ -308,13 +316,16 @@
   Stefan Marr
   jiaaro
   Mads Kiilerich
+  Richard Lancaster
   opassembler.py
   Antony Lee
+  Yaroslav Fedevych
   Jim Hunziker
   Markus Unterwaditzer
   Even Wiik Thomassen
   jbs
   squeaky
+  Zearin
   soareschen
   Kurt Griffiths
   Mike Bayer
@@ -326,6 +337,7 @@
   Anna Ravencroft
   Andrey Churin
   Dan Crosta
+  Tobias Diaz
   Julien Phalip
   Roman Podoliaka
   Dan Loewenherz
@@ -352,8 +364,7 @@
 Except when otherwise stated (look for LICENSE files or copyright/license
 information at the beginning of each file) the files in the 'lib-python/2.7'
 directory are all copyrighted by the Python Software Foundation and licensed
-under the Python Software License of which you can find a copy here:
-http://www.python.org/doc/Copyright.html 
+under the terms that you can find here: https://docs.python.org/2/license.html
 
 License for 'pypy/module/unicodedata/'
 ==
@@ -430,12 +441,12 @@
 _gdbm module, provided in the file lib_pypy/_gdbm.py, is redistributed
 under the terms of the GPL license as well.
 
-License for 'pypy/module/_vmprof/src'
+License for 'rpython/rlib/rvmprof/src'
 --
 
 The code is based on gperftools. You may see a copy of the License for it at
 
-https://code.google.com/p/gperftools/source/browse/COPYING
+https://github.com/gperftools/gperftools/blob/master/COPYING
 
 License for 'liblzma and 'lzmaffi'
 --
diff --git a/dotviewer/graphclient.py b/dotviewer/graphclient.py
--- a/dotviewer/graphclient.py
+++ b/dotviewer/graphclient.py
@@ -127,16 +127,8 @@
 return spawn_graphserver_handler((host, port))
 
 def spawn_local_handler():
-if hasattr(sys, 'pypy_objspaceclass'):
-# if 'python' is actually PyPy, e.g. in a virtualenv, then
-# try hard to find a real CPython
-try:
-python = subprocess.check_output(
-'env -i $SHELL -l -c "which python"', shell=True).strip()
-except subprocess.Call

[pypy-commit] pypy py3.3: hg merge 03591a1499c8

2016-01-27 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r81986:edefd168b2b3
Date: 2016-01-27 19:52 +0100
http://bitbucket.org/pypy/pypy/changeset/edefd168b2b3/

Log:hg merge 03591a1499c8

This merges marky1991's changes before he merged the problematic
merge 88aafcb7c318.

diff --git a/lib-python/3/code.py b/lib-python/3/code.py
--- a/lib-python/3/code.py
+++ b/lib-python/3/code.py
@@ -105,10 +105,9 @@
 The output is written by self.write(), below.
 
 """
-type, value, tb = sys.exc_info()
+type, value, sys.last_traceback = sys.exc_info()
 sys.last_type = type
 sys.last_value = value
-sys.last_traceback = tb
 if filename and type is SyntaxError:
 # Work hard to stuff the correct filename in the exception
 try:
@@ -126,7 +125,7 @@
 else:
 # If someone has set sys.excepthook, we let that take precedence
 # over self.write
-sys.excepthook(type, value, tb)
+sys.excepthook(type, value, self.last_traceback)
 
 def showtraceback(self):
 """Display the exception that just occurred.
@@ -136,25 +135,35 @@
 The output is written by self.write(), below.
 
 """
+sys.last_type, sys.last_value, last_tb = ei = sys.exc_info()
+sys.last_traceback = last_tb
 try:
-type, value, tb = sys.exc_info()
-sys.last_type = type
-sys.last_value = value
-sys.last_traceback = tb
-tblist = traceback.extract_tb(tb)
-del tblist[:1]
-lines = traceback.format_list(tblist)
-if lines:
-lines.insert(0, "Traceback (most recent call last):\n")
-lines.extend(traceback.format_exception_only(type, value))
+lines = []
+for value, tb in traceback._iter_chain(*ei[1:]):
+if isinstance(value, str):
+lines.append(value)
+lines.append('\n')
+continue
+if tb:
+tblist = traceback.extract_tb(tb)
+if tb is last_tb:
+# The last traceback includes the frame we
+# exec'd in
+del tblist[:1]
+tblines = traceback.format_list(tblist)
+if tblines:
+lines.append("Traceback (most recent call last):\n")
+lines.extend(tblines)
+lines.extend(traceback.format_exception_only(type(value),
+ value))
 finally:
-tblist = tb = None
+tblist = last_tb = ei = None
 if sys.excepthook is sys.__excepthook__:
 self.write(''.join(lines))
 else:
 # If someone has set sys.excepthook, we let that take precedence
 # over self.write
-sys.excepthook(type, value, tb)
+sys.excepthook(sys.last_type, sys.last_value, last_tb)
 
 def write(self, data):
 """Write a string.
diff --git a/lib-python/3/pickle.py b/lib-python/3/pickle.py
--- a/lib-python/3/pickle.py
+++ b/lib-python/3/pickle.py
@@ -23,7 +23,7 @@
 
 """
 
-from types import FunctionType, BuiltinFunctionType
+from types import FunctionType, BuiltinFunctionType, ModuleType
 from copyreg import dispatch_table
 from copyreg import _extension_registry, _inverted_registry, _extension_cache
 import marshal
@@ -622,6 +622,9 @@
 # else tmp is empty, and we're done
 
 def save_dict(self, obj):
+modict_saver = self._pickle_maybe_moduledict(obj)
+if modict_saver is not None:
+return self.save_reduce(*modict_saver)
 write = self.write
 
 if self.bin:
@@ -672,6 +675,44 @@
 write(SETITEM)
 # else tmp is empty, and we're done
 
+def _pickle_maybe_moduledict(self, obj):
+# save module dictionary as "getattr(module, '__dict__')"
+try:
+name = obj['__name__']
+if type(name) is not str:
+return None
+themodule = sys.modules[name]
+if type(themodule) is not ModuleType:
+return None
+if themodule.__dict__ is not obj:
+return None
+except (AttributeError, KeyError, TypeError):
+return None
+return getattr, (themodule, '__dict__')
+
+def save_function(self, obj):
+try:
+return self.save_global(obj)
+except PicklingError:
+pass
+# Check copy_reg.dispatch_table
+reduce = dispatch_table.get(type(obj))
+if reduce:
+rv = reduce(obj)
+else:
+# Check for a __reduce_ex__ method, fall back to __reduce__
+reduce = getattr(obj, "__reduce_ex__", None)
+if reduce:
+rv = redu

[pypy-commit] pypy py3k: Fix import for renamed module rposix -> rposix_stat.

2016-01-28 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82001:ae38513dafd2
Date: 2016-01-28 23:32 +0100
http://bitbucket.org/pypy/pypy/changeset/ae38513dafd2/

Log:Fix import for renamed module rposix -> rposix_stat.

diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -15,7 +15,7 @@
 from rpython.rlib.streamio import StreamErrors
 from rpython.rlib.objectmodel import we_are_translated, specialize
 from rpython.rlib.signature import signature
-from rpython.rlib import rposix, types
+from rpython.rlib import rposix_stat, types
 from pypy.module.sys.version import PYPY_VERSION
 
 _WIN32 = sys.platform == 'win32'
@@ -465,7 +465,7 @@
 
 # Directory should not exist
 try:
-st = rposix.stat(_WIN32Path(path) if win32 else path)
+st = rposix_stat.stat(_WIN32Path(path) if win32 else path)
 except OSError:
 pass
 else:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: hg merge default

2016-02-01 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82029:fd7884dc77a3
Date: 2016-02-01 12:50 +0100
http://bitbucket.org/pypy/pypy/changeset/fd7884dc77a3/

Log:hg merge default

diff too long, truncating to 2000 out of 16652 lines

diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -29,4 +29,4 @@
 release/
 !pypy/tool/release/
 rpython/_cache/
-__pycache__/
+.cache/
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -75,6 +75,7 @@
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
+^lib_pypy/_libmpdec/.+.o$
 ^rpython/translator/cli/query-descriptions$
 ^pypy/doc/discussion/.+\.html$
 ^include/.+\.h$
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -28,7 +28,7 @@
 DEALINGS IN THE SOFTWARE.
 
 
-PyPy Copyright holders 2003-2015
+PyPy Copyright holders 2003-2016
 --- 
 
 Except when otherwise stated (look for LICENSE files or information at
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -39,5 +39,5 @@
 # runs.  We cannot get their original value either:
 # http://lists.gnu.org/archive/html/help-make/2010-08/msg00106.html
 
-cffi_imports:
+cffi_imports: pypy-c
PYTHONPATH=. ./pypy-c pypy/tool/build_cffi_imports.py
diff --git a/lib-python/2.7/distutils/command/build_ext.py 
b/lib-python/2.7/distutils/command/build_ext.py
--- a/lib-python/2.7/distutils/command/build_ext.py
+++ b/lib-python/2.7/distutils/command/build_ext.py
@@ -685,13 +685,17 @@
 # the previous version of this code did.  This should work for
 # CPython too.  The point is that on PyPy with cpyext, the
 # config var 'SO' is just ".so" but we want to return
-# ".pypy-VERSION.so" instead.
-so_ext = _get_c_extension_suffix()
+# ".pypy-VERSION.so" instead.  Note a further tweak for cffi's
+# embedding mode: if EXT_SUFFIX is also defined, use that
+# directly.
+so_ext = get_config_var('EXT_SUFFIX')
 if so_ext is None:
-so_ext = get_config_var('SO') # fall-back
-# extensions in debug_mode are named 'module_d.pyd' under windows
-if os.name == 'nt' and self.debug:
-so_ext = '_d.pyd'
+so_ext = _get_c_extension_suffix()
+if so_ext is None:
+so_ext = get_config_var('SO') # fall-back
+# extensions in debug_mode are named 'module_d.pyd' under windows
+if os.name == 'nt' and self.debug:
+so_ext = '_d.pyd'
 return os.path.join(*ext_path) + so_ext
 
 def get_export_symbols (self, ext):
diff --git a/lib-python/2.7/pickle.py b/lib-python/2.7/pickle.py
--- a/lib-python/2.7/pickle.py
+++ b/lib-python/2.7/pickle.py
@@ -1376,6 +1376,7 @@
 
 def decode_long(data):
 r"""Decode a long from a two's complement little-endian binary string.
+This is overriden on PyPy by a RPython version that has linear complexity.
 
 >>> decode_long('')
 0L
@@ -1402,6 +1403,11 @@
 n -= 1L << (nbytes * 8)
 return n
 
+try:
+from __pypy__ import decode_long
+except ImportError:
+pass
+
 # Shorthands
 
 try:
diff --git a/lib-python/2.7/sysconfig.py b/lib-python/2.7/sysconfig.py
--- a/lib-python/2.7/sysconfig.py
+++ b/lib-python/2.7/sysconfig.py
@@ -524,6 +524,13 @@
 import _osx_support
 _osx_support.customize_config_vars(_CONFIG_VARS)
 
+# PyPy:
+import imp
+for suffix, mode, type_ in imp.get_suffixes():
+if type_ == imp.C_EXTENSION:
+_CONFIG_VARS['SOABI'] = suffix.split('.')[1]
+break
+
 if args:
 vals = []
 for name in args:
diff --git a/lib-python/2.7/test/capath/0e4015b9.0 
b/lib-python/2.7/test/capath/0e4015b9.0
new file mode 100644
--- /dev/null
+++ b/lib-python/2.7/test/capath/0e4015b9.0
@@ -0,0 +1,16 @@
+-BEGIN CERTIFICATE-
+MIIClTCCAf6gAwIBAgIJAKGU95wKR8pTMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
+bnRlc3QubmV0MB4XDTE0MTEwMjE4MDkyOVoXDTI0MTAzMDE4MDkyOVowcDELMAkG
+A1UEBhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYDVQQKDBpQeXRo
+b24gU29mdHdhcmUgRm91bmRhdGlvbjEjMCEGA1UEAwwac2VsZi1zaWduZWQucHl0
+aG9udGVzdC5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANDXQXW9tjyZ
+Xt0Iv2tLL1+jinr4wGg36ioLDLFkMf+2Y1GL0v0BnKYG4N1OKlAU15LXGeGer8vm
+Sv/yIvmdrELvhAbbo3w4a9TMYQA4XkIVLdvu3mvNOAet+8PMJxn26dbDhG809ALv
+EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjNzA1MCUGA1UdEQQeMByCGnNl
+bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN
+AQEFBQADgYEAIuzAhgMouJpNdf3URCHIineyoSt6WK/9+eyUcjlKOrDoXNZaD72h
+TXMeKYoWvJyVcSLKL8ckPtDobgP2OTt0UkyAaj0n+ZHaqq1lH2yVfGUA1ILJv515
+C8BqbvVZuqm3i7ygmw3bqE/lYMgOrYtXXnqOrz6nvsE6Yc9V9rFflOM=
+-END CERTIFICATE-
diff --git a/lib-python/2.7/test/capath/ce7b8643.0 
b/lib-python/2.7/test/capath/ce7b8643.0
new

[pypy-commit] pypy py3k: 2to3

2016-02-01 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82027:91eaf91dbb4c
Date: 2016-02-01 11:45 +0100
http://bitbucket.org/pypy/pypy/changeset/91eaf91dbb4c/

Log:2to3

diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py
--- a/lib_pypy/greenlet.py
+++ b/lib_pypy/greenlet.py
@@ -203,7 +203,7 @@
 try:
 if hasattr(_tls, 'trace'):
 _run_trace_callback('throw')
-raise exc, value, tb
+raise __pypy__.normalize_exc(exc, value, tb)
 except GreenletExit as e:
 res = e
 finally:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add lib_pypy/_libmpdec/ to default's .hgignore as well.

2016-02-01 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82028:22349fa2fc33
Date: 2016-02-01 11:51 +0100
http://bitbucket.org/pypy/pypy/changeset/22349fa2fc33/

Log:Add lib_pypy/_libmpdec/ to default's .hgignore as well.

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -75,6 +75,7 @@
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
+^lib_pypy/_libmpdec/.+.o$
 ^rpython/translator/cli/query-descriptions$
 ^pypy/doc/discussion/.+\.html$
 ^include/.+\.h$
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: 2to3

2016-02-02 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82047:fbb1c9fd86c0
Date: 2016-02-02 19:17 +0100
http://bitbucket.org/pypy/pypy/changeset/fbb1c9fd86c0/

Log:2to3

diff --git a/pypy/module/itertools/test/test_itertools.py 
b/pypy/module/itertools/test/test_itertools.py
--- a/pypy/module/itertools/test/test_itertools.py
+++ b/pypy/module/itertools/test/test_itertools.py
@@ -201,8 +201,8 @@
 # CPython implementation allows floats
 it = itertools.islice([1, 2, 3, 4, 5], 0.0, 3.0, 2.0)
 for x in [1, 3]:
-assert it.next() == x
-raises(StopIteration, it.next)
+assert next(it) == x
+raises(StopIteration, next, it)
 
 it = itertools.islice([1, 2, 3], 0, None)
 for x in [1, 2, 3]:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: 2to3

2016-02-02 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82045:60029cb06b5b
Date: 2016-02-02 19:09 +0100
http://bitbucket.org/pypy/pypy/changeset/60029cb06b5b/

Log:2to3

diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py 
b/pypy/module/_cffi_backend/test/test_recompiler.py
--- a/pypy/module/_cffi_backend/test/test_recompiler.py
+++ b/pypy/module/_cffi_backend/test/test_recompiler.py
@@ -1046,7 +1046,7 @@
 #
 @ffi.callback("int *(*)(void)")
 def get_my_value():
-return values + it.next()
+return values + next(it)
 lib.get_my_value = get_my_value
 #
 values[0] = 41
@@ -1390,7 +1390,7 @@
 def getvalue(self):
 if self._result is None:
 os.close(self._wr)
-self._result = os.read(self._rd, 4096)
+self._result = os.read(self._rd, 4096).decode()
 os.close(self._rd)
 # xxx hack away these lines
 while self._result.startswith('[platform:execute]'):
@@ -1456,11 +1456,11 @@
 baz1 = ffi.def_extern()(baz)
 assert baz1 is baz
 seen = []
-baz(40L, 4L)
-res = lib.baz(50L, 8L)
+baz(40, 4)
+res = lib.baz(50, 8)
 assert res is None
-assert seen == [("Baz", 40L, 4L), ("Baz", 50, 8)]
-assert type(seen[0][1]) is type(seen[0][2]) is long
+assert seen == [("Baz", 40, 4), ("Baz", 50, 8)]
+assert type(seen[0][1]) is type(seen[0][2]) is int
 assert type(seen[1][1]) is type(seen[1][2]) is int
 
 @ffi.def_extern(name="bok")
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: 2to3

2016-02-02 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82044:8645b9cf5eab
Date: 2016-02-02 18:30 +0100
http://bitbucket.org/pypy/pypy/changeset/8645b9cf5eab/

Log:2to3

diff --git a/pypy/module/__pypy__/test/test_magic.py 
b/pypy/module/__pypy__/test/test_magic.py
--- a/pypy/module/__pypy__/test/test_magic.py
+++ b/pypy/module/__pypy__/test/test_magic.py
@@ -24,26 +24,26 @@
 __pypy__.set_code_callback(callable)
 d = {}
 try:
-exec """
+exec("""
 def f():
 pass
-""" in d
+""", d)
 finally:
 __pypy__.set_code_callback(None)
 assert d['f'].__code__ in l
 
 def test_decode_long(self):
 from __pypy__ import decode_long
-assert decode_long('') == 0
-assert decode_long('\xff\x00') == 255
-assert decode_long('\xff\x7f') == 32767
-assert decode_long('\x00\xff') == -256
-assert decode_long('\x00\x80') == -32768
-assert decode_long('\x80') == -128
-assert decode_long('\x7f') == 127
-assert decode_long('\x55' * 97) == (1 << (97 * 8)) // 3
-assert decode_long('\x00\x80', 'big') == 128
-assert decode_long('\xff\x7f', 'little', False) == 32767
-assert decode_long('\x00\x80', 'little', False) == 32768
-assert decode_long('\x00\x80', 'little', True) == -32768
+assert decode_long(b'') == 0
+assert decode_long(b'\xff\x00') == 255
+assert decode_long(b'\xff\x7f') == 32767
+assert decode_long(b'\x00\xff') == -256
+assert decode_long(b'\x00\x80') == -32768
+assert decode_long(b'\x80') == -128
+assert decode_long(b'\x7f') == 127
+assert decode_long(b'\x55' * 97) == (1 << (97 * 8)) // 3
+assert decode_long(b'\x00\x80', 'big') == 128
+assert decode_long(b'\xff\x7f', 'little', False) == 32767
+assert decode_long(b'\x00\x80', 'little', False) == 32768
+assert decode_long(b'\x00\x80', 'little', True) == -32768
 raises(ValueError, decode_long, '', 'foo')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: 2to3

2016-02-02 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82046:77bfed7253ce
Date: 2016-02-02 19:14 +0100
http://bitbucket.org/pypy/pypy/changeset/77bfed7253ce/

Log:2to3

diff --git a/pypy/module/_socket/test/test_sock_app.py 
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -651,7 +651,7 @@
 def test_connect_to_kernel_netlink_routing_socket(self):
 import _socket, os
 s = _socket.socket(_socket.AF_NETLINK, _socket.SOCK_DGRAM, 
_socket.NETLINK_ROUTE)
-assert s.getsockname() == (0L, 0L)
+assert s.getsockname() == (0, 0)
 s.bind((0, 0))
 a, b = s.getsockname()
 assert a == os.getpid()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: hg merge py3k

2016-02-02 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82048:1d68aca1032f
Date: 2016-02-02 19:50 +0100
http://bitbucket.org/pypy/pypy/changeset/1d68aca1032f/

Log:hg merge py3k

diff too long, truncating to 2000 out of 16702 lines

diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -29,4 +29,4 @@
 release/
 !pypy/tool/release/
 rpython/_cache/
-__pycache__/
+.cache/
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -28,7 +28,7 @@
 DEALINGS IN THE SOFTWARE.
 
 
-PyPy Copyright holders 2003-2015
+PyPy Copyright holders 2003-2016
 --- 
 
 Except when otherwise stated (look for LICENSE files or information at
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -39,5 +39,5 @@
 # runs.  We cannot get their original value either:
 # http://lists.gnu.org/archive/html/help-make/2010-08/msg00106.html
 
-cffi_imports:
+cffi_imports: pypy-c
PYTHONPATH=. ./pypy-c pypy/tool/build_cffi_imports.py
diff --git a/lib-python/2.7/distutils/command/build_ext.py 
b/lib-python/2.7/distutils/command/build_ext.py
--- a/lib-python/2.7/distutils/command/build_ext.py
+++ b/lib-python/2.7/distutils/command/build_ext.py
@@ -685,13 +685,17 @@
 # the previous version of this code did.  This should work for
 # CPython too.  The point is that on PyPy with cpyext, the
 # config var 'SO' is just ".so" but we want to return
-# ".pypy-VERSION.so" instead.
-so_ext = _get_c_extension_suffix()
+# ".pypy-VERSION.so" instead.  Note a further tweak for cffi's
+# embedding mode: if EXT_SUFFIX is also defined, use that
+# directly.
+so_ext = get_config_var('EXT_SUFFIX')
 if so_ext is None:
-so_ext = get_config_var('SO') # fall-back
-# extensions in debug_mode are named 'module_d.pyd' under windows
-if os.name == 'nt' and self.debug:
-so_ext = '_d.pyd'
+so_ext = _get_c_extension_suffix()
+if so_ext is None:
+so_ext = get_config_var('SO') # fall-back
+# extensions in debug_mode are named 'module_d.pyd' under windows
+if os.name == 'nt' and self.debug:
+so_ext = '_d.pyd'
 return os.path.join(*ext_path) + so_ext
 
 def get_export_symbols (self, ext):
diff --git a/lib-python/2.7/pickle.py b/lib-python/2.7/pickle.py
--- a/lib-python/2.7/pickle.py
+++ b/lib-python/2.7/pickle.py
@@ -1376,6 +1376,7 @@
 
 def decode_long(data):
 r"""Decode a long from a two's complement little-endian binary string.
+This is overriden on PyPy by a RPython version that has linear complexity.
 
 >>> decode_long('')
 0L
@@ -1402,6 +1403,11 @@
 n -= 1L << (nbytes * 8)
 return n
 
+try:
+from __pypy__ import decode_long
+except ImportError:
+pass
+
 # Shorthands
 
 try:
diff --git a/lib-python/2.7/sysconfig.py b/lib-python/2.7/sysconfig.py
--- a/lib-python/2.7/sysconfig.py
+++ b/lib-python/2.7/sysconfig.py
@@ -524,6 +524,13 @@
 import _osx_support
 _osx_support.customize_config_vars(_CONFIG_VARS)
 
+# PyPy:
+import imp
+for suffix, mode, type_ in imp.get_suffixes():
+if type_ == imp.C_EXTENSION:
+_CONFIG_VARS['SOABI'] = suffix.split('.')[1]
+break
+
 if args:
 vals = []
 for name in args:
diff --git a/lib-python/2.7/test/capath/0e4015b9.0 
b/lib-python/2.7/test/capath/0e4015b9.0
new file mode 100644
--- /dev/null
+++ b/lib-python/2.7/test/capath/0e4015b9.0
@@ -0,0 +1,16 @@
+-BEGIN CERTIFICATE-
+MIIClTCCAf6gAwIBAgIJAKGU95wKR8pTMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
+bnRlc3QubmV0MB4XDTE0MTEwMjE4MDkyOVoXDTI0MTAzMDE4MDkyOVowcDELMAkG
+A1UEBhMCWFkxFzAVBgNVBAcMDkNhc3RsZSBBbnRocmF4MSMwIQYDVQQKDBpQeXRo
+b24gU29mdHdhcmUgRm91bmRhdGlvbjEjMCEGA1UEAwwac2VsZi1zaWduZWQucHl0
+aG9udGVzdC5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANDXQXW9tjyZ
+Xt0Iv2tLL1+jinr4wGg36ioLDLFkMf+2Y1GL0v0BnKYG4N1OKlAU15LXGeGer8vm
+Sv/yIvmdrELvhAbbo3w4a9TMYQA4XkIVLdvu3mvNOAet+8PMJxn26dbDhG809ALv
+EHY57lQsBS3G59RZyBPVqAqmImWNJnVzAgMBAAGjNzA1MCUGA1UdEQQeMByCGnNl
+bGYtc2lnbmVkLnB5dGhvbnRlc3QubmV0MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN
+AQEFBQADgYEAIuzAhgMouJpNdf3URCHIineyoSt6WK/9+eyUcjlKOrDoXNZaD72h
+TXMeKYoWvJyVcSLKL8ckPtDobgP2OTt0UkyAaj0n+ZHaqq1lH2yVfGUA1ILJv515
+C8BqbvVZuqm3i7ygmw3bqE/lYMgOrYtXXnqOrz6nvsE6Yc9V9rFflOM=
+-END CERTIFICATE-
diff --git a/lib-python/2.7/test/capath/ce7b8643.0 
b/lib-python/2.7/test/capath/ce7b8643.0
new file mode 100644
--- /dev/null
+++ b/lib-python/2.7/test/capath/ce7b8643.0
@@ -0,0 +1,16 @@
+-BEGIN CERTIFICATE-
+MIIClTCCAf6gAwIBAgIJAKGU95wKR8pTMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
+BAYTAlhZMRcwFQYDVQQHDA5DYXN0bGUgQW50aHJheDEjMCEGA1UECgwaUHl0aG9u
+IFNvZnR3YXJlIEZvdW5kYXRpb24xIzAhBgNVBAMMGnNlbGYtc2lnbmVkLnB5dGhv
+b

[pypy-commit] pypy default: Skip vmprof jit tests on non-x86-64 CPUs.

2016-02-05 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82089:e2685b2b1e87
Date: 2016-02-05 17:06 +0100
http://bitbucket.org/pypy/pypy/changeset/e2685b2b1e87/

Log:Skip vmprof jit tests on non-x86-64 CPUs.

diff --git a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py 
b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
--- a/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
+++ b/rpython/jit/backend/llsupport/test/zrpy_vmprof_test.py
@@ -9,6 +9,10 @@
 class CompiledVmprofTest(CCompiledMixin):
 CPUClass = getcpuclass()
 
+def setup(self):
+if self.CPUClass.backend_name != 'x86_64':
+py.test.skip("vmprof only supports x86-64 CPUs at the moment")
+
 def _get_TranslationContext(self):
 t = TranslationContext()
 t.config.translation.gc = 'incminimark'
@@ -83,4 +87,4 @@
 except ImportError:
 pass
 else:
-check_vmprof_output()
\ No newline at end of file
+check_vmprof_output()
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] extradoc extradoc: Change my departure day from 28th to 27th.

2016-02-07 Thread mjacob
Author: Manuel Jacob 
Branch: extradoc
Changeset: r5603:600e94781178
Date: 2016-02-07 13:56 +0100
http://bitbucket.org/pypy/extradoc/changeset/600e94781178/

Log:Change my departure day from 28th to 27th.

diff --git a/sprintinfo/leysin-winter-2016/people.txt 
b/sprintinfo/leysin-winter-2016/people.txt
--- a/sprintinfo/leysin-winter-2016/people.txt
+++ b/sprintinfo/leysin-winter-2016/people.txt
@@ -14,7 +14,7 @@
 Remi Meier   21-27  Ermina
 Carl Friedrich Bolz  20-27  Ermina?
 Matti Picus  20-25  Ermina
-Manuel Jacob 20-28  Ermina
+Manuel Jacob 20-27  Ermina
 Richard Plangger 20-28  Ermina
 Maciej Fijalkowski   20-?   Ermina (big room preferred)
 Ronan Lamy   20-27  Ermina?
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Remove tests which call importing.load_source_module(). This function was removed.

2016-02-10 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82143:7ce8c80e23e7
Date: 2016-02-10 14:18 +0100
http://bitbucket.org/pypy/pypy/changeset/7ce8c80e23e7/

Log:Remove tests which call importing.load_source_module(). This
function was removed.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -915,106 +915,6 @@
 finally:
 stream.close()
 
-def test_load_source_module(self):
-space = self.space
-w_modulename = space.wrap('somemodule')
-w_mod = space.wrap(Module(space, w_modulename))
-pathname = _testfilesource()
-stream = streamio.open_file_as_stream(pathname, "r")
-try:
-w_ret = importing.load_source_module(
-space, w_modulename, w_mod,
-pathname, stream.readall(),
-stream.try_to_find_file_descriptor())
-finally:
-stream.close()
-assert w_mod is w_ret
-w_ret = space.getattr(w_mod, space.wrap('x'))
-ret = space.int_w(w_ret)
-assert ret == 42
-
-cpathname = udir.join('test.pyc')
-assert cpathname.check()
-cpathname.remove()
-
-def test_load_source_module_nowrite(self):
-space = self.space
-w_modulename = space.wrap('somemodule')
-w_mod = space.wrap(Module(space, w_modulename))
-pathname = _testfilesource()
-stream = streamio.open_file_as_stream(pathname, "r")
-try:
-w_ret = importing.load_source_module(
-space, w_modulename, w_mod,
-pathname, stream.readall(),
-stream.try_to_find_file_descriptor(),
-write_pyc=False)
-finally:
-stream.close()
-cpathname = udir.join('test.pyc')
-assert not cpathname.check()
-
-def test_load_source_module_dont_write_bytecode(self):
-space = self.space
-w_modulename = space.wrap('somemodule')
-w_mod = space.wrap(Module(space, w_modulename))
-pathname = _testfilesource()
-stream = streamio.open_file_as_stream(pathname, "r")
-try:
-space.setattr(space.sys, space.wrap('dont_write_bytecode'),
-  space.w_True)
-w_ret = importing.load_source_module(
-space, w_modulename, w_mod,
-pathname, stream.readall(),
-stream.try_to_find_file_descriptor())
-finally:
-space.setattr(space.sys, space.wrap('dont_write_bytecode'),
-  space.w_False)
-stream.close()
-cpathname = udir.join('test.pyc')
-assert not cpathname.check()
-
-def test_load_source_module_syntaxerror(self):
-# No .pyc file on SyntaxError
-space = self.space
-w_modulename = space.wrap('somemodule')
-w_mod = space.wrap(Module(space, w_modulename))
-pathname = _testfilesource(source="")
-stream = streamio.open_file_as_stream(pathname, "r")
-try:
-w_ret = importing.load_source_module(
-space, w_modulename, w_mod,
-pathname, stream.readall(),
-stream.try_to_find_file_descriptor())
-except OperationError:
-# OperationError("Syntax Error")
-pass
-stream.close()
-
-cpathname = udir.join('test.pyc')
-assert not cpathname.check()
-
-def test_load_source_module_importerror(self):
-# the .pyc file is created before executing the module
-space = self.space
-w_modulename = space.wrap('somemodule')
-w_mod = space.wrap(Module(space, w_modulename))
-pathname = _testfilesource(source="a = unknown_name")
-stream = streamio.open_file_as_stream(pathname, "r")
-try:
-w_ret = importing.load_source_module(
-space, w_modulename, w_mod,
-pathname, stream.readall(),
-stream.try_to_find_file_descriptor())
-except OperationError:
-# OperationError("NameError", "global name 'unknown_name' is not 
defined")
-pass
-stream.close()
-
-# And the .pyc has been generated
-cpathname = udir.join(importing.make_compiled_pathname('test.py'))
-assert cpathname.check()
-
 def test_pyc_magic_changes(self):
 py.test.skip("For now, PyPy generates only one kind of .pyc files")
 # test that the pyc files produced by a space are not reimportable
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Remove test which calls imp._run_compiled_module(). This function was removed.

2016-02-10 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82144:7cd3ceac33eb
Date: 2016-02-10 14:28 +0100
http://bitbucket.org/pypy/pypy/changeset/7cd3ceac33eb/

Log:Remove test which calls imp._run_compiled_module(). This function
was removed.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1208,20 +1208,6 @@
 sys.meta_path.pop()
 
 
-class AppTestPyPyExtension(object):
-spaceconfig = dict(usemodules=['imp', 'zipimport', '__pypy__'])
-
-def setup_class(cls):
-cls.w_udir = cls.space.wrap(str(udir))
-
-def test_run_compiled_module(self):
-# XXX minimal test only
-import imp, types
-module = types.ModuleType('foobar')
-raises(IOError, imp._run_compiled_module,
-   'foobar', 'this_file_does_not_exist', None, module)
-
-
 class AppTestNoPycFile(object):
 spaceconfig = {
 "objspace.usepycfiles": False,
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Skip this test, which fails on CPython 3.3 as well (but not on later versions).

2016-02-10 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82142:52c94a3c2dc9
Date: 2016-02-10 14:02 +0100
http://bitbucket.org/pypy/pypy/changeset/52c94a3c2dc9/

Log:Skip this test, which fails on CPython 3.3 as well (but not on later
versions).

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -692,6 +692,7 @@
 del sys.modules['itertools']
 
 def test_invalid_pathname(self):
+skip("This test fails on CPython 3.3, but passes on CPython 3.4+")
 import imp
 import pkg
 import os
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Copy _r_long/_w_long helper functions from default's importing.py to this test file. Although these functions are not needed anymore in importing.py, some tests call them.

2016-02-10 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82145:42d83e6431d8
Date: 2016-02-10 14:50 +0100
http://bitbucket.org/pypy/pypy/changeset/42d83e6431d8/

Log:Copy _r_long/_w_long helper functions from default's importing.py to
this test file. Although these functions are not needed anymore in
importing.py, some tests call them.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -17,6 +17,30 @@
 
 from pypy import conftest
 
+
+def _read_n(stream, n):
+buf = ''
+while len(buf) < n:
+data = stream.read(n - len(buf))
+if not data:
+raise streamio.StreamError("end of file")
+buf += data
+return buf
+
+def _r_long(stream):
+s = _read_n(stream, 4)
+return importing._get_long(s)
+
+def _w_long(stream, x):
+a = x & 0xff
+x >>= 8
+b = x & 0xff
+x >>= 8
+c = x & 0xff
+x >>= 8
+d = x & 0xff
+stream.write(chr(a) + chr(b) + chr(c) + chr(d))
+
 def setuppkg(pkgname, **entries):
 p = udir.join('impsubdir')
 if pkgname:
@@ -838,8 +862,8 @@
 stream = streamio.open_file_as_stream(cpathname, "rb")
 try:
 w_mod = space.wrap(Module(space, w_modulename))
-magic = importing._r_long(stream)
-timestamp = importing._r_long(stream)
+magic = _r_long(stream)
+timestamp = _r_long(stream)
 w_ret = importing.load_compiled_module(space,
w_modulename,
w_mod,
@@ -863,8 +887,8 @@
 stream = streamio.open_file_as_stream(cpathname, "rb")
 try:
 w_mod = space.wrap(Module(space, w_modulename))
-magic = importing._r_long(stream)
-timestamp = importing._r_long(stream)
+magic = _r_long(stream)
+timestamp = _r_long(stream)
 w_ret = importing.load_compiled_module(space,
w_modulename,
w_mod,
@@ -899,18 +923,18 @@
 pathname = str(udir.join('test.dat'))
 stream = streamio.open_file_as_stream(pathname, "wb")
 try:
-importing._w_long(stream, 42)
-importing._w_long(stream, 12312)
-importing._w_long(stream, 128397198)
+_w_long(stream, 42)
+_w_long(stream, 12312)
+_w_long(stream, 128397198)
 finally:
 stream.close()
 stream = streamio.open_file_as_stream(pathname, "rb")
 try:
-res = importing._r_long(stream)
+res = _r_long(stream)
 assert res == 42
-res = importing._r_long(stream)
+res = _r_long(stream)
 assert res == 12312
-res = importing._r_long(stream)
+res = _r_long(stream)
 assert res == 128397198
 finally:
 stream.close()
@@ -937,8 +961,8 @@
 stream = streamio.open_file_as_stream(cpathname, "rb")
 try:
 w_mod = space2.wrap(Module(space2, w_modulename))
-magic = importing._r_long(stream)
-timestamp = importing._r_long(stream)
+magic = _r_long(stream)
+timestamp = _r_long(stream)
 space2.raises_w(space2.w_ImportError,
 importing.load_compiled_module,
 space2,
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Fix test_pyc_commandline_argument() by creating the .pyc file with the same python executable app_main.py is run with. Also check for correct output.

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82191:bba9ea8739cc
Date: 2016-02-12 20:36 +0100
http://bitbucket.org/pypy/pypy/changeset/bba9ea8739cc/

Log:Fix test_pyc_commandline_argument() by creating the .pyc file with
the same python executable app_main.py is run with. Also check for
correct output.

diff --git a/pypy/interpreter/test/test_app_main.py 
b/pypy/interpreter/test/test_app_main.py
--- a/pypy/interpreter/test/test_app_main.py
+++ b/pypy/interpreter/test/test_app_main.py
@@ -37,21 +37,11 @@
 def getscript_pyc(space, source):
 p = _get_next_path()
 p.write(str(py.code.Source(source)))
-w_dir = space.wrap(str(p.dirpath()))
-w_modname = space.wrap(p.purebasename)
-space.appexec([w_dir, w_modname], """(dir, modname):
-import sys
-d = sys.modules.copy()
-sys.path.insert(0, dir)
-__import__(modname)
-sys.path.pop(0)
-for key in list(sys.modules.keys()):
-if key not in d:
-del sys.modules[key]
-""")
+subprocess.check_call([python3, "-c", "import " + p.purebasename],
+  env={'PYTHONPATH': str(p.dirpath())})
 # the .pyc file should have been created above
 pycache = p.dirpath('__pycache__')
-pycs = pycache.listdir(p.basename + '*.pyc')
+pycs = pycache.listdir(p.purebasename + '*.pyc')
 assert len(pycs) == 1
 return str(pycs[0])
 
@@ -926,7 +916,7 @@
 p = getscript_pyc(self.space, "print(6*7)\n")
 assert os.path.isfile(p) and p.endswith('.pyc')
 data = self.run(p)
-assert data == 'in _run_compiled_module\n'
+assert data == '42\n'
 
 def test_main_in_dir_commandline_argument(self):
 if not hasattr(runpy, '_run_module_as_main'):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Explicitly pass name to SourcelessFileLoader.load_module(). This is seemingly sometimes needed when running on top of CPython.

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82190:4939f7202eaf
Date: 2016-02-12 18:52 +0100
http://bitbucket.org/pypy/pypy/changeset/4939f7202eaf/

Log:Explicitly pass name to SourcelessFileLoader.load_module(). This is
seemingly sometimes needed when running on top of CPython.

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -676,7 +676,7 @@
 filename = filename.lower()
 if filename.endswith('.pyc') or filename.endswith('.pyo'):
 loader = SourcelessFileLoader('__main__', filename)
-args = (loader.load_module,)
+args = (loader.load_module, loader.name)
 else:
 filename = sys.argv[0]
 for hook in sys.path_hooks:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Improve (but not fix) app_main.py's Python 3.5 compatibility for testing on top of CPython and forward-compatibility.

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82189:249ebc5d87a0
Date: 2016-02-12 18:06 +0100
http://bitbucket.org/pypy/pypy/changeset/249ebc5d87a0/

Log:Improve (but not fix) app_main.py's Python 3.5 compatibility for
testing on top of CPython and forward-compatibility.

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -668,11 +668,14 @@
 # assume it's a pyc file only if its name says so.
 # CPython goes to great lengths to detect other cases
 # of pyc file format, but I think it's ok not to care.
-import _frozen_importlib
+try:
+from _frozen_importlib import SourcelessFileLoader
+except ImportError:
+from _frozen_importlib_external import SourcelessFileLoader
 if IS_WINDOWS:
 filename = filename.lower()
 if filename.endswith('.pyc') or filename.endswith('.pyo'):
-loader = _frozen_importlib.SourcelessFileLoader('__main__', 
filename)
+loader = SourcelessFileLoader('__main__', filename)
 args = (loader.load_module,)
 else:
 filename = sys.argv[0]
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Fix.

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82192:7fc36d3705b5
Date: 2016-02-12 22:09 +0100
http://bitbucket.org/pypy/pypy/changeset/7fc36d3705b5/

Log:Fix.

diff --git a/pypy/interpreter/test/test_pycode.py 
b/pypy/interpreter/test/test_pycode.py
--- a/pypy/interpreter/test/test_pycode.py
+++ b/pypy/interpreter/test/test_pycode.py
@@ -15,5 +15,5 @@
 sys.stdout = stdout
 print '>>>\n' + output + '\n<<<'
 assert ' 1 (7)' in output
-assert ' 3 (None)' in output
-assert ' 16 RETURN_VALUE ' in output
+assert ' 4 (None)' in output
+assert ' 19 RETURN_VALUE ' in output
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy llvm-translation-backend: hg merge default (+ fixes)

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r82194:eaaed1d67e19
Date: 2016-02-12 22:30 +0100
http://bitbucket.org/pypy/pypy/changeset/eaaed1d67e19/

Log:hg merge default (+ fixes)

diff too long, truncating to 2000 out of 12525 lines

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -75,6 +75,7 @@
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
+^lib_pypy/_libmpdec/.+.o$
 ^rpython/translator/cli/query-descriptions$
 ^pypy/doc/discussion/.+\.html$
 ^include/.+\.h$
diff --git a/dotviewer/drawgraph.py b/dotviewer/drawgraph.py
--- a/dotviewer/drawgraph.py
+++ b/dotviewer/drawgraph.py
@@ -14,12 +14,661 @@
 FONT = os.path.join(this_dir, 'font', 'DroidSans.ttf')
 FIXEDFONT = os.path.join(this_dir, 'font', 'DroidSansMono.ttf')
 COLOR = {
-'black': (0,0,0),
-'white': (255,255,255),
-'red': (255,0,0),
-'green': (0,255,0),
-'blue': (0,0,255),
-'yellow': (255,255,0),
+'aliceblue': (240, 248, 255),
+'antiquewhite': (250, 235, 215),
+'antiquewhite1': (255, 239, 219),
+'antiquewhite2': (238, 223, 204),
+'antiquewhite3': (205, 192, 176),
+'antiquewhite4': (139, 131, 120),
+'aquamarine': (127, 255, 212),
+'aquamarine1': (127, 255, 212),
+'aquamarine2': (118, 238, 198),
+'aquamarine3': (102, 205, 170),
+'aquamarine4': (69, 139, 116),
+'azure': (240, 255, 255),
+'azure1': (240, 255, 255),
+'azure2': (224, 238, 238),
+'azure3': (193, 205, 205),
+'azure4': (131, 139, 139),
+'beige': (245, 245, 220),
+'bisque': (255, 228, 196),
+'bisque1': (255, 228, 196),
+'bisque2': (238, 213, 183),
+'bisque3': (205, 183, 158),
+'bisque4': (139, 125, 107),
+'black': (0, 0, 0),
+'blanchedalmond': (255, 235, 205),
+'blue': (0, 0, 255),
+'blue1': (0, 0, 255),
+'blue2': (0, 0, 238),
+'blue3': (0, 0, 205),
+'blue4': (0, 0, 139),
+'blueviolet': (138, 43, 226),
+'brown': (165, 42, 42),
+'brown1': (255, 64, 64),
+'brown2': (238, 59, 59),
+'brown3': (205, 51, 51),
+'brown4': (139, 35, 35),
+'burlywood': (222, 184, 135),
+'burlywood1': (255, 211, 155),
+'burlywood2': (238, 197, 145),
+'burlywood3': (205, 170, 125),
+'burlywood4': (139, 115, 85),
+'cadetblue': (95, 158, 160),
+'cadetblue1': (152, 245, 255),
+'cadetblue2': (142, 229, 238),
+'cadetblue3': (122, 197, 205),
+'cadetblue4': (83, 134, 139),
+'chartreuse': (127, 255, 0),
+'chartreuse1': (127, 255, 0),
+'chartreuse2': (118, 238, 0),
+'chartreuse3': (102, 205, 0),
+'chartreuse4': (69, 139, 0),
+'chocolate': (210, 105, 30),
+'chocolate1': (255, 127, 36),
+'chocolate2': (238, 118, 33),
+'chocolate3': (205, 102, 29),
+'chocolate4': (139, 69, 19),
+'coral': (255, 127, 80),
+'coral1': (255, 114, 86),
+'coral2': (238, 106, 80),
+'coral3': (205, 91, 69),
+'coral4': (139, 62, 47),
+'cornflowerblue': (100, 149, 237),
+'cornsilk': (255, 248, 220),
+'cornsilk1': (255, 248, 220),
+'cornsilk2': (238, 232, 205),
+'cornsilk3': (205, 200, 177),
+'cornsilk4': (139, 136, 120),
+'crimson': (220, 20, 60),
+'cyan': (0, 255, 255),
+'cyan1': (0, 255, 255),
+'cyan2': (0, 238, 238),
+'cyan3': (0, 205, 205),
+'cyan4': (0, 139, 139),
+'darkgoldenrod': (184, 134, 11),
+'darkgoldenrod1': (255, 185, 15),
+'darkgoldenrod2': (238, 173, 14),
+'darkgoldenrod3': (205, 149, 12),
+'darkgoldenrod4': (139, 101, 8),
+'darkgreen': (0, 100, 0),
+'darkkhaki': (189, 183, 107),
+'darkolivegreen': (85, 107, 47),
+'darkolivegreen1': (202, 255, 112),
+'darkolivegreen2': (188, 238, 104),
+'darkolivegreen3': (162, 205, 90),
+'darkolivegreen4': (110, 139, 61),
+'darkorange': (255, 140, 0),
+'darkorange1': (255, 127, 0),
+'darkorange2': (238, 118, 0),
+'darkorange3': (205, 102, 0),
+'darkorange4': (139, 69, 0),
+'darkorchid': (153, 50, 204),
+'darkorchid1': (191, 62, 255),
+'darkorchid2': (178, 58, 238),
+'darkorchid3': (154, 50, 205),
+'darkorchid4': (104, 34, 139),
+'darksalmon': (233, 150, 122),
+'darkseagreen': (143, 188, 143),
+'darkseagreen1': (193, 255, 193),
+'darkseagreen2': (180, 238, 180),
+'darkseagreen3': (155, 205, 155),
+'darkseagreen4': (105, 139, 105),
+'darkslateblue': (72, 61, 139),
+'darkslategray': (47, 79, 79),
+'darkslategray1': (151, 255, 255),
+'darkslategray2': (141, 238, 238),
+'darkslategray3': (121, 205, 205),
+'darkslategray4': (82, 139, 139),
+'darkslategrey': (47, 79, 79),
+'darkturquoise': (0, 206, 209),
+'darkviolet': (148, 0, 211),
+'deeppink': (255, 20, 147),
+'deeppink1': (255, 20, 147),
+'deeppink2': (238, 18, 137),
+'deeppink3': (205, 16, 118),
+'deeppink4': (139, 10, 80),
+'deepskyblue': (0, 191, 255),
+'deepskyblue1':

[pypy-commit] pypy py3k: hg merge default (+ fixes)

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82195:5d115756a4ce
Date: 2016-02-12 23:00 +0100
http://bitbucket.org/pypy/pypy/changeset/5d115756a4ce/

Log:hg merge default (+ fixes)

diff too long, truncating to 2000 out of 5677 lines

diff --git a/dotviewer/drawgraph.py b/dotviewer/drawgraph.py
--- a/dotviewer/drawgraph.py
+++ b/dotviewer/drawgraph.py
@@ -14,12 +14,661 @@
 FONT = os.path.join(this_dir, 'font', 'DroidSans.ttf')
 FIXEDFONT = os.path.join(this_dir, 'font', 'DroidSansMono.ttf')
 COLOR = {
-'black': (0,0,0),
-'white': (255,255,255),
-'red': (255,0,0),
-'green': (0,255,0),
-'blue': (0,0,255),
-'yellow': (255,255,0),
+'aliceblue': (240, 248, 255),
+'antiquewhite': (250, 235, 215),
+'antiquewhite1': (255, 239, 219),
+'antiquewhite2': (238, 223, 204),
+'antiquewhite3': (205, 192, 176),
+'antiquewhite4': (139, 131, 120),
+'aquamarine': (127, 255, 212),
+'aquamarine1': (127, 255, 212),
+'aquamarine2': (118, 238, 198),
+'aquamarine3': (102, 205, 170),
+'aquamarine4': (69, 139, 116),
+'azure': (240, 255, 255),
+'azure1': (240, 255, 255),
+'azure2': (224, 238, 238),
+'azure3': (193, 205, 205),
+'azure4': (131, 139, 139),
+'beige': (245, 245, 220),
+'bisque': (255, 228, 196),
+'bisque1': (255, 228, 196),
+'bisque2': (238, 213, 183),
+'bisque3': (205, 183, 158),
+'bisque4': (139, 125, 107),
+'black': (0, 0, 0),
+'blanchedalmond': (255, 235, 205),
+'blue': (0, 0, 255),
+'blue1': (0, 0, 255),
+'blue2': (0, 0, 238),
+'blue3': (0, 0, 205),
+'blue4': (0, 0, 139),
+'blueviolet': (138, 43, 226),
+'brown': (165, 42, 42),
+'brown1': (255, 64, 64),
+'brown2': (238, 59, 59),
+'brown3': (205, 51, 51),
+'brown4': (139, 35, 35),
+'burlywood': (222, 184, 135),
+'burlywood1': (255, 211, 155),
+'burlywood2': (238, 197, 145),
+'burlywood3': (205, 170, 125),
+'burlywood4': (139, 115, 85),
+'cadetblue': (95, 158, 160),
+'cadetblue1': (152, 245, 255),
+'cadetblue2': (142, 229, 238),
+'cadetblue3': (122, 197, 205),
+'cadetblue4': (83, 134, 139),
+'chartreuse': (127, 255, 0),
+'chartreuse1': (127, 255, 0),
+'chartreuse2': (118, 238, 0),
+'chartreuse3': (102, 205, 0),
+'chartreuse4': (69, 139, 0),
+'chocolate': (210, 105, 30),
+'chocolate1': (255, 127, 36),
+'chocolate2': (238, 118, 33),
+'chocolate3': (205, 102, 29),
+'chocolate4': (139, 69, 19),
+'coral': (255, 127, 80),
+'coral1': (255, 114, 86),
+'coral2': (238, 106, 80),
+'coral3': (205, 91, 69),
+'coral4': (139, 62, 47),
+'cornflowerblue': (100, 149, 237),
+'cornsilk': (255, 248, 220),
+'cornsilk1': (255, 248, 220),
+'cornsilk2': (238, 232, 205),
+'cornsilk3': (205, 200, 177),
+'cornsilk4': (139, 136, 120),
+'crimson': (220, 20, 60),
+'cyan': (0, 255, 255),
+'cyan1': (0, 255, 255),
+'cyan2': (0, 238, 238),
+'cyan3': (0, 205, 205),
+'cyan4': (0, 139, 139),
+'darkgoldenrod': (184, 134, 11),
+'darkgoldenrod1': (255, 185, 15),
+'darkgoldenrod2': (238, 173, 14),
+'darkgoldenrod3': (205, 149, 12),
+'darkgoldenrod4': (139, 101, 8),
+'darkgreen': (0, 100, 0),
+'darkkhaki': (189, 183, 107),
+'darkolivegreen': (85, 107, 47),
+'darkolivegreen1': (202, 255, 112),
+'darkolivegreen2': (188, 238, 104),
+'darkolivegreen3': (162, 205, 90),
+'darkolivegreen4': (110, 139, 61),
+'darkorange': (255, 140, 0),
+'darkorange1': (255, 127, 0),
+'darkorange2': (238, 118, 0),
+'darkorange3': (205, 102, 0),
+'darkorange4': (139, 69, 0),
+'darkorchid': (153, 50, 204),
+'darkorchid1': (191, 62, 255),
+'darkorchid2': (178, 58, 238),
+'darkorchid3': (154, 50, 205),
+'darkorchid4': (104, 34, 139),
+'darksalmon': (233, 150, 122),
+'darkseagreen': (143, 188, 143),
+'darkseagreen1': (193, 255, 193),
+'darkseagreen2': (180, 238, 180),
+'darkseagreen3': (155, 205, 155),
+'darkseagreen4': (105, 139, 105),
+'darkslateblue': (72, 61, 139),
+'darkslategray': (47, 79, 79),
+'darkslategray1': (151, 255, 255),
+'darkslategray2': (141, 238, 238),
+'darkslategray3': (121, 205, 205),
+'darkslategray4': (82, 139, 139),
+'darkslategrey': (47, 79, 79),
+'darkturquoise': (0, 206, 209),
+'darkviolet': (148, 0, 211),
+'deeppink': (255, 20, 147),
+'deeppink1': (255, 20, 147),
+'deeppink2': (238, 18, 137),
+'deeppink3': (205, 16, 118),
+'deeppink4': (139, 10, 80),
+'deepskyblue': (0, 191, 255),
+'deepskyblue1': (0, 191, 255),
+'deepskyblue2': (0, 178, 238),
+'deepskyblue3': (0, 154, 205),
+'deepskyblue4': (0, 104, 139),
+'dimgray': (105, 105, 105),
+'dimgrey': (105, 105, 105),
+'dodgerblue': (30, 144, 255),
+'dodgerblue1': (30, 144, 255),
+'dodgerblue2': (28, 134, 238),
+'dodgerblue3': (24, 116, 205),
+'do

[pypy-commit] pypy py3.3: Merged in marky1991/pypy_new/py3.3 (pull request #396)

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82200:32dbf468ae33
Date: 2016-02-13 03:30 +0100
http://bitbucket.org/pypy/pypy/changeset/32dbf468ae33/

Log:Merged in marky1991/pypy_new/py3.3 (pull request #396)

Fix test_reimport_builtin in py3.3

diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -58,8 +58,23 @@
 self.save_module_content_for_future_reload()
 
 def save_module_content_for_future_reload(self):
-self.w_initialdict = self.space.call_method(self.w_dict, 'copy')
-
+# Because setdictvalue is unable to immediately load all attributes
+# (due to an importlib bootstrapping problem), this method needs to be
+# able to support saving the content of a module's dict without
+# requiring that the entire dict already be loaded. To support that
+# properly, when updating the dict, we must be careful to never
+# overwrite the value of a key already in w_initialdict. (So as to 
avoid
+# overriding the builtin value with a user-provided value)
+if not self.space.is_none(self.w_initialdict):
+new_items = self.w_dict.iteritems()
+while True:
+w_key, w_value = new_items.next_item()
+if w_key is None:
+break
+if not 
self.space.is_true(self.space.contains(self.w_initialdict, w_key)):
+self.space.setitem(self.w_initialdict, w_key, w_value)
+else:
+self.w_initialdict = self.space.call_method(self.w_dict, 'copy')
 
 def get_applevel_name(cls):
 """ NOT_RPYTHON """
@@ -90,6 +105,7 @@
 def setdictvalue(self, space, attr, w_value):
 if self.lazy:
 self._load_lazily(space, attr)
+self.save_module_content_for_future_reload()
 space.setitem_str(self.w_dict, attr, w_value)
 return True
 
diff --git a/pypy/module/imp/interp_imp.py b/pypy/module/imp/interp_imp.py
--- a/pypy/module/imp/interp_imp.py
+++ b/pypy/module/imp/interp_imp.py
@@ -86,7 +86,7 @@
 return
 # force_init is needed to make reload actually reload instead of just
 # using the already-present module in sys.modules.
-return space.getbuiltinmodule(name, force_init=True)
+return space.getbuiltinmodule(name, force_init=True, reuse=False)
 
 def init_frozen(space, w_name):
 return None
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Tentatively fix translation.

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82201:fce240f22548
Date: 2016-02-13 04:37 +0100
http://bitbucket.org/pypy/pypy/changeset/fce240f22548/

Log:Tentatively fix translation.

This is not a proper fix because a MixedModule's dictionary does not
have to be a W_DictMultiObject. However, this is good enough for
running the build bots. I'll commit a proper fix tomorrow.

diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -66,7 +66,10 @@
 # overwrite the value of a key already in w_initialdict. (So as to 
avoid
 # overriding the builtin value with a user-provided value)
 if not self.space.is_none(self.w_initialdict):
-new_items = self.w_dict.iteritems()
+w_dict = self.w_dict
+from pypy.objspace.std.dictmultiobject import W_DictMultiObject
+assert isinstance(w_dict, W_DictMultiObject)
+new_items = w_dict.iteritems()
 while True:
 w_key, w_value = new_items.next_item()
 if w_key is None:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: hg merge py3k

2016-02-12 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82202:b7e79d170a32
Date: 2016-02-13 04:38 +0100
http://bitbucket.org/pypy/pypy/changeset/b7e79d170a32/

Log:hg merge py3k

diff too long, truncating to 2000 out of 5677 lines

diff --git a/dotviewer/drawgraph.py b/dotviewer/drawgraph.py
--- a/dotviewer/drawgraph.py
+++ b/dotviewer/drawgraph.py
@@ -14,12 +14,661 @@
 FONT = os.path.join(this_dir, 'font', 'DroidSans.ttf')
 FIXEDFONT = os.path.join(this_dir, 'font', 'DroidSansMono.ttf')
 COLOR = {
-'black': (0,0,0),
-'white': (255,255,255),
-'red': (255,0,0),
-'green': (0,255,0),
-'blue': (0,0,255),
-'yellow': (255,255,0),
+'aliceblue': (240, 248, 255),
+'antiquewhite': (250, 235, 215),
+'antiquewhite1': (255, 239, 219),
+'antiquewhite2': (238, 223, 204),
+'antiquewhite3': (205, 192, 176),
+'antiquewhite4': (139, 131, 120),
+'aquamarine': (127, 255, 212),
+'aquamarine1': (127, 255, 212),
+'aquamarine2': (118, 238, 198),
+'aquamarine3': (102, 205, 170),
+'aquamarine4': (69, 139, 116),
+'azure': (240, 255, 255),
+'azure1': (240, 255, 255),
+'azure2': (224, 238, 238),
+'azure3': (193, 205, 205),
+'azure4': (131, 139, 139),
+'beige': (245, 245, 220),
+'bisque': (255, 228, 196),
+'bisque1': (255, 228, 196),
+'bisque2': (238, 213, 183),
+'bisque3': (205, 183, 158),
+'bisque4': (139, 125, 107),
+'black': (0, 0, 0),
+'blanchedalmond': (255, 235, 205),
+'blue': (0, 0, 255),
+'blue1': (0, 0, 255),
+'blue2': (0, 0, 238),
+'blue3': (0, 0, 205),
+'blue4': (0, 0, 139),
+'blueviolet': (138, 43, 226),
+'brown': (165, 42, 42),
+'brown1': (255, 64, 64),
+'brown2': (238, 59, 59),
+'brown3': (205, 51, 51),
+'brown4': (139, 35, 35),
+'burlywood': (222, 184, 135),
+'burlywood1': (255, 211, 155),
+'burlywood2': (238, 197, 145),
+'burlywood3': (205, 170, 125),
+'burlywood4': (139, 115, 85),
+'cadetblue': (95, 158, 160),
+'cadetblue1': (152, 245, 255),
+'cadetblue2': (142, 229, 238),
+'cadetblue3': (122, 197, 205),
+'cadetblue4': (83, 134, 139),
+'chartreuse': (127, 255, 0),
+'chartreuse1': (127, 255, 0),
+'chartreuse2': (118, 238, 0),
+'chartreuse3': (102, 205, 0),
+'chartreuse4': (69, 139, 0),
+'chocolate': (210, 105, 30),
+'chocolate1': (255, 127, 36),
+'chocolate2': (238, 118, 33),
+'chocolate3': (205, 102, 29),
+'chocolate4': (139, 69, 19),
+'coral': (255, 127, 80),
+'coral1': (255, 114, 86),
+'coral2': (238, 106, 80),
+'coral3': (205, 91, 69),
+'coral4': (139, 62, 47),
+'cornflowerblue': (100, 149, 237),
+'cornsilk': (255, 248, 220),
+'cornsilk1': (255, 248, 220),
+'cornsilk2': (238, 232, 205),
+'cornsilk3': (205, 200, 177),
+'cornsilk4': (139, 136, 120),
+'crimson': (220, 20, 60),
+'cyan': (0, 255, 255),
+'cyan1': (0, 255, 255),
+'cyan2': (0, 238, 238),
+'cyan3': (0, 205, 205),
+'cyan4': (0, 139, 139),
+'darkgoldenrod': (184, 134, 11),
+'darkgoldenrod1': (255, 185, 15),
+'darkgoldenrod2': (238, 173, 14),
+'darkgoldenrod3': (205, 149, 12),
+'darkgoldenrod4': (139, 101, 8),
+'darkgreen': (0, 100, 0),
+'darkkhaki': (189, 183, 107),
+'darkolivegreen': (85, 107, 47),
+'darkolivegreen1': (202, 255, 112),
+'darkolivegreen2': (188, 238, 104),
+'darkolivegreen3': (162, 205, 90),
+'darkolivegreen4': (110, 139, 61),
+'darkorange': (255, 140, 0),
+'darkorange1': (255, 127, 0),
+'darkorange2': (238, 118, 0),
+'darkorange3': (205, 102, 0),
+'darkorange4': (139, 69, 0),
+'darkorchid': (153, 50, 204),
+'darkorchid1': (191, 62, 255),
+'darkorchid2': (178, 58, 238),
+'darkorchid3': (154, 50, 205),
+'darkorchid4': (104, 34, 139),
+'darksalmon': (233, 150, 122),
+'darkseagreen': (143, 188, 143),
+'darkseagreen1': (193, 255, 193),
+'darkseagreen2': (180, 238, 180),
+'darkseagreen3': (155, 205, 155),
+'darkseagreen4': (105, 139, 105),
+'darkslateblue': (72, 61, 139),
+'darkslategray': (47, 79, 79),
+'darkslategray1': (151, 255, 255),
+'darkslategray2': (141, 238, 238),
+'darkslategray3': (121, 205, 205),
+'darkslategray4': (82, 139, 139),
+'darkslategrey': (47, 79, 79),
+'darkturquoise': (0, 206, 209),
+'darkviolet': (148, 0, 211),
+'deeppink': (255, 20, 147),
+'deeppink1': (255, 20, 147),
+'deeppink2': (238, 18, 137),
+'deeppink3': (205, 16, 118),
+'deeppink4': (139, 10, 80),
+'deepskyblue': (0, 191, 255),
+'deepskyblue1': (0, 191, 255),
+'deepskyblue2': (0, 178, 238),
+'deepskyblue3': (0, 154, 205),
+'deepskyblue4': (0, 104, 139),
+'dimgray': (105, 105, 105),
+'dimgrey': (105, 105, 105),
+'dodgerblue': (30, 144, 255),
+'dodgerblue1': (30, 144, 255),
+'dodgerblue2': (28, 134, 238),
+'dodgerblue3': (24, 116, 205),
+'dodgerblue4': 

[pypy-commit] pypy py3.3: hg backout fce240f22548

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82205:fc48d0bd0c1d
Date: 2016-02-13 13:30 +0100
http://bitbucket.org/pypy/pypy/changeset/fc48d0bd0c1d/

Log:hg backout fce240f22548

diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -66,10 +66,7 @@
 # overwrite the value of a key already in w_initialdict. (So as to 
avoid
 # overriding the builtin value with a user-provided value)
 if not self.space.is_none(self.w_initialdict):
-w_dict = self.w_dict
-from pypy.objspace.std.dictmultiobject import W_DictMultiObject
-assert isinstance(w_dict, W_DictMultiObject)
-new_items = w_dict.iteritems()
+new_items = self.w_dict.iteritems()
 while True:
 w_key, w_value = new_items.next_item()
 if w_key is None:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Merged in marky1991/pypy_new/py3.3 (pull request #398)

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82207:d31526af1a0e
Date: 2016-02-13 13:32 +0100
http://bitbucket.org/pypy/pypy/changeset/d31526af1a0e/

Log:Merged in marky1991/pypy_new/py3.3 (pull request #398)

Fix translation for 3.3.

diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -66,11 +66,9 @@
 # overwrite the value of a key already in w_initialdict. (So as to 
avoid
 # overriding the builtin value with a user-provided value)
 if not self.space.is_none(self.w_initialdict):
-new_items = self.w_dict.iteritems()
-while True:
-w_key, w_value = new_items.next_item()
-if w_key is None:
-break
+w_items = 
self.space.iteriterable(self.space.call_method(self.w_dict,'items'))
+for w_item in w_items:
+w_key, w_value = self.space.fixedview(w_item, 
expected_length=2)
 if not 
self.space.is_true(self.space.contains(self.w_initialdict, w_key)):
 self.space.setitem(self.w_initialdict, w_key, w_value)
 else:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Make W_InterpIterable a interp-level-only object instead of letting it implement W_Root.

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82208:436b9109cbd7
Date: 2016-02-13 14:30 +0100
http://bitbucket.org/pypy/pypy/changeset/436b9109cbd7/

Log:Make W_InterpIterable a interp-level-only object instead of letting
it implement W_Root.

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -306,7 +306,7 @@
 return None
 
 
-class W_InterpIterable(W_Root):
+class InterpIterable(object):
 def __init__(self, space, w_iterable):
 self.w_iter = space.iter(w_iterable)
 self.space = space
@@ -846,7 +846,7 @@
 return lst_w[:] # make the resulting list resizable
 
 def iteriterable(self, w_iterable):
-return W_InterpIterable(self, w_iterable)
+return InterpIterable(self, w_iterable)
 
 def _unpackiterable_unknown_length(self, w_iterator, w_iterable):
 """Unpack an iterable of unknown length into an interp-level
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Pass iterable instead of iterator to space.iteriterable() (both works).

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82210:5c06f73f7e1f
Date: 2016-02-13 14:43 +0100
http://bitbucket.org/pypy/pypy/changeset/5c06f73f7e1f/

Log:Pass iterable instead of iterator to space.iteriterable() (both
works).

diff --git a/pypy/objspace/std/dictmultiobject.py 
b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -1419,8 +1419,7 @@
 return space.len(self.w_dict)
 
 def _all_contained_in(space, w_dictview, w_other):
-w_iter = space.iter(w_dictview)
-for w_item in space.iteriterable(w_iter):
+for w_item in space.iteriterable(w_dictview):
 if not space.contains_w(w_other, w_item):
 return space.w_False
 return space.w_True
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: hg merge default

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82211:837af91c362b
Date: 2016-02-13 15:01 +0100
http://bitbucket.org/pypy/pypy/changeset/837af91c362b/

Log:hg merge default

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -37,13 +37,13 @@
 "thread", "itertools", "pyexpat", "_ssl", "cpyext", "array",
 "binascii", "_multiprocessing", '_warnings', "_collections",
 "_multibytecodec", "_continuation", "_cffi_backend",
-"_csv", "_pypyjson", "_posixsubprocess", # "cppyy", "micronumpy"
+"_csv", "_pypyjson", "_vmprof", "_posixsubprocess", # "cppyy", "micronumpy"
 ])
 
-if ((sys.platform.startswith('linux') or sys.platform == 'darwin')
-and os.uname()[4] == 'x86_64' and sys.maxint > 2**32):
+#if ((sys.platform.startswith('linux') or sys.platform == 'darwin')
+#and os.uname()[4] == 'x86_64' and sys.maxint > 2**32):
 # it's not enough that we get x86_64
-working_modules.add('_vmprof')
+#working_modules.add('_vmprof')
 
 translation_modules = default_modules.copy()
 translation_modules.update([
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -313,7 +313,7 @@
 return None
 
 
-class W_InterpIterable(W_Root):
+class InterpIterable(object):
 def __init__(self, space, w_iterable):
 self.w_iter = space.iter(w_iterable)
 self.space = space
@@ -763,9 +763,13 @@
 return self.int_w(self.hash(w_obj))
 
 def len_w(self, w_obj):
-"""shotcut for space.int_w(space.len(w_obj))"""
+"""shortcut for space.int_w(space.len(w_obj))"""
 return self.int_w(self.len(w_obj))
 
+def contains_w(self, w_container, w_item):
+"""shortcut for space.is_true(space.contains(w_container, w_item))"""
+return self.is_true(self.contains(w_container, w_item))
+
 def setitem_str(self, w_obj, key, w_value):
 return self.setitem(w_obj, self.wrap(key), w_value)
 
@@ -868,7 +872,7 @@
 return lst_w[:] # make the resulting list resizable
 
 def iteriterable(self, w_iterable):
-return W_InterpIterable(self, w_iterable)
+return InterpIterable(self, w_iterable)
 
 def _unpackiterable_unknown_length(self, w_iterator, w_iterable):
 """Unpack an iterable of unknown length into an interp-level
@@ -1229,7 +1233,7 @@
 if not isinstance(statement, PyCode):
 raise TypeError('space.exec_(): expected a string, code or PyCode 
object')
 w_key = self.wrap('__builtins__')
-if not self.is_true(self.contains(w_globals, w_key)):
+if not self.contains_w(w_globals, w_key):
 self.setitem(w_globals, w_key, self.wrap(self.builtin))
 return statement.exec_code(self, w_globals, w_locals)
 
diff --git a/pypy/module/_demo/test/test_import.py 
b/pypy/module/_demo/test/test_import.py
--- a/pypy/module/_demo/test/test_import.py
+++ b/pypy/module/_demo/test/test_import.py
@@ -12,8 +12,7 @@
 w_modules = space.sys.get('modules')
 
 assert _demo.Module.demo_events == ['setup']
-assert not space.is_true(space.contains(w_modules,
-space.wrap('_demo')))
+assert not space.contains_w(w_modules, space.wrap('_demo'))
 
 # first import
 w_import = space.builtin.get('__import__')
diff --git a/pypy/module/_vmprof/interp_vmprof.py 
b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -60,7 +60,7 @@
 Must be smaller than 1.0
 """
 w_modules = space.sys.get('modules')
-if space.is_true(space.contains(w_modules, space.wrap('_continuation'))):
+if space.contains_w(w_modules, space.wrap('_continuation')):
 space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
   "with vmprof will crash"),
space.w_RuntimeWarning)
diff --git a/pypy/module/cpyext/test/test_dictobject.py 
b/pypy/module/cpyext/test/test_dictobject.py
--- a/pypy/module/cpyext/test/test_dictobject.py
+++ b/pypy/module/cpyext/test/test_dictobject.py
@@ -150,7 +150,7 @@
 def test_dictproxy(self, space, api):
 w_dict = space.sys.get('modules')
 w_proxy = api.PyDictProxy_New(w_dict)
-assert space.is_true(space.contains(w_proxy, space.wrap('sys')))
+assert space.contains_w(w_proxy, space.wrap('sys'))
 raises(OperationError, space.setitem,
w_proxy, space.wrap('sys'), space.w_None)
 raises(OperationError, space.delitem,
diff --git a/pypy/module/cpyext/test/test_import.py 
b/pypy/module/cpyext/test/test_import.py
--- a/pypy/module/cpyext/test/test_import.py
+++ b/pypy/module/cpyext/test/test_import.py
@@ -21,7 +21,7 @@
 def test_getmoduledict(self, space, api):
 testmod = "contextli

[pypy-commit] pypy py3k: Simplify code.

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82212:8e9369bbc962
Date: 2016-02-13 15:04 +0100
http://bitbucket.org/pypy/pypy/changeset/8e9369bbc962/

Log:Simplify code.

diff --git a/pypy/objspace/std/dictmultiobject.py 
b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -1405,9 +1405,8 @@
 if len_other > len_self:
 self, w_other = w_other, self
 
-w_iter = space.iter(w_other)
-for w_item in space.iteriterable(w_iter):
-if space.is_true(space.contains(self, w_item)):
+for w_item in space.iteriterable(w_other):
+if space.contains_w(self, w_item):
 return space.w_False
 return space.w_True
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Simplify code and make it correctly respect the w_ convention.

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82214:3f20320bc330
Date: 2016-02-13 15:12 +0100
http://bitbucket.org/pypy/pypy/changeset/3f20320bc330/

Log:Simplify code and make it correctly respect the w_ convention.

diff --git a/pypy/interpreter/mixedmodule.py b/pypy/interpreter/mixedmodule.py
--- a/pypy/interpreter/mixedmodule.py
+++ b/pypy/interpreter/mixedmodule.py
@@ -66,10 +66,10 @@
 # overwrite the value of a key already in w_initialdict. (So as to 
avoid
 # overriding the builtin value with a user-provided value)
 if not self.space.is_none(self.w_initialdict):
-w_items = 
self.space.iteriterable(self.space.call_method(self.w_dict,'items'))
-for w_item in w_items:
+w_items = self.space.call_method(self.w_dict, 'items')
+for w_item in self.space.iteriterable(w_items):
 w_key, w_value = self.space.fixedview(w_item, 
expected_length=2)
-if not 
self.space.is_true(self.space.contains(self.w_initialdict, w_key)):
+if not self.space.contains_w(self.w_initialdict, w_key):
 self.space.setitem(self.w_initialdict, w_key, w_value)
 else:
 self.w_initialdict = self.space.call_method(self.w_dict, 'copy')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Introduce space.contains_w(w_container, w_item) as a shortcut for space.is_true(space.contains(w_container, w_item)).

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82209:bc162d5aa423
Date: 2016-02-13 14:40 +0100
http://bitbucket.org/pypy/pypy/changeset/bc162d5aa423/

Log:Introduce space.contains_w(w_container, w_item) as a shortcut for
space.is_true(space.contains(w_container, w_item)).

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -745,9 +745,13 @@
 return self.int_w(self.hash(w_obj))
 
 def len_w(self, w_obj):
-"""shotcut for space.int_w(space.len(w_obj))"""
+"""shortcut for space.int_w(space.len(w_obj))"""
 return self.int_w(self.len(w_obj))
 
+def contains_w(self, w_container, w_item):
+"""shortcut for space.is_true(space.contains(w_container, w_item))"""
+return self.is_true(self.contains(w_container, w_item))
+
 def setitem_str(self, w_obj, key, w_value):
 return self.setitem(w_obj, self.wrap(key), w_value)
 
@@ -1237,7 +1241,7 @@
 if not isinstance(statement, PyCode):
 raise TypeError('space.exec_(): expected a string, code or PyCode 
object')
 w_key = self.wrap('__builtins__')
-if not self.is_true(self.contains(w_globals, w_key)):
+if not self.contains_w(w_globals, w_key):
 self.setitem(w_globals, w_key, self.wrap(self.builtin))
 return statement.exec_code(self, w_globals, w_locals)
 
diff --git a/pypy/module/__builtin__/interp_classobj.py 
b/pypy/module/__builtin__/interp_classobj.py
--- a/pypy/module/__builtin__/interp_classobj.py
+++ b/pypy/module/__builtin__/interp_classobj.py
@@ -20,7 +20,7 @@
 if not space.isinstance_w(w_dict, space.w_dict):
 raise_type_err(space, 'bases', 'tuple', w_bases)
 
-if not space.is_true(space.contains(w_dict, space.wrap("__doc__"))):
+if not space.contains_w(w_dict, space.wrap("__doc__")):
 space.setitem(w_dict, space.wrap("__doc__"), space.w_None)
 
 # XXX missing: lengthy and obscure logic about "__module__"
diff --git a/pypy/module/_demo/test/test_import.py 
b/pypy/module/_demo/test/test_import.py
--- a/pypy/module/_demo/test/test_import.py
+++ b/pypy/module/_demo/test/test_import.py
@@ -12,8 +12,7 @@
 w_modules = space.sys.get('modules')
 
 assert _demo.Module.demo_events == ['setup']
-assert not space.is_true(space.contains(w_modules,
-space.wrap('_demo')))
+assert not space.contains_w(w_modules, space.wrap('_demo'))
 
 # first import
 w_import = space.builtin.get('__import__')
diff --git a/pypy/module/_vmprof/interp_vmprof.py 
b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -60,7 +60,7 @@
 Must be smaller than 1.0
 """
 w_modules = space.sys.get('modules')
-if space.is_true(space.contains(w_modules, space.wrap('_continuation'))):
+if space.contains_w(w_modules, space.wrap('_continuation')):
 space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
   "with vmprof will crash"),
space.w_RuntimeWarning)
diff --git a/pypy/module/cpyext/test/test_dictobject.py 
b/pypy/module/cpyext/test/test_dictobject.py
--- a/pypy/module/cpyext/test/test_dictobject.py
+++ b/pypy/module/cpyext/test/test_dictobject.py
@@ -146,7 +146,7 @@
 def test_dictproxy(self, space, api):
 w_dict = space.sys.get('modules')
 w_proxy = api.PyDictProxy_New(w_dict)
-assert space.is_true(space.contains(w_proxy, space.wrap('sys')))
+assert space.contains_w(w_proxy, space.wrap('sys'))
 raises(OperationError, space.setitem,
w_proxy, space.wrap('sys'), space.w_None)
 raises(OperationError, space.delitem,
diff --git a/pypy/module/cpyext/test/test_import.py 
b/pypy/module/cpyext/test/test_import.py
--- a/pypy/module/cpyext/test/test_import.py
+++ b/pypy/module/cpyext/test/test_import.py
@@ -21,7 +21,7 @@
 def test_getmoduledict(self, space, api):
 testmod = "_functools"
 w_pre_dict = api.PyImport_GetModuleDict()
-assert not space.is_true(space.contains(w_pre_dict, 
space.wrap(testmod)))
+assert not space.contains_w(w_pre_dict, space.wrap(testmod))
 
 with rffi.scoped_str2charp(testmod) as modname:
 w_module = api.PyImport_ImportModule(modname)
@@ -29,7 +29,7 @@
 assert w_module
 
 w_dict = api.PyImport_GetModuleDict()
-assert space.is_true(space.contains(w_dict, space.wrap(testmod)))
+assert space.contains_w(w_dict, space.wrap(testmod))
 
 def test_reload(self, space, api):
 stat = api.PyImport_Import(space.wrap("stat"))
diff --git a/pypy/module/cpyext/test/test_object.py 
b/pypy/module/cpyext/test/test_object.py
--- a/pypy/module/cpyext/test/test_object.py
+++ b/pypy/module/cpyext/test/test_object.py
@@ 

[pypy-commit] pypy py3.3: hg merge py3k

2016-02-13 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82213:ee3f3a22ee31
Date: 2016-02-13 15:06 +0100
http://bitbucket.org/pypy/pypy/changeset/ee3f3a22ee31/

Log:hg merge py3k

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -37,14 +37,14 @@
 "thread", "itertools", "pyexpat", "_ssl", "cpyext", "array",
 "binascii", "_multiprocessing", '_warnings', "_collections",
 "_multibytecodec", "_continuation", "_cffi_backend",
-"_csv", "_pypyjson", "_posixsubprocess", # "cppyy", "micronumpy"
+"_csv", "_pypyjson", "_vmprof", "_posixsubprocess", # "cppyy", "micronumpy"
 "faulthandler",
 ])
 
-if ((sys.platform.startswith('linux') or sys.platform == 'darwin')
-and os.uname()[4] == 'x86_64' and sys.maxint > 2**32):
+#if ((sys.platform.startswith('linux') or sys.platform == 'darwin')
+#and os.uname()[4] == 'x86_64' and sys.maxint > 2**32):
 # it's not enough that we get x86_64
-working_modules.add('_vmprof')
+#working_modules.add('_vmprof')
 
 translation_modules = default_modules.copy()
 translation_modules.update([
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -313,7 +313,7 @@
 return None
 
 
-class W_InterpIterable(W_Root):
+class InterpIterable(object):
 def __init__(self, space, w_iterable):
 self.w_iter = space.iter(w_iterable)
 self.space = space
@@ -765,9 +765,13 @@
 return self.int_w(self.hash(w_obj))
 
 def len_w(self, w_obj):
-"""shotcut for space.int_w(space.len(w_obj))"""
+"""shortcut for space.int_w(space.len(w_obj))"""
 return self.int_w(self.len(w_obj))
 
+def contains_w(self, w_container, w_item):
+"""shortcut for space.is_true(space.contains(w_container, w_item))"""
+return self.is_true(self.contains(w_container, w_item))
+
 def setitem_str(self, w_obj, key, w_value):
 return self.setitem(w_obj, self.wrap(key), w_value)
 
@@ -870,7 +874,7 @@
 return lst_w[:] # make the resulting list resizable
 
 def iteriterable(self, w_iterable):
-return W_InterpIterable(self, w_iterable)
+return InterpIterable(self, w_iterable)
 
 def _unpackiterable_unknown_length(self, w_iterator, w_iterable):
 """Unpack an iterable of unknown length into an interp-level
@@ -1240,7 +1244,7 @@
 if not isinstance(statement, PyCode):
 raise TypeError('space.exec_(): expected a string, code or PyCode 
object')
 w_key = self.wrap('__builtins__')
-if not self.is_true(self.contains(w_globals, w_key)):
+if not self.contains_w(w_globals, w_key):
 self.setitem(w_globals, w_key, self.wrap(self.builtin))
 return statement.exec_code(self, w_globals, w_locals)
 
diff --git a/pypy/module/_demo/test/test_import.py 
b/pypy/module/_demo/test/test_import.py
--- a/pypy/module/_demo/test/test_import.py
+++ b/pypy/module/_demo/test/test_import.py
@@ -12,8 +12,7 @@
 w_modules = space.sys.get('modules')
 
 assert _demo.Module.demo_events == ['setup']
-assert not space.is_true(space.contains(w_modules,
-space.wrap('_demo')))
+assert not space.contains_w(w_modules, space.wrap('_demo'))
 
 # first import
 w_import = space.builtin.get('__import__')
diff --git a/pypy/module/_vmprof/interp_vmprof.py 
b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -60,7 +60,7 @@
 Must be smaller than 1.0
 """
 w_modules = space.sys.get('modules')
-if space.is_true(space.contains(w_modules, space.wrap('_continuation'))):
+if space.contains_w(w_modules, space.wrap('_continuation')):
 space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
   "with vmprof will crash"),
space.w_RuntimeWarning)
diff --git a/pypy/module/cpyext/test/test_dictobject.py 
b/pypy/module/cpyext/test/test_dictobject.py
--- a/pypy/module/cpyext/test/test_dictobject.py
+++ b/pypy/module/cpyext/test/test_dictobject.py
@@ -150,7 +150,7 @@
 def test_dictproxy(self, space, api):
 w_dict = space.sys.get('modules')
 w_proxy = api.PyDictProxy_New(w_dict)
-assert space.is_true(space.contains(w_proxy, space.wrap('sys')))
+assert space.contains_w(w_proxy, space.wrap('sys'))
 raises(OperationError, space.setitem,
w_proxy, space.wrap('sys'), space.w_None)
 raises(OperationError, space.delitem,
diff --git a/pypy/module/cpyext/test/test_import.py 
b/pypy/module/cpyext/test/test_import.py
--- a/pypy/module/cpyext/test/test_import.py
+++ b/pypy/module/cpyext/test/test_import.py
@@ -21,7 +21,7 @@
 def test_getmoduledict(self, space, api):
 t

[pypy-commit] pypy default: Make integer constant fit in 32 bits to make vmprof tests pass on 32-bit again.

2016-02-15 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82262:02eab80025cb
Date: 2016-02-15 14:10 +0100
http://bitbucket.org/pypy/pypy/changeset/02eab80025cb/

Log:Make integer constant fit in 32 bits to make vmprof tests pass on
32-bit again.

diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py 
b/rpython/rlib/rvmprof/test/test_rvmprof.py
--- a/rpython/rlib/rvmprof/test/test_rvmprof.py
+++ b/rpython/rlib/rvmprof/test/test_rvmprof.py
@@ -101,7 +101,7 @@
 s = 0
 for i in range(num):
 s += (i << 1)
-if s % 32423423423 == 0:
+if s % 2423423423 == 0:
 print s
 return s
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Change constant fit in 31 bits - it's signed.

2016-02-15 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82263:b6d62c49d868
Date: 2016-02-15 14:24 +0100
http://bitbucket.org/pypy/pypy/changeset/b6d62c49d868/

Log:Change constant fit in 31 bits - it's signed.

diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py 
b/rpython/rlib/rvmprof/test/test_rvmprof.py
--- a/rpython/rlib/rvmprof/test/test_rvmprof.py
+++ b/rpython/rlib/rvmprof/test/test_rvmprof.py
@@ -101,7 +101,7 @@
 s = 0
 for i in range(num):
 s += (i << 1)
-if s % 2423423423 == 0:
+if s % 2123423423 == 0:
 print s
 return s
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Fix test by checking for correct behaviour.

2016-02-15 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82270:0a7d0c775a46
Date: 2016-02-15 17:20 +0100
http://bitbucket.org/pypy/pypy/changeset/0a7d0c775a46/

Log:Fix test by checking for correct behaviour.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1105,8 +1105,7 @@
 import b
 except ImportError:
 pass
-assert isinstance(sys.path_importer_cache['yyy'],
-  imp.NullImporter)
+assert sys.path_importer_cache['yyy'] is None
 finally:
 sys.path.pop(0)
 sys.path.pop(0)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Fix test by inserting sys.meta_path hook at the beginning.

2016-02-15 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82269:3495c617f6d0
Date: 2016-02-15 17:16 +0100
http://bitbucket.org/pypy/pypy/changeset/3495c617f6d0/

Log:Fix test by inserting sys.meta_path hook at the beginning.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1040,7 +1040,7 @@
 import sys, math
 del sys.modules["math"]
 
-sys.meta_path.append(Importer())
+sys.meta_path.insert(0, Importer())
 try:
 import math
 assert len(tried_imports) == 1
@@ -1050,7 +1050,7 @@
 else:
 assert tried_imports[0][0] == "math"
 finally:
-sys.meta_path.pop()
+sys.meta_path.pop(0)
 
 def test_meta_path_block(self):
 class ImportBlocker(object):
@@ -1069,7 +1069,7 @@
 if modname in sys.modules:
 mod = sys.modules
 del sys.modules[modname]
-sys.meta_path.append(ImportBlocker(modname))
+sys.meta_path.insert(0, ImportBlocker(modname))
 try:
 raises(ImportError, __import__, modname)
 # the imp module doesn't use meta_path, and is not blocked
@@ -1077,7 +1077,7 @@
 file, filename, stuff = imp.find_module(modname)
 imp.load_module(modname, file, filename, stuff)
 finally:
-sys.meta_path.pop()
+sys.meta_path.pop(0)
 if mod:
 sys.modules[modname] = mod
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Add target_is_directory parameter to os.symlink, which is ignored on non-Windows platforms.

2016-02-18 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82320:ed8bc259dde5
Date: 2016-02-18 23:23 +0100
http://bitbucket.org/pypy/pypy/changeset/ed8bc259dde5/

Log:Add target_is_directory parameter to os.symlink, which is ignored on
non-Windows platforms.

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
@@ -731,8 +731,9 @@
 except OSError, e:
 raise wrap_oserror(space, e)
 
-def symlink(space, w_src, w_dst):
+def symlink(space, w_src, w_dst, w_target_is_directory=None):
 "Create a symbolic link pointing to src named dst."
+# TODO: target_is_directory has a meaning on Windows
 try:
 dispatch_filename_2(rposix.symlink)(space, w_src, w_dst)
 except OSError, e:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Fix test_structseq.py by not checking _structseq's __file__.

2016-02-18 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82321:040589830b1d
Date: 2016-02-19 02:54 +0100
http://bitbucket.org/pypy/pypy/changeset/040589830b1d/

Log:Fix test_structseq.py by not checking _structseq's __file__.

The __file__ attribute is not present on the _structseq module
because of import bootstrap issues.

diff --git a/pypy/module/test_lib_pypy/test_structseq.py 
b/pypy/module/test_lib_pypy/test_structseq.py
--- a/pypy/module/test_lib_pypy/test_structseq.py
+++ b/pypy/module/test_lib_pypy/test_structseq.py
@@ -6,7 +6,8 @@
 spaceconfig = dict(usemodules=('binascii', 'struct',))
 
 def setup_class(cls):
-cls.w__structseq = import_lib_pypy(cls.space, '_structseq')
+cls.w__structseq = cls.space.appexec(
+[], "(): import _structseq; return _structseq")
 
 def w_get_mydata(self):
 _structseq = self._structseq
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy llvm-translation-backend: Use GCTransformer's get_prebuilt_hash() method.

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r82328:ee28a2e5145b
Date: 2016-02-17 00:56 +0100
http://bitbucket.org/pypy/pypy/changeset/ee28a2e5145b/

Log:Use GCTransformer's get_prebuilt_hash() method.

diff --git a/rpython/translator/llvm/genllvm.py 
b/rpython/translator/llvm/genllvm.py
--- a/rpython/translator/llvm/genllvm.py
+++ b/rpython/translator/llvm/genllvm.py
@@ -98,7 +98,7 @@
 else:
 global_attrs += 'global'
 
-hash_ = database.genllvm.gcpolicy.get_prebuilt_hash(obj)
+hash_ = database.genllvm.gcpolicy.gctransformer.get_prebuilt_hash(obj)
 if hash_ is None:
 if self.varsize:
 extra_len = self.get_extra_len(obj)
@@ -1653,9 +1653,6 @@
 def get_gc_fields(self):
 return [(database.get_type(self.gctransformer.HDR), '_gc_header')]
 
-def get_prebuilt_hash(self, obj):
-pass
-
 def finish(self):
 genllvm = self.genllvm
 while self.delayed_ptrs:
@@ -1696,23 +1693,10 @@
 
 def get_gc_field_values(self, obj):
 obj = lltype.top_container(obj)
-needs_hash = self.get_prebuilt_hash(obj) is not None
+needs_hash = self.gctransformer.get_prebuilt_hash(obj) is not None
 hdr = self.gctransformer.gc_header_for(obj, needs_hash)
 return [hdr._obj]
 
-# from c backend
-def get_prebuilt_hash(self, obj):
-# for prebuilt objects that need to have their hash stored and
-# restored.  Note that only structures that are StructNodes all
-# the way have their hash stored (and not e.g. structs with var-
-# sized arrays at the end).  'obj' must be the top_container.
-TYPE = lltype.typeOf(obj)
-if not isinstance(TYPE, lltype.GcStruct):
-return None
-if TYPE._is_varsize():
-return None
-return getattr(obj, '_hash_cache_', None)
-
 
 class RefcountGCPolicy(GCPolicy):
 class RttiType(FuncType):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: hg merge default

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82329:4634d8e8bf6e
Date: 2016-02-19 19:04 +0100
http://bitbucket.org/pypy/pypy/changeset/4634d8e8bf6e/

Log:hg merge default

diff --git a/lib-python/2.7/distutils/command/build_ext.py 
b/lib-python/2.7/distutils/command/build_ext.py
--- a/lib-python/2.7/distutils/command/build_ext.py
+++ b/lib-python/2.7/distutils/command/build_ext.py
@@ -188,7 +188,7 @@
 # the 'libs' directory is for binary installs - we assume that
 # must be the *native* platform.  But we don't really support
 # cross-compiling via a binary install anyway, so we let it go.
-self.library_dirs.append(os.path.join(sys.exec_prefix, 'include'))
+self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))
 if self.debug:
 self.build_temp = os.path.join(self.build_temp, "Debug")
 else:
diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -62,7 +62,7 @@
 if sys.platform == 'win32':
 # XXX pyconfig.h uses a pragma to link to the import library,
 # which is currently python3.lib
-library = os.path.join(thisdir, '..', 'include', 'python32')
+library = os.path.join(thisdir, '..', 'libs', 'python32')
 if not os.path.exists(library + '.lib'):
 # For a local translation or nightly build
 library = os.path.join(thisdir, '..', 'pypy', 'goal', 'python32')
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: cffi
-Version: 1.5.1
+Version: 1.5.2
 Summary: Foreign Function Interface for Python calling C code.
 Home-page: http://cffi.readthedocs.org
 Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -4,8 +4,8 @@
 from .api import FFI, CDefError, FFIError
 from .ffiplatform import VerificationError, VerificationMissing
 
-__version__ = "1.5.1"
-__version_info__ = (1, 5, 1)
+__version__ = "1.5.2"
+__version_info__ = (1, 5, 2)
 
 # The verifier module file names are based on the CRC32 of a string that
 # contains the following version number.  It may be older than __version__
diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h
--- a/lib_pypy/cffi/_embedding.h
+++ b/lib_pypy/cffi/_embedding.h
@@ -233,7 +233,7 @@
 f = PySys_GetObject((char *)"stderr");
 if (f != NULL && f != Py_None) {
 PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
-   "\ncompiled with cffi version: 1.5.1"
+   "\ncompiled with cffi version: 1.5.2"
"\n_cffi_backend module: ", f);
 modules = PyImport_GetModuleDict();
 mod = PyDict_GetItemString(modules, "_cffi_backend");
diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py
--- a/lib_pypy/cffi/api.py
+++ b/lib_pypy/cffi/api.py
@@ -1,4 +1,4 @@
-import sys, sysconfig, types
+import sys, types
 from .lock import allocate_lock
 
 try:
@@ -550,16 +550,34 @@
 lst.append(value)
 #
 if '__pypy__' in sys.builtin_module_names:
+import os
+if sys.platform == "win32":
+# we need 'libpypy-c.lib'.  Current distributions of
+# pypy (>= 4.1) contain it as 'libs/python27.lib'.
+pythonlib = "python27"
+if hasattr(sys, 'prefix'):
+ensure('library_dirs', os.path.join(sys.prefix, 'libs'))
+else:
+# we need 'libpypy-c.{so,dylib}', which should be by
+# default located in 'sys.prefix/bin' for installed
+# systems.
+pythonlib = "pypy-c"
+if hasattr(sys, 'prefix'):
+ensure('library_dirs', os.path.join(sys.prefix, 'bin'))
+# On uninstalled pypy's, the libpypy-c is typically found in
+# .../pypy/goal/.
 if hasattr(sys, 'prefix'):
-import os
-ensure('library_dirs', os.path.join(sys.prefix, 'bin'))
-pythonlib = "pypy-c"
+ensure('library_dirs', os.path.join(sys.prefix, 'pypy', 
'goal'))
 else:
 if sys.platform == "win32":
 template = "python%d%d"
 if hasattr(sys, 'gettotalrefcount'):
 template += '_d'
 else:
+try:
+import sysconfig
+except ImportError:# 2.6
+from distutils import sysconfig
 template = "python%d.%d"
 if sysconfig.get_config_var('DEBUG_EXT'):
 template += sysconfig.get_config_var('D

[pypy-commit] pypy py3.3: Fix _imp module direct app tests.

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82331:7aac73fa16ed
Date: 2016-02-19 21:52 +0100
http://bitbucket.org/pypy/pypy/changeset/7aac73fa16ed/

Log:Fix _imp module direct app tests.

diff --git a/pypy/module/imp/test/test_app.py b/pypy/module/imp/test/test_app.py
--- a/pypy/module/imp/test/test_app.py
+++ b/pypy/module/imp/test/test_app.py
@@ -8,7 +8,6 @@
 }
 
 def setup_class(cls):
-cls.w_imp = cls.space.getbuiltinmodule('_imp')
 cls.w_file_module = cls.space.wrap(__file__)
 latin1 = udir.join('latin1.py')
 latin1.write("# -*- coding: iso-8859-1 -*\n")
@@ -75,7 +74,8 @@
 assert type == 'rb'
 
 def test_ext_suffixes(self):
-for suffix in self.imp.extension_suffixes():
+import _imp
+for suffix in _imp.extension_suffixes():
 assert suffix.endswith(('.pyd', '.so'))
 
 def test_obscure_functions(self):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: Add exec() workaround for running on top of old CPython 2.7 versions.

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82330:1bf2ad223b9c
Date: 2016-02-19 20:58 +0100
http://bitbucket.org/pypy/pypy/changeset/1bf2ad223b9c/

Log:Add exec() workaround for running on top of old CPython 2.7
versions.

diff --git a/pypy/module/__pypy__/test/test_magic.py 
b/pypy/module/__pypy__/test/test_magic.py
--- a/pypy/module/__pypy__/test/test_magic.py
+++ b/pypy/module/__pypy__/test/test_magic.py
@@ -15,6 +15,10 @@
 __pypy__.save_module_content_for_future_reload(sys)
 
 def test_new_code_hook(self):
+# workaround for running on top of old CPython 2.7 versions
+def exec_(code, d):
+exec(code, d)
+
 l = []
 
 def callable(code):
@@ -24,7 +28,7 @@
 __pypy__.set_code_callback(callable)
 d = {}
 try:
-exec("""
+exec_("""
 def f():
 pass
 """, d)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: hg merge py3k

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82332:58f595f70a58
Date: 2016-02-19 22:26 +0100
http://bitbucket.org/pypy/pypy/changeset/58f595f70a58/

Log:hg merge py3k

diff --git a/lib-python/2.7/distutils/command/build_ext.py 
b/lib-python/2.7/distutils/command/build_ext.py
--- a/lib-python/2.7/distutils/command/build_ext.py
+++ b/lib-python/2.7/distutils/command/build_ext.py
@@ -188,7 +188,7 @@
 # the 'libs' directory is for binary installs - we assume that
 # must be the *native* platform.  But we don't really support
 # cross-compiling via a binary install anyway, so we let it go.
-self.library_dirs.append(os.path.join(sys.exec_prefix, 'include'))
+self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))
 if self.debug:
 self.build_temp = os.path.join(self.build_temp, "Debug")
 else:
diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -62,7 +62,7 @@
 if sys.platform == 'win32':
 # XXX pyconfig.h uses a pragma to link to the import library,
 # which is currently python3.lib
-library = os.path.join(thisdir, '..', 'include', 'python32')
+library = os.path.join(thisdir, '..', 'libs', 'python32')
 if not os.path.exists(library + '.lib'):
 # For a local translation or nightly build
 library = os.path.join(thisdir, '..', 'pypy', 'goal', 'python32')
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: cffi
-Version: 1.5.1
+Version: 1.5.2
 Summary: Foreign Function Interface for Python calling C code.
 Home-page: http://cffi.readthedocs.org
 Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -4,8 +4,8 @@
 from .api import FFI, CDefError, FFIError
 from .ffiplatform import VerificationError, VerificationMissing
 
-__version__ = "1.5.1"
-__version_info__ = (1, 5, 1)
+__version__ = "1.5.2"
+__version_info__ = (1, 5, 2)
 
 # The verifier module file names are based on the CRC32 of a string that
 # contains the following version number.  It may be older than __version__
diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h
--- a/lib_pypy/cffi/_embedding.h
+++ b/lib_pypy/cffi/_embedding.h
@@ -233,7 +233,7 @@
 f = PySys_GetObject((char *)"stderr");
 if (f != NULL && f != Py_None) {
 PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
-   "\ncompiled with cffi version: 1.5.1"
+   "\ncompiled with cffi version: 1.5.2"
"\n_cffi_backend module: ", f);
 modules = PyImport_GetModuleDict();
 mod = PyDict_GetItemString(modules, "_cffi_backend");
diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py
--- a/lib_pypy/cffi/api.py
+++ b/lib_pypy/cffi/api.py
@@ -1,4 +1,4 @@
-import sys, sysconfig, types
+import sys, types
 from .lock import allocate_lock
 
 try:
@@ -550,16 +550,34 @@
 lst.append(value)
 #
 if '__pypy__' in sys.builtin_module_names:
+import os
+if sys.platform == "win32":
+# we need 'libpypy-c.lib'.  Current distributions of
+# pypy (>= 4.1) contain it as 'libs/python27.lib'.
+pythonlib = "python27"
+if hasattr(sys, 'prefix'):
+ensure('library_dirs', os.path.join(sys.prefix, 'libs'))
+else:
+# we need 'libpypy-c.{so,dylib}', which should be by
+# default located in 'sys.prefix/bin' for installed
+# systems.
+pythonlib = "pypy-c"
+if hasattr(sys, 'prefix'):
+ensure('library_dirs', os.path.join(sys.prefix, 'bin'))
+# On uninstalled pypy's, the libpypy-c is typically found in
+# .../pypy/goal/.
 if hasattr(sys, 'prefix'):
-import os
-ensure('library_dirs', os.path.join(sys.prefix, 'bin'))
-pythonlib = "pypy-c"
+ensure('library_dirs', os.path.join(sys.prefix, 'pypy', 
'goal'))
 else:
 if sys.platform == "win32":
 template = "python%d%d"
 if hasattr(sys, 'gettotalrefcount'):
 template += '_d'
 else:
+try:
+import sysconfig
+except ImportError:# 2.6
+from distutils import sysconfig
 template = "python%d.%d"
 if sysconfig.get_config_var('DEBUG_EXT'):
 template += sysconfig.get_config_var('DEB

[pypy-commit] pypy py3.3: Check for SystemError instead of ValueError.

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82334:8ed10a343cd5
Date: 2016-02-19 23:11 +0100
http://bitbucket.org/pypy/pypy/changeset/8ed10a343cd5/

Log:Check for SystemError instead of ValueError.

SystemError is raised here on CPython as well, although this is
"wrong" and was fixed to be ImportError in CPython's 3.6 branch.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -458,14 +458,14 @@
 print('__name__ =', __name__)
 from .struct import inpackage
 """, ns)
-raises(ValueError, ns['imp'])
+raises(SystemError, ns['imp'])
 
 def test_future_relative_import_error_when_in_non_package2(self):
 ns = {'__name__': __name__}
 exec("""def imp():
 from .. import inpackage
 """, ns)
-raises(ValueError, ns['imp'])
+raises(SystemError, ns['imp'])
 
 def test_relative_import_with___name__(self):
 import sys
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Backport patch from CPython Issue 26367.

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82333:01b8a2d215a6
Date: 2016-02-19 22:40 +0100
http://bitbucket.org/pypy/pypy/changeset/01b8a2d215a6/

Log:Backport patch from CPython Issue 26367.

diff --git a/lib-python/3/importlib/_bootstrap.py 
b/lib-python/3/importlib/_bootstrap.py
--- a/lib-python/3/importlib/_bootstrap.py
+++ b/lib-python/3/importlib/_bootstrap.py
@@ -1496,7 +1496,7 @@
 raise TypeError("module name must be str, not {}".format(type(name)))
 if level < 0:
 raise ValueError('level must be >= 0')
-if package:
+if level > 0:
 if not isinstance(package, str):
 raise TypeError("__package__ not set to a string")
 elif package not in sys.modules:
diff --git a/lib-python/3/test/test_importlib/import_/test_relative_imports.py 
b/lib-python/3/test/test_importlib/import_/test_relative_imports.py
--- a/lib-python/3/test/test_importlib/import_/test_relative_imports.py
+++ b/lib-python/3/test/test_importlib/import_/test_relative_imports.py
@@ -208,6 +208,11 @@
 with self.assertRaises(KeyError):
 import_util.import_('sys', level=1)
 
+def test_relative_import_no_package_exists_absolute(self):
+with self.assertRaises(SystemError):
+self.__import__('sys', {'__package__': '', '__spec__': None},
+level=1)
+
 
 def test_main():
 from test.support import run_unittest
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Fix test by pleasing sanity check.

2016-02-19 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82335:99af7e9c0c5f
Date: 2016-02-19 23:36 +0100
http://bitbucket.org/pypy/pypy/changeset/99af7e9c0c5f/

Log:Fix test by pleasing sanity check.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -487,6 +487,7 @@
 import imp
 pkg = imp.new_module('newpkg')
 sys.modules['newpkg'] = pkg
+sys.modules['newpkg.foo'] = imp.new_module('newpkg.foo')
 mydict = {'__name__': 'newpkg.foo', '__path__': '/some/path'}
 res = __import__('', mydict, None, ['bar'], 2)
 assert res is pkg
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add more entries to .hgignore.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82340:12cad570a035
Date: 2016-02-20 12:29 +0100
http://bitbucket.org/pypy/pypy/changeset/12cad570a035/

Log:Add more entries to .hgignore.

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -49,6 +49,7 @@
 ^rpython/translator/jvm/\.classpath$
 ^rpython/translator/jvm/eclipse-bin$
 ^rpython/translator/jvm/src/pypy/.+\.class$
+^rpython/translator/llvm/.+\.so$
 ^rpython/translator/benchmark/docutils$
 ^rpython/translator/benchmark/templess$
 ^rpython/translator/benchmark/gadfly$
@@ -72,6 +73,7 @@
 ^rpython/translator/cli/src/pypylib\.dll$
 ^rpython/translator/cli/src/query\.exe$
 ^rpython/translator/cli/src/main\.exe$
+^lib-python/2.7/lib2to3/.+\.pickle$
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Kill rpython/rtyper/module/test/test_ll_strtod.py.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82344:b9270e154cea
Date: 2016-02-20 13:13 +0100
http://bitbucket.org/pypy/pypy/changeset/b9270e154cea/

Log:Kill rpython/rtyper/module/test/test_ll_strtod.py.

diff --git a/rpython/rtyper/module/test/test_ll_strtod.py 
b/rpython/rtyper/module/test/test_ll_strtod.py
deleted file mode 100644
--- a/rpython/rtyper/module/test/test_ll_strtod.py
+++ /dev/null
@@ -1,13 +0,0 @@
-import py
-
-from rpython.rtyper.test.tool import BaseRtypingTest
-from rpython.rlib import rfloat
-
-class TestStrtod(BaseRtypingTest):
-def test_formatd(self):
-for flags in [0,
-  rfloat.DTSF_ADD_DOT_0]:
-def f(y):
-return rfloat.formatd(y, 'g', 2, flags)
-
-assert self.ll_to_string(self.interpret(f, [3.0])) == f(3.0)
diff --git a/rpython/rtyper/test/test_rfloat.py 
b/rpython/rtyper/test/test_rfloat.py
--- a/rpython/rtyper/test/test_rfloat.py
+++ b/rpython/rtyper/test/test_rfloat.py
@@ -204,6 +204,13 @@
 res = self.ll_to_string(self.interpret(f, [10/3.0]))
 assert res == '3.33'
 
+def test_formatd_g(self):
+for flags in [0, rfloat.DTSF_ADD_DOT_0]:
+def f(y):
+return rfloat.formatd(y, 'g', 2, flags)
+
+assert self.ll_to_string(self.interpret(f, [3.0])) == f(3.0)
+
 def test_formatd_repr(self):
 from rpython.rlib.rfloat import formatd
 def f(x):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Move StringTraits and UnicodeTraits classes from rpython/rtyper/module/support.py to rpython/rlib/rposix.py.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82342:dd1e021c36b6
Date: 2016-02-20 12:55 +0100
http://bitbucket.org/pypy/pypy/changeset/dd1e021c36b6/

Log:Move StringTraits and UnicodeTraits classes from
rpython/rtyper/module/support.py to rpython/rlib/rposix.py.

diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -3,7 +3,6 @@
 import errno
 from rpython.rtyper.lltypesystem.rffi import CConstant, CExternVariable, INT
 from rpython.rtyper.lltypesystem import lltype, ll2ctypes, rffi
-from rpython.rtyper.module.support import StringTraits, UnicodeTraits
 from rpython.rtyper.tool import rffi_platform
 from rpython.tool.sourcetools import func_renamer
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
@@ -12,7 +11,7 @@
 specialize, enforceargs, register_replacement_for, NOT_CONSTANT)
 from rpython.rlib.signature import signature
 from rpython.rlib import types
-from rpython.annotator.model import s_Str0
+from rpython.annotator.model import s_Str0, s_Unicode0
 from rpython.rlib import jit
 from rpython.translator.platform import platform
 from rpython.rlib import rstring
@@ -342,6 +341,87 @@
 rstring.check_str0(res)
 return res
 
+
+class StringTraits:
+str = str
+str0 = s_Str0
+CHAR = rffi.CHAR
+CCHARP = rffi.CCHARP
+charp2str = staticmethod(rffi.charp2str)
+charpsize2str = staticmethod(rffi.charpsize2str)
+scoped_str2charp = staticmethod(rffi.scoped_str2charp)
+str2charp = staticmethod(rffi.str2charp)
+free_charp = staticmethod(rffi.free_charp)
+scoped_alloc_buffer = staticmethod(rffi.scoped_alloc_buffer)
+
+@staticmethod
+def posix_function_name(name):
+return UNDERSCORE_ON_WIN32 + name
+
+@staticmethod
+def ll_os_name(name):
+return 'll_os.ll_os_' + name
+
+@staticmethod
+@specialize.argtype(0)
+def as_str(path):
+assert path is not None
+if isinstance(path, str):
+return path
+elif isinstance(path, unicode):
+# This never happens in PyPy's Python interpreter!
+# Only in raw RPython code that uses unicode strings.
+# We implement python2 behavior: silently convert to ascii.
+return path.encode('ascii')
+else:
+return path.as_bytes()
+
+@staticmethod
+@specialize.argtype(0)
+def as_str0(path):
+res = StringTraits.as_str(path)
+rstring.check_str0(res)
+return res
+
+
+class UnicodeTraits:
+str = unicode
+str0 = s_Unicode0
+CHAR = rffi.WCHAR_T
+CCHARP = rffi.CWCHARP
+charp2str = staticmethod(rffi.wcharp2unicode)
+charpsize2str = staticmethod(rffi.wcharpsize2unicode)
+str2charp = staticmethod(rffi.unicode2wcharp)
+scoped_str2charp = staticmethod(rffi.scoped_unicode2wcharp)
+free_charp = staticmethod(rffi.free_wcharp)
+scoped_alloc_buffer = staticmethod(rffi.scoped_alloc_unicodebuffer)
+
+@staticmethod
+def posix_function_name(name):
+return UNDERSCORE_ON_WIN32 + 'w' + name
+
+@staticmethod
+@specialize.argtype(0)
+def ll_os_name(name):
+return 'll_os.ll_os_w' + name
+
+@staticmethod
+@specialize.argtype(0)
+def as_str(path):
+assert path is not None
+if isinstance(path, unicode):
+return path
+else:
+return path.as_unicode()
+
+@staticmethod
+@specialize.argtype(0)
+def as_str0(path):
+res = UnicodeTraits.as_str(path)
+rstring.check_str0(res)
+return res
+
+
 # Returns True when the unicode function should be called:
 # - on Windows
 # - if the path is Unicode.
diff --git a/rpython/rlib/rposix_environ.py b/rpython/rlib/rposix_environ.py
--- a/rpython/rlib/rposix_environ.py
+++ b/rpython/rlib/rposix_environ.py
@@ -2,10 +2,10 @@
 import sys
 from rpython.annotator import model as annmodel
 from rpython.rlib.objectmodel import enforceargs
+from rpython.rlib.rposix import _WIN32, StringTraits, UnicodeTraits
 from rpython.rtyper.controllerentry import Controller
 from rpython.rtyper.extfunc import register_external
 from rpython.rtyper.lltypesystem import rffi, lltype
-from rpython.rtyper.module.support import _WIN32, StringTraits, UnicodeTraits
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 str0 = annmodel.s_Str0
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
@@ -1,6 +1,5 @@
 import sys
 
-from rpython.annotator import model as annmodel
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rlib.objectmodel import specialize
 from rpython.rlib import rstring
@@ -8,85 +7,6 @@
 _WIN32 = sys.platform.startswith('win')
 UNDERSCORE_ON_WIN32 = '_' if _WIN32 else ''
 
-
-class StringTraits:
-str = str
-str0 = annmodel.s_Str0
-CHAR = rffi.CHAR
-CCHARP = rffi.C

[pypy-commit] pypy default: Kill LLSupport from rpython/rtyper/module/support.py.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82341:ecb5a8d71071
Date: 2016-02-20 12:41 +0100
http://bitbucket.org/pypy/pypy/changeset/ecb5a8d71071/

Log:Kill LLSupport from rpython/rtyper/module/support.py.

diff --git a/rpython/jit/metainterp/test/test_tlc.py 
b/rpython/jit/metainterp/test/test_tlc.py
--- a/rpython/jit/metainterp/test/test_tlc.py
+++ b/rpython/jit/metainterp/test/test_tlc.py
@@ -1,5 +1,4 @@
 import py
-from rpython.rtyper.module.support import LLSupport
 
 from rpython.jit.tl import tlc
 
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
@@ -8,42 +8,6 @@
 _WIN32 = sys.platform.startswith('win')
 UNDERSCORE_ON_WIN32 = '_' if _WIN32 else ''
 
-# utility conversion functions
-class LLSupport:
-_mixin_ = True
-
-def to_rstr(s):
-from rpython.rtyper.lltypesystem.rstr import STR, mallocstr
-if s is None:
-return lltype.nullptr(STR)
-p = mallocstr(len(s))
-for i in range(len(s)):
-p.chars[i] = s[i]
-return p
-to_rstr = staticmethod(to_rstr)
-
-def to_runicode(s):
-from rpython.rtyper.lltypesystem.rstr import UNICODE, mallocunicode
-if s is None:
-return lltype.nullptr(UNICODE)
-p = mallocunicode(len(s))
-for i in range(len(s)):
-p.chars[i] = s[i]
-return p
-to_runicode = staticmethod(to_runicode)
-
-def from_rstr(rs):
-if not rs:   # null pointer
-return None
-else:
-return ''.join([rs.chars[i] for i in range(len(rs.chars))])
-from_rstr = staticmethod(from_rstr)
-
-def from_rstr_nonnull(rs):
-assert rs
-return ''.join([rs.chars[i] for i in range(len(rs.chars))])
-from_rstr_nonnull = staticmethod(from_rstr_nonnull)
-
 
 class StringTraits:
 str = str
diff --git a/rpython/rtyper/test/tool.py b/rpython/rtyper/test/tool.py
--- a/rpython/rtyper/test/tool.py
+++ b/rpython/rtyper/test/tool.py
@@ -46,12 +46,22 @@
 return u''.join(s.chars)
 
 def string_to_ll(self, s):
-from rpython.rtyper.module.support import LLSupport
-return LLSupport.to_rstr(s)
+from rpython.rtyper.lltypesystem.rstr import STR, mallocstr
+if s is None:
+return lltype.nullptr(STR)
+p = mallocstr(len(s))
+for i in range(len(s)):
+p.chars[i] = s[i]
+return p
 
 def unicode_to_ll(self, s):
-from rpython.rtyper.module.support import LLSupport
-return LLSupport.to_runicode(s)
+from rpython.rtyper.lltypesystem.rstr import UNICODE, mallocunicode
+if s is None:
+return lltype.nullptr(UNICODE)
+p = mallocunicode(len(s))
+for i in range(len(s)):
+p.chars[i] = s[i]
+return p
 
 def ll_to_list(self, l):
 r = []
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Kill rpython/rtyper/module/support.py.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82343:92e0c2d63e6f
Date: 2016-02-20 13:00 +0100
http://bitbucket.org/pypy/pypy/changeset/92e0c2d63e6f/

Log:Kill rpython/rtyper/module/support.py.

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
@@ -6,8 +6,8 @@
 from rpython.translator import cdir
 from rpython.rlib import jit, rposix
 from rpython.rlib.rfloat import INFINITY, NAN, isfinite, isinf, isnan
+from rpython.rlib.rposix import UNDERSCORE_ON_WIN32
 from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rtyper.module.support import UNDERSCORE_ON_WIN32
 from rpython.tool.sourcetools import func_with_new_name
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import platform
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
@@ -11,12 +11,12 @@
 from rpython.rtyper.lltypesystem.ll2ctypes import _llgcopaque
 from rpython.rtyper.annlowlevel import llhelper
 from rpython.rlib import rposix
+from rpython.rlib.rposix import UNDERSCORE_ON_WIN32
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator import cdir
 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
diff --git a/rpython/rtyper/module/support.py b/rpython/rtyper/module/support.py
deleted file mode 100644
--- a/rpython/rtyper/module/support.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import sys
-
-from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rlib.objectmodel import specialize
-from rpython.rlib import rstring
-
-_WIN32 = sys.platform.startswith('win')
-UNDERSCORE_ON_WIN32 = '_' if _WIN32 else ''
-
-def ll_strcpy(dst_s, src_s, n):
-dstchars = dst_s.chars
-srcchars = src_s.chars
-i = 0
-while i < n:
-dstchars[i] = srcchars[i]
-i += 1
-
-def _ll_strfill(dst_s, srcchars, n):
-dstchars = dst_s.chars
-i = 0
-while i < n:
-dstchars[i] = srcchars[i]
-i += 1
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Move rpython/rtyper/module/test/test_posix.py to rpython/rlib/test/test_posix.py.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82345:3382e5a65bd7
Date: 2016-02-20 13:28 +0100
http://bitbucket.org/pypy/pypy/changeset/3382e5a65bd7/

Log:Move rpython/rtyper/module/test/test_posix.py to
rpython/rlib/test/test_posix.py.

diff --git a/rpython/rtyper/module/test/test_posix.py 
b/rpython/rlib/test/test_posix.py
rename from rpython/rtyper/module/test/test_posix.py
rename to rpython/rlib/test/test_posix.py
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Kill empty python/rtyper/module.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82346:a7d549957c0a
Date: 2016-02-20 13:29 +0100
http://bitbucket.org/pypy/pypy/changeset/a7d549957c0a/

Log:Kill empty python/rtyper/module.

diff --git a/rpython/rtyper/module/__init__.py 
b/rpython/rtyper/module/__init__.py
deleted file mode 100644
--- a/rpython/rtyper/module/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-#
diff --git a/rpython/rtyper/module/test/__init__.py 
b/rpython/rtyper/module/test/__init__.py
deleted file mode 100644
--- a/rpython/rtyper/module/test/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-#
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Remove some outdated entries from .hgignore.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82347:90c52cca5101
Date: 2016-02-20 14:18 +0100
http://bitbucket.org/pypy/pypy/changeset/90c52cca5101/

Log:Remove some outdated entries from .hgignore.

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -22,6 +22,7 @@
 ^pypy/module/cpyext/test/.+\.obj$
 ^pypy/module/cpyext/test/.+\.manifest$
 ^pypy/module/test_lib_pypy/ctypes_tests/.+\.o$
+^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^pypy/module/cppyy/src/.+\.o$
 ^pypy/module/cppyy/bench/.+\.so$
 ^pypy/module/cppyy/bench/.+\.root$
@@ -35,7 +36,6 @@
 ^pypy/module/test_lib_pypy/cffi_tests/__pycache__.+$
 ^pypy/doc/.+\.html$
 ^pypy/doc/config/.+\.rst$
-^pypy/doc/basicblock\.asc$
 ^pypy/doc/.+\.svninfo$
 ^rpython/translator/c/src/libffi_msvc/.+\.obj$
 ^rpython/translator/c/src/libffi_msvc/.+\.dll$
@@ -45,55 +45,33 @@
 ^rpython/translator/c/src/cjkcodecs/.+\.obj$
 ^rpython/translator/c/src/stacklet/.+\.o$
 ^rpython/translator/c/src/.+\.o$
-^rpython/translator/jvm/\.project$
-^rpython/translator/jvm/\.classpath$
-^rpython/translator/jvm/eclipse-bin$
-^rpython/translator/jvm/src/pypy/.+\.class$
 ^rpython/translator/llvm/.+\.so$
-^rpython/translator/benchmark/docutils$
-^rpython/translator/benchmark/templess$
-^rpython/translator/benchmark/gadfly$
-^rpython/translator/benchmark/mako$
-^rpython/translator/benchmark/bench-custom\.benchmark_result$
-^rpython/translator/benchmark/shootout_benchmarks$
 ^rpython/translator/goal/target.+-c$
 ^rpython/translator/goal/.+\.exe$
 ^rpython/translator/goal/.+\.dll$
 ^pypy/goal/pypy-translation-snapshot$
 ^pypy/goal/pypy-c
-^pypy/goal/pypy-jvm
-^pypy/goal/pypy-jvm.jar
 ^pypy/goal/.+\.exe$
 ^pypy/goal/.+\.dll$
 ^pypy/goal/.+\.lib$
 ^pypy/_cache$
-^pypy/doc/statistic/.+\.html$
-^pypy/doc/statistic/.+\.eps$
-^pypy/doc/statistic/.+\.pdf$
-^rpython/translator/cli/src/pypylib\.dll$
-^rpython/translator/cli/src/query\.exe$
-^rpython/translator/cli/src/main\.exe$
 ^lib-python/2.7/lib2to3/.+\.pickle$
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
 ^lib_pypy/_libmpdec/.+.o$
-^rpython/translator/cli/query-descriptions$
 ^pypy/doc/discussion/.+\.html$
 ^include/.+\.h$
 ^include/.+\.inl$
 ^pypy/doc/_build/.*$
 ^pypy/doc/config/.+\.html$
 ^pypy/doc/config/style\.css$
-^pypy/doc/jit/.+\.html$
-^pypy/doc/jit/style\.css$
 ^pypy/doc/image/lattice1\.png$
 ^pypy/doc/image/lattice2\.png$
 ^pypy/doc/image/lattice3\.png$
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
 ^rpython/doc/_build/.*$
-^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^compiled
 ^.git/
 ^release/
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fix.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82348:0f32b277e2ec
Date: 2016-02-20 23:22 +0100
http://bitbucket.org/pypy/pypy/changeset/0f32b277e2ec/

Log:Fix.

diff --git a/rpython/rtyper/test/test_rfloat.py 
b/rpython/rtyper/test/test_rfloat.py
--- a/rpython/rtyper/test/test_rfloat.py
+++ b/rpython/rtyper/test/test_rfloat.py
@@ -205,6 +205,7 @@
 assert res == '3.33'
 
 def test_formatd_g(self):
+from rpython.rlib import rfloat
 for flags in [0, rfloat.DTSF_ADD_DOT_0]:
 def f(y):
 return rfloat.formatd(y, 'g', 2, flags)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Convert BaseRtypingTest methods to staticmethods / classmethods to make it possible to use them without instantiation of BaseRtypingTest.

2016-02-20 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82349:2244ee1ca7ce
Date: 2016-02-20 23:25 +0100
http://bitbucket.org/pypy/pypy/changeset/2244ee1ca7ce/

Log:Convert BaseRtypingTest methods to staticmethods / classmethods to
make it possible to use them without instantiation of
BaseRtypingTest.

diff --git a/rpython/rtyper/test/test_rpbc.py b/rpython/rtyper/test/test_rpbc.py
--- a/rpython/rtyper/test/test_rpbc.py
+++ b/rpython/rtyper/test/test_rpbc.py
@@ -1945,7 +1945,7 @@
 
 def interpret(self, fn, args, **kwds):
 kwds['config'] = self.config
-return TestRPBC.interpret(self, fn, args, **kwds)
+return TestRPBC.interpret(fn, args, **kwds)
 
 def test_smallfuncsets_basic():
 from rpython.translator.translator import TranslationContext, graphof
diff --git a/rpython/rtyper/test/tool.py b/rpython/rtyper/test/tool.py
--- a/rpython/rtyper/test/tool.py
+++ b/rpython/rtyper/test/tool.py
@@ -5,22 +5,27 @@
 class BaseRtypingTest(object):
 FLOAT_PRECISION = 8
 
-def gengraph(self, func, argtypes=[], viewbefore='auto', policy=None,
+@staticmethod
+def gengraph(func, argtypes=[], viewbefore='auto', policy=None,
  backendopt=False, config=None):
 return gengraph(func, argtypes, viewbefore, policy,
 backendopt=backendopt, config=config)
 
-def interpret(self, fn, args, **kwds):
+@staticmethod
+def interpret(fn, args, **kwds):
 return interpret(fn, args, **kwds)
 
-def interpret_raises(self, exc, fn, args, **kwds):
+@staticmethod
+def interpret_raises(exc, fn, args, **kwds):
 return interpret_raises(exc, fn, args, **kwds)
 
-def float_eq(self, x, y):
+@staticmethod
+def float_eq(x, y):
 return x == y
 
-def float_eq_approx(self, x, y):
-maxError = 10**-self.FLOAT_PRECISION
+@classmethod
+def float_eq_approx(cls, x, y):
+maxError = 10**-cls.FLOAT_PRECISION
 if abs(x-y) < maxError:
 return True
 
@@ -31,21 +36,26 @@
 
 return relativeError < maxError
 
-def is_of_type(self, x, type_):
+@staticmethod
+def is_of_type(x, type_):
 return type(x) is type_
 
-def _skip_llinterpreter(self, reason):
+@staticmethod
+def _skip_llinterpreter(reason):
 py.test.skip("lltypesystem doesn't support %s, yet" % reason)
 
-def ll_to_string(self, s):
+@staticmethod
+def ll_to_string(s):
 if not s:
 return None
 return ''.join(s.chars)
 
-def ll_to_unicode(self, s):
+@staticmethod
+def ll_to_unicode(s):
 return u''.join(s.chars)
 
-def string_to_ll(self, s):
+@staticmethod
+def string_to_ll(s):
 from rpython.rtyper.lltypesystem.rstr import STR, mallocstr
 if s is None:
 return lltype.nullptr(STR)
@@ -54,7 +64,8 @@
 p.chars[i] = s[i]
 return p
 
-def unicode_to_ll(self, s):
+@staticmethod
+def unicode_to_ll(s):
 from rpython.rtyper.lltypesystem.rstr import UNICODE, mallocunicode
 if s is None:
 return lltype.nullptr(UNICODE)
@@ -63,23 +74,28 @@
 p.chars[i] = s[i]
 return p
 
-def ll_to_list(self, l):
+@staticmethod
+def ll_to_list(l):
 r = []
 items = l.ll_items()
 for i in range(l.ll_length()):
 r.append(items[i])
 return r
 
-def ll_unpack_tuple(self, t, length):
+@staticmethod
+def ll_unpack_tuple(t, length):
 return tuple([getattr(t, 'item%d' % i) for i in range(length)])
 
-def get_callable(self, fnptr):
+@staticmethod
+def get_callable(fnptr):
 return fnptr._obj._callable
 
-def class_name(self, value):
+@staticmethod
+def class_name(value):
 return ''.join(value.super.typeptr.name.chars)
 
-def read_attr(self, value, attr_name):
+@staticmethod
+def read_attr(value, attr_name):
 value = value._obj
 while value is not None:
 attr = getattr(value, "inst_" + attr_name, None)
@@ -89,6 +105,7 @@
 return attr
 raise AttributeError()
 
-def is_of_instance_type(self, val):
+@staticmethod
+def is_of_instance_type(val):
 T = lltype.typeOf(val)
 return isinstance(T, lltype.Ptr) and isinstance(T.TO, lltype.GcStruct)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fix.

2016-02-21 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82351:73de30973361
Date: 2016-02-21 10:52 +0100
http://bitbucket.org/pypy/pypy/changeset/73de30973361/

Log:Fix.

diff --git a/rpython/rlib/test/test_rerased.py 
b/rpython/rlib/test/test_rerased.py
--- a/rpython/rlib/test/test_rerased.py
+++ b/rpython/rlib/test/test_rerased.py
@@ -192,7 +192,7 @@
 
 def interpret(self, *args, **kwargs):
 kwargs["taggedpointers"] = True
-return BaseRtypingTest.interpret(self, *args, **kwargs)
+return BaseRtypingTest.interpret(*args, **kwargs)
 def test_rtype_1(self):
 def f():
 return eraseX(X())
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: hg merge py3k

2016-02-21 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82381:9234b0c20972
Date: 2016-02-22 02:05 +0100
http://bitbucket.org/pypy/pypy/changeset/9234b0c20972/

Log:hg merge py3k

diff --git a/pypy/interpreter/pyparser/pytokenizer.py 
b/pypy/interpreter/pyparser/pytokenizer.py
--- a/pypy/interpreter/pyparser/pytokenizer.py
+++ b/pypy/interpreter/pyparser/pytokenizer.py
@@ -298,14 +298,13 @@
 token_list.append((tokens.ENDMARKER, '', lnum, pos, line))
 return token_list
 
+
 def universal_newline(line):
-if len(line) >= 2:
-c0 = line[-2]
-c1 = line[-1]
-if c0 == '\r' and c1 == '\n':
-return line[:-2] + '\n'
-if len(line) >= 1:
-c = line[-1]
-if c == '\r':
-return line[:-1] + '\n'
+# show annotator that indexes below are non-negative
+line_len_m2 = len(line) - 2
+if line_len_m2 >= 0 and line[-2] == '\r' and line[-1] == '\n':
+return line[:line_len_m2] + '\n'
+line_len_m1 = len(line) - 1
+if line_len_m1 >= 0 and line[-1] == '\r':
+return line[:line_len_m1] + '\n'
 return line
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: hg merge default

2016-02-21 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82380:688a132b06b6
Date: 2016-02-22 02:04 +0100
http://bitbucket.org/pypy/pypy/changeset/688a132b06b6/

Log:hg merge default

diff --git a/pypy/interpreter/pyparser/pytokenizer.py 
b/pypy/interpreter/pyparser/pytokenizer.py
--- a/pypy/interpreter/pyparser/pytokenizer.py
+++ b/pypy/interpreter/pyparser/pytokenizer.py
@@ -298,14 +298,13 @@
 token_list.append((tokens.ENDMARKER, '', lnum, pos, line))
 return token_list
 
+
 def universal_newline(line):
-if len(line) >= 2:
-c0 = line[-2]
-c1 = line[-1]
-if c0 == '\r' and c1 == '\n':
-return line[:-2] + '\n'
-if len(line) >= 1:
-c = line[-1]
-if c == '\r':
-return line[:-1] + '\n'
+# show annotator that indexes below are non-negative
+line_len_m2 = len(line) - 2
+if line_len_m2 >= 0 and line[-2] == '\r' and line[-1] == '\n':
+return line[:line_len_m2] + '\n'
+line_len_m1 = len(line) - 1
+if line_len_m1 >= 0 and line[-1] == '\r':
+return line[:line_len_m1] + '\n'
 return line
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fix translation.

2016-02-21 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82379:337c536c54c1
Date: 2016-02-22 02:04 +0100
http://bitbucket.org/pypy/pypy/changeset/337c536c54c1/

Log:Fix translation.

diff --git a/pypy/interpreter/pyparser/pytokenizer.py 
b/pypy/interpreter/pyparser/pytokenizer.py
--- a/pypy/interpreter/pyparser/pytokenizer.py
+++ b/pypy/interpreter/pyparser/pytokenizer.py
@@ -261,14 +261,13 @@
 token_list.append((tokens.ENDMARKER, '', lnum, pos, line))
 return token_list
 
+
 def universal_newline(line):
-if len(line) >= 2:
-c0 = line[-2]
-c1 = line[-1]
-if c0 == '\r' and c1 == '\n':
-return line[:-2] + '\n'
-if len(line) >= 1:
-c = line[-1]
-if c == '\r':
-return line[:-1] + '\n'
+# show annotator that indexes below are non-negative
+line_len_m2 = len(line) - 2
+if line_len_m2 >= 0 and line[-2] == '\r' and line[-1] == '\n':
+return line[:line_len_m2] + '\n'
+line_len_m1 = len(line) - 1
+if line_len_m1 >= 0 and line[-1] == '\r':
+return line[:line_len_m1] + '\n'
 return line
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Remove unneeded and broken hack.

2016-02-22 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82392:9b79c1399d57
Date: 2016-02-22 16:36 +0100
http://bitbucket.org/pypy/pypy/changeset/9b79c1399d57/

Log:Remove unneeded and broken hack.

For some reason the hack resulted in later tests failing (e.g.
AppTestUnicodeFormat.test_oldstyle_custom_format()).

diff --git a/pypy/objspace/std/test/test_iterobject.py 
b/pypy/objspace/std/test/test_iterobject.py
--- a/pypy/objspace/std/test/test_iterobject.py
+++ b/pypy/objspace/std/test/test_iterobject.py
@@ -91,8 +91,6 @@
 raises(TypeError, len, iter(iterable))
 
 def test_no_len_on_UserList_iter_reversed(self):
-import sys, collections.abc
-sys.modules['collections'] = collections.abc
 class UserList(object):
 def __init__(self, i):
 self.i = i
@@ -101,7 +99,6 @@
 iterable = UserList([1,2,3,4])
 raises(TypeError, len, iter(iterable))
 raises(TypeError, reversed, iterable)
-del sys.modules['collections']
 
 def test_no_len_on_UserList_reversed(self):
 iterable = [1,2,3,4]
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: cpyext: Add defines for PyExc_OSError aliases.

2016-02-22 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82397:573e529840d7
Date: 2016-02-22 17:12 +0100
http://bitbucket.org/pypy/pypy/changeset/573e529840d7/

Log:cpyext: Add defines for PyExc_OSError aliases.

diff --git a/pypy/module/cpyext/include/Python.h 
b/pypy/module/cpyext/include/Python.h
--- a/pypy/module/cpyext/include/Python.h
+++ b/pypy/module/cpyext/include/Python.h
@@ -80,6 +80,11 @@
 
 #include 
 
+#define PyExc_EnvironmentError PyExc_OSError
+#define PyExc_IOError PyExc_OSError
+// TODO: fix windows support
+// #define PyExc_WindowsError PyExc_OSError
+
 #include "patchlevel.h"
 #include "pyconfig.h"
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Fix test by testing with a less commonly used module.

2016-02-22 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82411:9a5c6a749b49
Date: 2016-02-22 23:27 +0100
http://bitbucket.org/pypy/pypy/changeset/9a5c6a749b49/

Log:Fix test by testing with a less commonly used module.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1061,12 +1061,12 @@
 py.test.skip("unresolved issues with win32 shell quoting rules")
 from pypy.interpreter.test.test_zpy import pypypath 
 extrapath = udir.ensure("pythonpath", dir=1) 
-extrapath.join("urllib.py").write("print 42\n")
+extrapath.join("sched.py").write("print 42\n")
 old = os.environ.get('PYTHONPATH', None)
 oldlang = os.environ.pop('LANG', None)
 try:
 os.environ['PYTHONPATH'] = str(extrapath)
-output = py.process.cmdexec('''"%s" "%s" -c "import urllib"''' %
+output = py.process.cmdexec('''"%s" "%s" -c "import sched"''' %
  (sys.executable, pypypath))
 assert output.strip() == '42'
 finally:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: hg merge default

2016-02-22 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82412:be90c2e77207
Date: 2016-02-22 23:36 +0100
http://bitbucket.org/pypy/pypy/changeset/be90c2e77207/

Log:hg 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
@@ -128,6 +128,7 @@
 
 Fix SSL tests by importing cpython's patch
 
+
 .. branch: remove-getfield-pure
 
 Remove pure variants of ``getfield_gc_*`` operations from the JIT. Relevant
@@ -163,3 +164,10 @@
 .. branch: windows-vmprof-support
 
 vmprof should work on Windows.
+
+
+.. branch: reorder-map-attributes
+
+When creating instances and adding attributes in several different orders
+depending on some condition, the JIT would create too much code. This is now
+fixed.
\ No newline at end of file
diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1216,12 +1216,12 @@
 py.test.skip("unresolved issues with win32 shell quoting rules")
 from pypy.interpreter.test.test_zpy import pypypath 
 extrapath = udir.ensure("pythonpath", dir=1) 
-extrapath.join("urllib.py").write("print(42)\n")
+extrapath.join("sched.py").write("print(42)\n")
 old = os.environ.get('PYTHONPATH', None)
 oldlang = os.environ.pop('LANG', None)
 try:
 os.environ['PYTHONPATH'] = str(extrapath)
-output = py.process.cmdexec('''"%s" "%s" -c "import urllib"''' %
+output = py.process.cmdexec('''"%s" "%s" -c "import sched"''' %
  (sys.executable, pypypath))
 assert output.strip() == '42'
 finally:
diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py 
b/pypy/module/pypyjit/test_pypy_c/test_string.py
--- a/pypy/module/pypyjit/test_pypy_c/test_string.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_string.py
@@ -28,7 +28,6 @@
 guard_true(i14, descr=...)
 guard_not_invalidated(descr=...)
 i16 = int_eq(i6, %d)
-guard_false(i16, descr=...)
 i15 = int_mod(i6, i10)
 i17 = int_rshift(i15, %d)
 i18 = int_and(i10, i17)
@@ -68,7 +67,6 @@
 guard_true(i11, descr=...)
 guard_not_invalidated(descr=...)
 i13 = int_eq(i6, %d) # value provided below
-guard_false(i13, descr=...)
 i15 = int_mod(i6, 10)
 i17 = int_rshift(i15, %d)# value provided below
 i18 = int_and(10, i17)
@@ -144,43 +142,6 @@
 jump(..., descr=...)
 """)
 
-def test_getattr_promote(self):
-def main(n):
-class A(object):
-def meth_a(self):
-return 1
-def meth_b(self):
-return 2
-a = A()
-
-l = ['a', 'b']
-s = 0
-for i in range(n):
-name = 'meth_' + l[i & 1]
-meth = getattr(a, name) # ID: getattr
-s += meth()
-return s
-
-log = self.run(main, [1000])
-assert log.result == main(1000)
-loops = log.loops_by_filename(self.filepath)
-assert len(loops) == 1
-for loop in loops:
-assert loop.match_by_id('getattr','''
-guard_not_invalidated?
-i32 = strlen(p31)
-i34 = int_add(5, i32)
-p35 = newstr(i34)
-strsetitem(p35, 0, 109)
-strsetitem(p35, 1, 101)
-strsetitem(p35, 2, 116)
-strsetitem(p35, 3, 104)
-strsetitem(p35, 4, 95)
-copystrcontent(p31, p35, 0, 5, i32)
-i49 = 
call_i(ConstClass(_ll_2_str_eq_nonnull__rpy_stringPtr_rpy_stringPtr), p35, 
ConstPtr(ptr48), descr=)
-guard_value(i49, 1, descr=...)
-''')
-
 def test_remove_duplicate_method_calls(self):
 def main(n):
 lst = []
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -1,4 +1,4 @@
-import weakref
+import weakref, sys
 
 from rpython.rlib import jit, objectmodel, debug, rerased
 from rpython.rlib.rarithmetic import intmask, r_uint
@@ -12,6 +12,11 @@
 from pypy.objspace.std.typeobject import MutableCell
 
 
+erase_item, unerase_item = rerased.new_erasing_pair("mapdict storage item")
+erase_map,  unerase_map = rerased.new_erasing_pair("map")
+erase_list, unerase_list = rerased.new_erasing_pair("mapdict storage list")
+
+
 # 
 # attribute shapes
 
@@ -20,6 +25,7 @@
 # note: we use "x * NUM_DIGITS_POW2" instead of "x << NUM_DIGITS" because
 # we want to propagate knowledge that the result cannot be negative
 
+
 class AbstractAttribute(object):
 _immutable_fields_ = ['terminator']
 cache_attrs = None
@@ -151,29 +157,124 @@
 cache[na

[pypy-commit] pypy py3.3: hg merge py3k

2016-02-22 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82413:6107f05ecc93
Date: 2016-02-22 23:37 +0100
http://bitbucket.org/pypy/pypy/changeset/6107f05ecc93/

Log:hg merge py3k

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
@@ -128,6 +128,7 @@
 
 Fix SSL tests by importing cpython's patch
 
+
 .. branch: remove-getfield-pure
 
 Remove pure variants of ``getfield_gc_*`` operations from the JIT. Relevant
@@ -163,3 +164,10 @@
 .. branch: windows-vmprof-support
 
 vmprof should work on Windows.
+
+
+.. branch: reorder-map-attributes
+
+When creating instances and adding attributes in several different orders
+depending on some condition, the JIT would create too much code. This is now
+fixed.
\ No newline at end of file
diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -992,12 +992,12 @@
 py.test.skip("unresolved issues with win32 shell quoting rules")
 from pypy.interpreter.test.test_zpy import pypypath 
 extrapath = udir.ensure("pythonpath", dir=1) 
-extrapath.join("urllib.py").write("print(42)\n")
+extrapath.join("sched.py").write("print(42)\n")
 old = os.environ.get('PYTHONPATH', None)
 oldlang = os.environ.pop('LANG', None)
 try:
 os.environ['PYTHONPATH'] = str(extrapath)
-output = py.process.cmdexec('''"%s" "%s" -c "import urllib"''' %
+output = py.process.cmdexec('''"%s" "%s" -c "import sched"''' %
  (sys.executable, pypypath))
 assert output.strip() == '42'
 finally:
diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py 
b/pypy/module/pypyjit/test_pypy_c/test_string.py
--- a/pypy/module/pypyjit/test_pypy_c/test_string.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_string.py
@@ -28,7 +28,6 @@
 guard_true(i14, descr=...)
 guard_not_invalidated(descr=...)
 i16 = int_eq(i6, %d)
-guard_false(i16, descr=...)
 i15 = int_mod(i6, i10)
 i17 = int_rshift(i15, %d)
 i18 = int_and(i10, i17)
@@ -68,7 +67,6 @@
 guard_true(i11, descr=...)
 guard_not_invalidated(descr=...)
 i13 = int_eq(i6, %d) # value provided below
-guard_false(i13, descr=...)
 i15 = int_mod(i6, 10)
 i17 = int_rshift(i15, %d)# value provided below
 i18 = int_and(10, i17)
@@ -144,43 +142,6 @@
 jump(..., descr=...)
 """)
 
-def test_getattr_promote(self):
-def main(n):
-class A(object):
-def meth_a(self):
-return 1
-def meth_b(self):
-return 2
-a = A()
-
-l = ['a', 'b']
-s = 0
-for i in range(n):
-name = 'meth_' + l[i & 1]
-meth = getattr(a, name) # ID: getattr
-s += meth()
-return s
-
-log = self.run(main, [1000])
-assert log.result == main(1000)
-loops = log.loops_by_filename(self.filepath)
-assert len(loops) == 1
-for loop in loops:
-assert loop.match_by_id('getattr','''
-guard_not_invalidated?
-i32 = strlen(p31)
-i34 = int_add(5, i32)
-p35 = newstr(i34)
-strsetitem(p35, 0, 109)
-strsetitem(p35, 1, 101)
-strsetitem(p35, 2, 116)
-strsetitem(p35, 3, 104)
-strsetitem(p35, 4, 95)
-copystrcontent(p31, p35, 0, 5, i32)
-i49 = 
call_i(ConstClass(_ll_2_str_eq_nonnull__rpy_stringPtr_rpy_stringPtr), p35, 
ConstPtr(ptr48), descr=)
-guard_value(i49, 1, descr=...)
-''')
-
 def test_remove_duplicate_method_calls(self):
 def main(n):
 lst = []
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -1,4 +1,4 @@
-import weakref
+import weakref, sys
 
 from rpython.rlib import jit, objectmodel, debug, rerased
 from rpython.rlib.rarithmetic import intmask, r_uint
@@ -12,6 +12,11 @@
 from pypy.objspace.std.typeobject import MutableCell
 
 
+erase_item, unerase_item = rerased.new_erasing_pair("mapdict storage item")
+erase_map,  unerase_map = rerased.new_erasing_pair("map")
+erase_list, unerase_list = rerased.new_erasing_pair("mapdict storage list")
+
+
 # 
 # attribute shapes
 
@@ -20,6 +25,7 @@
 # note: we use "x * NUM_DIGITS_POW2" instead of "x << NUM_DIGITS" because
 # we want to propagate knowledge that the result cannot be negative
 
+
 class AbstractAttribute(object):
 _immutable_fields_ = ['terminator']
 cache_attrs = None
@@ -151,29 +157,124 @@
 cache[name, 

[pypy-commit] pypy default: Kill rpython -> pypy import in a test which is skipped anyway.

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82416:f3c9014fe2c7
Date: 2016-02-23 10:14 +0100
http://bitbucket.org/pypy/pypy/changeset/f3c9014fe2c7/

Log:Kill rpython -> pypy import in a test which is skipped anyway.

diff --git a/rpython/jit/backend/ppc/test/test_runner.py 
b/rpython/jit/backend/ppc/test/test_runner.py
--- a/rpython/jit/backend/ppc/test/test_runner.py
+++ b/rpython/jit/backend/ppc/test/test_runner.py
@@ -134,7 +134,7 @@
 
 def test_debugger_on(self):
 py.test.skip("XXX")
-from pypy.rlib import debug
+from rpython.rlib import debug
 
 targettoken, preambletoken = TargetToken(), TargetToken()
 loop = """
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Kill unused posix_function_name() method.

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82429:b6338ee2fffb
Date: 2016-02-23 11:51 +0100
http://bitbucket.org/pypy/pypy/changeset/b6338ee2fffb/

Log:Kill unused posix_function_name() method.

diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -355,10 +355,6 @@
 scoped_alloc_buffer = staticmethod(rffi.scoped_alloc_buffer)
 
 @staticmethod
-def posix_function_name(name):
-return UNDERSCORE_ON_WIN32 + name
-
-@staticmethod
 def ll_os_name(name):
 return 'll_os.ll_os_' + name
 
@@ -397,10 +393,6 @@
 scoped_alloc_buffer = staticmethod(rffi.scoped_alloc_unicodebuffer)
 
 @staticmethod
-def posix_function_name(name):
-return UNDERSCORE_ON_WIN32 + 'w' + name
-
-@staticmethod
 @specialize.argtype(0)
 def ll_os_name(name):
 return 'll_os.ll_os_w' + name
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Kill unused ll_os_name() method.

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82430:a70ddbff44ec
Date: 2016-02-23 11:55 +0100
http://bitbucket.org/pypy/pypy/changeset/a70ddbff44ec/

Log:Kill unused ll_os_name() method.

diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -355,10 +355,6 @@
 scoped_alloc_buffer = staticmethod(rffi.scoped_alloc_buffer)
 
 @staticmethod
-def ll_os_name(name):
-return 'll_os.ll_os_' + name
-
-@staticmethod
 @specialize.argtype(0)
 def as_str(path):
 assert path is not None
@@ -394,11 +390,6 @@
 
 @staticmethod
 @specialize.argtype(0)
-def ll_os_name(name):
-return 'll_os.ll_os_w' + name
-
-@staticmethod
-@specialize.argtype(0)
 def as_str(path):
 assert path is not None
 if isinstance(path, unicode):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Try to fix an import cycle on Windows.

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82431:0116c45060a7
Date: 2016-02-23 12:50 +0100
http://bitbucket.org/pypy/pypy/changeset/0116c45060a7/

Log:Try to fix an import cycle on Windows.

diff --git a/rpython/rlib/_os_support.py b/rpython/rlib/_os_support.py
new file mode 100644
--- /dev/null
+++ b/rpython/rlib/_os_support.py
@@ -0,0 +1,109 @@
+import sys
+
+from rpython.annotator.model import s_Str0, s_Unicode0
+from rpython.rlib import rstring
+from rpython.rlib.objectmodel import specialize
+from rpython.rtyper.lltypesystem import rffi
+
+
+_CYGWIN = sys.platform == 'cygwin'
+_WIN32 = sys.platform.startswith('win')
+UNDERSCORE_ON_WIN32 = '_' if _WIN32 else ''
+_MACRO_ON_POSIX = True if not _WIN32 else None
+
+
+class StringTraits(object):
+str = str
+str0 = s_Str0
+CHAR = rffi.CHAR
+CCHARP = rffi.CCHARP
+charp2str = staticmethod(rffi.charp2str)
+charpsize2str = staticmethod(rffi.charpsize2str)
+scoped_str2charp = staticmethod(rffi.scoped_str2charp)
+str2charp = staticmethod(rffi.str2charp)
+free_charp = staticmethod(rffi.free_charp)
+scoped_alloc_buffer = staticmethod(rffi.scoped_alloc_buffer)
+
+@staticmethod
+@specialize.argtype(0)
+def as_str(path):
+assert path is not None
+if isinstance(path, str):
+return path
+elif isinstance(path, unicode):
+# This never happens in PyPy's Python interpreter!
+# Only in raw RPython code that uses unicode strings.
+# We implement python2 behavior: silently convert to ascii.
+return path.encode('ascii')
+else:
+return path.as_bytes()
+
+@staticmethod
+@specialize.argtype(0)
+def as_str0(path):
+res = StringTraits.as_str(path)
+rstring.check_str0(res)
+return res
+
+
+class UnicodeTraits(object):
+str = unicode
+str0 = s_Unicode0
+CHAR = rffi.WCHAR_T
+CCHARP = rffi.CWCHARP
+charp2str = staticmethod(rffi.wcharp2unicode)
+charpsize2str = staticmethod(rffi.wcharpsize2unicode)
+str2charp = staticmethod(rffi.unicode2wcharp)
+scoped_str2charp = staticmethod(rffi.scoped_unicode2wcharp)
+free_charp = staticmethod(rffi.free_wcharp)
+scoped_alloc_buffer = staticmethod(rffi.scoped_alloc_unicodebuffer)
+
+@staticmethod
+@specialize.argtype(0)
+def as_str(path):
+assert path is not None
+if isinstance(path, unicode):
+return path
+else:
+return path.as_unicode()
+
+@staticmethod
+@specialize.argtype(0)
+def as_str0(path):
+res = UnicodeTraits.as_str(path)
+rstring.check_str0(res)
+return res
+
+
+string_traits = StringTraits()
+unicode_traits = UnicodeTraits()
+
+
+# Returns True when the unicode function should be called:
+# - on Windows
+# - if the path is Unicode.
+if _WIN32:
+@specialize.argtype(0)
+def _prefer_unicode(path):
+assert path is not None
+if isinstance(path, str):
+return False
+elif isinstance(path, unicode):
+return True
+else:
+return path.is_unicode
+
+@specialize.argtype(0)
+def _preferred_traits(path):
+if _prefer_unicode(path):
+return unicode_traits
+else:
+return string_traits
+else:
+@specialize.argtype(0)
+def _prefer_unicode(path):
+return False
+
+@specialize.argtype(0)
+def _preferred_traits(path):
+return string_traits
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -1,26 +1,22 @@
 import os
 import sys
 import errno
+from rpython.annotator.model import s_Str0
 from rpython.rtyper.lltypesystem.rffi import CConstant, CExternVariable, INT
 from rpython.rtyper.lltypesystem import lltype, ll2ctypes, rffi
 from rpython.rtyper.tool import rffi_platform
-from rpython.tool.sourcetools import func_renamer
-from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from rpython.rlib.rarithmetic import intmask, widen
+from rpython.rlib import debug, jit, rstring, rthread, types
+from rpython.rlib._os_support import (
+_CYGWIN, _MACRO_ON_POSIX, UNDERSCORE_ON_WIN32, _WIN32,
+_prefer_unicode, _preferred_traits)
 from rpython.rlib.objectmodel import (
 specialize, enforceargs, register_replacement_for, NOT_CONSTANT)
+from rpython.rlib.rarithmetic import intmask, widen
 from rpython.rlib.signature import signature
-from rpython.rlib import types
-from rpython.annotator.model import s_Str0, s_Unicode0
-from rpython.rlib import jit
+from rpython.tool.sourcetools import func_renamer
 from rpython.translator.platform import platform
-from rpython.rlib import rstring
-from rpython.rlib import debug, rthread
+from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
-_WIN32 = sys.platform.startswith('win')
-_CYGWIN = sys.platform == 'cygwin'
-UNDERSCORE_ON_WIN32 = '_' if _WIN32 else 

[pypy-commit] pypy refactor-translator: Close abandoned branch.

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: refactor-translator
Changeset: r82432:c7df87defdb6
Date: 2016-02-23 12:43 +0100
http://bitbucket.org/pypy/pypy/changeset/c7df87defdb6/

Log:Close abandoned branch.

I tried to achieve too many things at once in this branch. Some of
the ideas might be reused in new, smaller branches.

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy kill-running_on_llinterp: Close superseded branch.

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: kill-running_on_llinterp
Changeset: r82433:3edacc8819f9
Date: 2016-02-23 12:45 +0100
http://bitbucket.org/pypy/pypy/changeset/3edacc8819f9/

Log:Close superseded branch.

The goal of this branch was already achieved in the recent llimpl
branch.

___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: hg merge 0d15dde70904

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82437:3a5862bf62c0
Date: 2016-02-23 14:34 +0100
http://bitbucket.org/pypy/pypy/changeset/3a5862bf62c0/

Log:hg merge 0d15dde70904

diff --git a/rpython/jit/backend/ppc/test/test_runner.py 
b/rpython/jit/backend/ppc/test/test_runner.py
--- a/rpython/jit/backend/ppc/test/test_runner.py
+++ b/rpython/jit/backend/ppc/test/test_runner.py
@@ -134,7 +134,7 @@
 
 def test_debugger_on(self):
 py.test.skip("XXX")
-from pypy.rlib import debug
+from rpython.rlib import debug
 
 targettoken, preambletoken = TargetToken(), TargetToken()
 loop = """
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py 
b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -28,7 +28,7 @@
 # setup rd data
 fi0 = resume.FrameInfo(None, FakeJitCode(), 11)
 snapshot0 = resume.Snapshot(None, [b0])
-op.rd_snapshot = resume.Snapshot(snapshot0, [b1])
+op.rd_snapshot = resume.TopSnapshot(snapshot0, [], [b1])
 op.rd_frame_info_list = resume.FrameInfo(fi0, FakeJitCode(), 33)
 #
 opt.store_final_boxes_in_guard(op, [])
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py 
b/rpython/jit/metainterp/optimizeopt/test/test_util.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_util.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py
@@ -506,14 +506,15 @@
 index = 0
 
 if op.is_guard():
-op.rd_snapshot = resume.Snapshot(None, op.getfailargs())
+op.rd_snapshot = resume.TopSnapshot(
+resume.Snapshot(None, op.getfailargs()), [], [])
 op.rd_frame_info_list = resume.FrameInfo(None, FakeJitCode(), 11)
 
 def add_guard_future_condition(self, res):
 # invent a GUARD_FUTURE_CONDITION to not have to change all tests
 if res.operations[-1].getopnum() == rop.JUMP:
 guard = ResOperation(rop.GUARD_FUTURE_CONDITION, [], None)
-guard.rd_snapshot = resume.Snapshot(None, [])
+guard.rd_snapshot = resume.TopSnapshot(None, [], [])
 res.operations.insert(-1, guard)
 
 def assert_equal(self, optimized, expected, text_right=None):
diff --git a/rpython/jit/metainterp/optimizeopt/util.py 
b/rpython/jit/metainterp/optimizeopt/util.py
--- a/rpython/jit/metainterp/optimizeopt/util.py
+++ b/rpython/jit/metainterp/optimizeopt/util.py
@@ -8,7 +8,7 @@
 from rpython.jit.metainterp import resoperation
 from rpython.rlib.debug import make_sure_not_resized
 from rpython.jit.metainterp.resoperation import rop
-from rpython.jit.metainterp.resume import Snapshot, AccumInfo
+from rpython.jit.metainterp.resume import AccumInfo
 
 # 
 # Misc. utilities
diff --git a/rpython/jit/metainterp/test/strategies.py 
b/rpython/jit/metainterp/test/strategies.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/metainterp/test/strategies.py
@@ -0,0 +1,13 @@
+
+import sys
+from hypothesis import strategies
+from rpython.jit.metainterp.resoperation import InputArgInt
+from rpython.jit.metainterp.history import ConstInt
+
+machine_ints = strategies.integers(min_value=-sys.maxint - 1,
+max_value=sys.maxint)
+intboxes = strategies.builds(InputArgInt)
+intconsts = strategies.builds(ConstInt, machine_ints)
+boxes = intboxes | intconsts
+boxlists = strategies.lists(boxes, min_size=1).flatmap(
+lambda cis: strategies.lists(strategies.sampled_from(cis)))
\ No newline at end of file
diff --git a/rpython/jit/metainterp/test/test_resume.py 
b/rpython/jit/metainterp/test/test_resume.py
--- a/rpython/jit/metainterp/test/test_resume.py
+++ b/rpython/jit/metainterp/test/test_resume.py
@@ -25,6 +25,7 @@
 from rpython.jit.metainterp.test.strategies import boxlists
 from rpython.rlib.debug import debug_start, debug_stop, debug_print,\
  have_debug_prints
+from rpython.jit.metainterp import resumecode
 
 from hypothesis import given
 
@@ -1142,7 +1143,8 @@
 class MyInfo:
 @staticmethod
 def enumerate_vars(callback_i, callback_r, callback_f, _, index):
-for tagged in self.numb.code:
+while index < len(self.numb.code):
+tagged, _ = resumecode.numb_next_item(self.numb, index)
 _, tag = untag(tagged)
 if tag == TAGVIRTUAL:
 kind = REF
@@ -1157,6 +1159,13 @@
 index = callback_f(index, index)
 else:
 assert 0
+size, self.cur_index = resumecode.numb_next_item(self.numb, 0)
+assert size == 0
+size, self.cur_index = resumecode.numb_next_item(self.numb, 
self.cur_index)
+assert size == 0
+pc, self.cur_index = resumecode.numb_next_item(self.numb, 
self.cur_i

[pypy-commit] pypy py3k: hg merge default

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82462:842942cabb34
Date: 2016-02-23 22:26 +0100
http://bitbucket.org/pypy/pypy/changeset/842942cabb34/

Log:hg merge default

diff too long, truncating to 2000 out of 5375 lines

diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -7,6 +7,7 @@
 content = fid.read()
 # from cffi's Verifier()
 key = '\x00'.join([sys.version[:3], content])
+key += 'cpyext-gc-support-2'   # this branch requires recompilation!
 if sys.version_info >= (3,):
 key = key.encode('utf-8')
 k1 = hex(binascii.crc32(key[0::2]) & 0x)
diff --git a/pypy/doc/discussion/rawrefcount.rst 
b/pypy/doc/discussion/rawrefcount.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/discussion/rawrefcount.rst
@@ -0,0 +1,158 @@
+==
+Rawrefcount and the GC
+==
+
+
+GC Interface
+
+
+"PyObject" is a raw structure with at least two fields, ob_refcnt and
+ob_pypy_link.  The ob_refcnt is the reference counter as used on
+CPython.  If the PyObject structure is linked to a live PyPy object,
+its current address is stored in ob_pypy_link and ob_refcnt is bumped
+by either the constant REFCNT_FROM_PYPY, or the constant
+REFCNT_FROM_PYPY_LIGHT (== REFCNT_FROM_PYPY + SOME_HUGE_VALUE)
+(to mean "light finalizer").
+
+Most PyPy objects exist outside cpyext, and conversely in cpyext it is
+possible that a lot of PyObjects exist without being seen by the rest
+of PyPy.  At the interface, however, we can "link" a PyPy object and a
+PyObject.  There are two kinds of link:
+
+rawrefcount.create_link_pypy(p, ob)
+
+Makes a link between an exising object gcref 'p' and a newly
+allocated PyObject structure 'ob'.  ob->ob_refcnt must be
+initialized to either REFCNT_FROM_PYPY, or
+REFCNT_FROM_PYPY_LIGHT.  (The second case is an optimization:
+when the GC finds the PyPy object and PyObject no longer
+referenced, it can just free() the PyObject.)
+
+rawrefcount.create_link_pyobj(p, ob)
+
+Makes a link from an existing PyObject structure 'ob' to a newly
+allocated W_CPyExtPlaceHolderObject 'p'.  You must also add
+REFCNT_FROM_PYPY to ob->ob_refcnt.  For cases where the PyObject
+contains all the data, and the PyPy object is just a proxy.  The
+W_CPyExtPlaceHolderObject should have only a field that contains
+the address of the PyObject, but that's outside the scope of the
+GC.
+
+rawrefcount.from_obj(p)
+
+If there is a link from object 'p' made with create_link_pypy(),
+returns the corresponding 'ob'.  Otherwise, returns NULL.
+
+rawrefcount.to_obj(Class, ob)
+
+Returns ob->ob_pypy_link, cast to an instance of 'Class'.
+
+
+Collection logic
+
+
+Objects existing purely on the C side have ob->ob_pypy_link == 0;
+these are purely reference counted.  On the other hand, if
+ob->ob_pypy_link != 0, then ob->ob_refcnt is at least REFCNT_FROM_PYPY
+and the object is part of a "link".
+
+The idea is that links whose 'p' is not reachable from other PyPy
+objects *and* whose 'ob->ob_refcnt' is REFCNT_FROM_PYPY or
+REFCNT_FROM_PYPY_LIGHT are the ones who die.  But it is more messy
+because PyObjects still (usually) need to have a tp_dealloc called,
+and this cannot occur immediately (and can do random things like
+accessing other references this object points to, or resurrecting the
+object).
+
+Let P = list of links created with rawrefcount.create_link_pypy()
+and O = list of links created with rawrefcount.create_link_pyobj().
+The PyPy objects in the list O are all W_CPyExtPlaceHolderObject: all
+the data is in the PyObjects, and all outsite references (if any) are
+in C, as "PyObject *" fields.
+
+So, during the collection we do this about P links:
+
+for (p, ob) in P:
+if ob->ob_refcnt != REFCNT_FROM_PYPY
+   and ob->ob_refcnt != REFCNT_FROM_PYPY_LIGHT:
+mark 'p' as surviving, as well as all its dependencies
+
+At the end of the collection, the P and O links are both handled like
+this:
+
+for (p, ob) in P + O:
+if p is not surviving:# even if 'ob' might be surviving
+unlink p and ob
+if ob->ob_refcnt == REFCNT_FROM_PYPY_LIGHT:
+free(ob)
+elif ob->ob_refcnt > REFCNT_FROM_PYPY_LIGHT:
+ob->ob_refcnt -= REFCNT_FROM_PYPY_LIGHT
+else:
+ob->ob_refcnt -= REFCNT_FROM_PYPY
+if ob->ob_refcnt == 0:
+invoke _Py_Dealloc(ob) later, outside the GC
+
+
+GC Implementation
+-
+
+We need two copies of both the P list and O list, for young or old
+objects.  All four lists can be regular AddressLists of 'ob' objects.
+
+We also need an AddressDict mapping 'p' to 'ob' for all links in the P
+list, and update it when PyPy objects move.
+
+
+Further notes
+-
+
+XXX
+XXX the rest is the ideal w

[pypy-commit] pypy py3k: hg merge 1df21a900a84

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82461:fa1b4e83847a
Date: 2016-02-23 16:59 +0100
http://bitbucket.org/pypy/pypy/changeset/fa1b4e83847a/

Log:hg merge 1df21a900a84

diff --git a/pypy/module/cpyext/bytesobject.py 
b/pypy/module/cpyext/bytesobject.py
--- a/pypy/module/cpyext/bytesobject.py
+++ b/pypy/module/cpyext/bytesobject.py
@@ -8,7 +8,6 @@
 PyObject, PyObjectP, Py_DecRef, make_ref, from_ref, track_reference,
 make_typedescr, get_typedescr)
 
-
 ##
 ## Implementation of PyBytesObject
 ## 
@@ -144,8 +143,6 @@
 ref_str.c_buffer = rffi.str2charp(s)
 return ref_str.c_buffer
 
-#___
-
 @cpython_api([PyObject, rffi.CCHARPP, rffi.CArrayPtr(Py_ssize_t)], 
rffi.INT_real, error=-1)
 def PyBytes_AsStringAndSize(space, ref, buffer, length):
 if not PyBytes_Check(space, ref):
@@ -228,9 +225,9 @@
 
 if w_newpart is None or not PyBytes_Check(space, ref[0]) or \
 not PyBytes_Check(space, w_newpart):
- Py_DecRef(space, ref[0])
- ref[0] = lltype.nullptr(PyObject.TO)
- return
+Py_DecRef(space, ref[0])
+ref[0] = lltype.nullptr(PyObject.TO)
+return
 w_str = from_ref(space, ref[0])
 w_newstr = space.add(w_str, w_newpart)
 Py_DecRef(space, ref[0])
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: hg merge py3k

2016-02-23 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82463:a21adf0cd8fd
Date: 2016-02-23 22:43 +0100
http://bitbucket.org/pypy/pypy/changeset/a21adf0cd8fd/

Log:hg merge py3k

diff too long, truncating to 2000 out of 5520 lines

diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -8,6 +8,7 @@
 content = fid.read()
 # from cffi's Verifier()
 key = '\x00'.join([sys.version[:3], content])
+key += 'cpyext-gc-support-2'   # this branch requires recompilation!
 if sys.version_info >= (3,):
 key = key.encode('utf-8')
 k1 = hex(binascii.crc32(key[0::2]) & 0x)
diff --git a/pypy/doc/discussion/rawrefcount.rst 
b/pypy/doc/discussion/rawrefcount.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/discussion/rawrefcount.rst
@@ -0,0 +1,158 @@
+==
+Rawrefcount and the GC
+==
+
+
+GC Interface
+
+
+"PyObject" is a raw structure with at least two fields, ob_refcnt and
+ob_pypy_link.  The ob_refcnt is the reference counter as used on
+CPython.  If the PyObject structure is linked to a live PyPy object,
+its current address is stored in ob_pypy_link and ob_refcnt is bumped
+by either the constant REFCNT_FROM_PYPY, or the constant
+REFCNT_FROM_PYPY_LIGHT (== REFCNT_FROM_PYPY + SOME_HUGE_VALUE)
+(to mean "light finalizer").
+
+Most PyPy objects exist outside cpyext, and conversely in cpyext it is
+possible that a lot of PyObjects exist without being seen by the rest
+of PyPy.  At the interface, however, we can "link" a PyPy object and a
+PyObject.  There are two kinds of link:
+
+rawrefcount.create_link_pypy(p, ob)
+
+Makes a link between an exising object gcref 'p' and a newly
+allocated PyObject structure 'ob'.  ob->ob_refcnt must be
+initialized to either REFCNT_FROM_PYPY, or
+REFCNT_FROM_PYPY_LIGHT.  (The second case is an optimization:
+when the GC finds the PyPy object and PyObject no longer
+referenced, it can just free() the PyObject.)
+
+rawrefcount.create_link_pyobj(p, ob)
+
+Makes a link from an existing PyObject structure 'ob' to a newly
+allocated W_CPyExtPlaceHolderObject 'p'.  You must also add
+REFCNT_FROM_PYPY to ob->ob_refcnt.  For cases where the PyObject
+contains all the data, and the PyPy object is just a proxy.  The
+W_CPyExtPlaceHolderObject should have only a field that contains
+the address of the PyObject, but that's outside the scope of the
+GC.
+
+rawrefcount.from_obj(p)
+
+If there is a link from object 'p' made with create_link_pypy(),
+returns the corresponding 'ob'.  Otherwise, returns NULL.
+
+rawrefcount.to_obj(Class, ob)
+
+Returns ob->ob_pypy_link, cast to an instance of 'Class'.
+
+
+Collection logic
+
+
+Objects existing purely on the C side have ob->ob_pypy_link == 0;
+these are purely reference counted.  On the other hand, if
+ob->ob_pypy_link != 0, then ob->ob_refcnt is at least REFCNT_FROM_PYPY
+and the object is part of a "link".
+
+The idea is that links whose 'p' is not reachable from other PyPy
+objects *and* whose 'ob->ob_refcnt' is REFCNT_FROM_PYPY or
+REFCNT_FROM_PYPY_LIGHT are the ones who die.  But it is more messy
+because PyObjects still (usually) need to have a tp_dealloc called,
+and this cannot occur immediately (and can do random things like
+accessing other references this object points to, or resurrecting the
+object).
+
+Let P = list of links created with rawrefcount.create_link_pypy()
+and O = list of links created with rawrefcount.create_link_pyobj().
+The PyPy objects in the list O are all W_CPyExtPlaceHolderObject: all
+the data is in the PyObjects, and all outsite references (if any) are
+in C, as "PyObject *" fields.
+
+So, during the collection we do this about P links:
+
+for (p, ob) in P:
+if ob->ob_refcnt != REFCNT_FROM_PYPY
+   and ob->ob_refcnt != REFCNT_FROM_PYPY_LIGHT:
+mark 'p' as surviving, as well as all its dependencies
+
+At the end of the collection, the P and O links are both handled like
+this:
+
+for (p, ob) in P + O:
+if p is not surviving:# even if 'ob' might be surviving
+unlink p and ob
+if ob->ob_refcnt == REFCNT_FROM_PYPY_LIGHT:
+free(ob)
+elif ob->ob_refcnt > REFCNT_FROM_PYPY_LIGHT:
+ob->ob_refcnt -= REFCNT_FROM_PYPY_LIGHT
+else:
+ob->ob_refcnt -= REFCNT_FROM_PYPY
+if ob->ob_refcnt == 0:
+invoke _Py_Dealloc(ob) later, outside the GC
+
+
+GC Implementation
+-
+
+We need two copies of both the P list and O list, for young or old
+objects.  All four lists can be regular AddressLists of 'ob' objects.
+
+We also need an AddressDict mapping 'p' to 'ob' for all links in the P
+list, and update it when PyPy objects move.
+
+
+Further notes
+-
+
+XXX
+XXX the rest is the ideal wor

[pypy-commit] pypy py3.3: Merged in marky1991/pypy_new/fix_module_repr (pull request #404)

2016-02-24 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82477:79680cd9c664
Date: 2016-02-24 10:05 +0100
http://bitbucket.org/pypy/pypy/changeset/79680cd9c664/

Log:Merged in marky1991/pypy_new/fix_module_repr (pull request #404)

3.3: Fix_module_repr to match PEP 420 and fix reload_builtin

diff --git a/pypy/interpreter/module.py b/pypy/interpreter/module.py
--- a/pypy/interpreter/module.py
+++ b/pypy/interpreter/module.py
@@ -121,19 +121,32 @@
 return space.newtuple(tup_return)
 
 def descr_module__repr__(self, space):
-from pypy.interpreter.mixedmodule import MixedModule
-if self.w_name is not None:
-name = space.unicode_w(space.repr(self.w_name))
-else:
+w_loader = space.finditem(self.w_dict, space.wrap('__loader__'))
+if w_loader is not None:
+try:
+return space.call_method(w_loader, "module_repr",
+ space.wrap(self))
+except OperationError:
+pass
+try:
+w_name = space.getattr(self, space.wrap('__name__'))
+name = space.unicode_w(space.repr(w_name))
+except OperationError:
 name = u"'?'"
-if isinstance(self, MixedModule):
-return space.wrap(u"" % name)
+
 try:
 w___file__ = space.getattr(self, space.wrap('__file__'))
+except OperationError:
+w___file__ = space.w_None
+if not space.isinstance_w(w___file__, space.w_unicode):
+if w_loader is not None:
+w_loader_repr = space.unicode_w(space.repr(w_loader))
+return space.wrap(u"" % (name, w_loader_repr))
+else:
+return space.wrap(u"" % (name,))
+else:
 __file__ = space.unicode_w(space.repr(w___file__))
-except OperationError:
-__file__ = u'?'
-return space.wrap(u"" % (name, __file__))
+return space.wrap(u"" % (name, __file__))
 
 def descr_module__dir__(self, space):
 w_dict = space.getattr(self, space.wrap('__dict__'))
diff --git a/pypy/interpreter/test/test_module.py 
b/pypy/interpreter/test/test_module.py
--- a/pypy/interpreter/test/test_module.py
+++ b/pypy/interpreter/test/test_module.py
@@ -74,11 +74,88 @@
  r'lib_pypy\\_pypy_interact.py' in r.lower()) and
 r.endswith('>'))
 nofile = type(_pypy_interact)('nofile', 'foo')
-assert repr(nofile) == ""
+assert repr(nofile) == ""
 
 m = type(_pypy_interact).__new__(type(_pypy_interact))
 assert repr(m).startswith("".format(mod_name=repr(module.__name__),
+cls=repr(cls.__name__)))
+return mod_repr
+test_module.__loader__ = CustomLoader
+assert repr(test_module) == ""
+
+def test_repr_with_loader_with_module_repr_wrong_type(self):
+import sys
+test_module = type(sys)("test_module", "doc")
+
+# This return value must be a string.
+class BuggyCustomLoader:
+@classmethod
+def module_repr(cls, module):
+return 5
+
+test_module.__loader__ = BuggyCustomLoader
+raises(TypeError, repr, test_module)
+
+def test_repr_with_loader_with_raising_module_repr(self):
+import sys
+test_module = type(sys)("test_module", "doc")
+# If an exception occurs in module_repr(), the exception is caught
+# and discarded, and the calculation of the module’s repr 
continues
+# as if module_repr() did not exist.
+class CustomLoaderWithRaisingRepr:
+@classmethod
+def module_repr(cls, module):
+return repr(1/0)
+
+test_module.__loader__ = CustomLoaderWithRaisingRepr
+mod_repr = repr(test_module)
+
+# The module has no __file__ attribute, so the repr should use 
+# the loader and name
+loader_repr = repr(test_module.__loader__)
+expected_repr = "".format(loader_repr)
+assert mod_repr == expected_repr
+
+def test_repr_with_raising_loader_and___file__(self):
+import sys
+test_module = type(sys)("test_module", "doc")
+test_module.__file__ = "/fake_dir/test_module.py"
+class CustomLoaderWithRaisingRepr:
+"""Operates just like the builtin importer, but implements a
+module_repr method that raises an exception."""
+@classmethod
+def module_repr(cls, module):
+return repr(1/0)
+
+test_module.__loader__ = CustomLoaderWithRaisingRepr
+
+# If the module has an __file__ attribute, this is used as part
+# of the module's repr.
+# (If we have a loader that doesn't correctly implement module_repr,
+# if we have a path, we always just use name and path.
+expected_repr = ""
+assert repr(test_module) ==

[pypy-commit] pypy py3.3: Small cleanup: don't wrap already wrapped object.

2016-02-24 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82478:864c7d539f4d
Date: 2016-02-24 10:24 +0100
http://bitbucket.org/pypy/pypy/changeset/864c7d539f4d/

Log:Small cleanup: don't wrap already wrapped object.

diff --git a/pypy/interpreter/module.py b/pypy/interpreter/module.py
--- a/pypy/interpreter/module.py
+++ b/pypy/interpreter/module.py
@@ -124,8 +124,7 @@
 w_loader = space.finditem(self.w_dict, space.wrap('__loader__'))
 if w_loader is not None:
 try:
-return space.call_method(w_loader, "module_repr",
- space.wrap(self))
+return space.call_method(w_loader, "module_repr", self)
 except OperationError:
 pass
 try:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add external package to test_tab.py's exclude set.

2016-02-24 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82479:f25587392dc9
Date: 2016-02-24 10:26 +0100
http://bitbucket.org/pypy/pypy/changeset/f25587392dc9/

Log:Add external package to test_tab.py's exclude set.

diff --git a/pypy/tool/test/test_tab.py b/pypy/tool/test/test_tab.py
--- a/pypy/tool/test/test_tab.py
+++ b/pypy/tool/test/test_tab.py
@@ -6,7 +6,7 @@
 from pypy.conftest import pypydir
 
 ROOT = os.path.abspath(os.path.join(pypydir, '..'))
-EXCLUDE = {}
+EXCLUDE = {'/virt_test/lib/python2.7/site-packages/setuptools'}
 
 
 def test_no_tabs():
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add stubs in LLInterp for missing gc_rawrefcount_* operations.

2016-02-24 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82480:969fad5c38b9
Date: 2016-02-24 10:31 +0100
http://bitbucket.org/pypy/pypy/changeset/969fad5c38b9/

Log:Add stubs in LLInterp for missing gc_rawrefcount_* operations.

diff --git a/rpython/rtyper/llinterp.py b/rpython/rtyper/llinterp.py
--- a/rpython/rtyper/llinterp.py
+++ b/rpython/rtyper/llinterp.py
@@ -925,6 +925,21 @@
 def op_gc_gcflag_extra(self, subopnum, *args):
 return self.heap.gcflag_extra(subopnum, *args)
 
+def op_gc_rawrefcount_init(self, *args):
+raise NotImplementedError("gc_rawrefcount_init")
+
+def op_gc_rawrefcount_to_obj(self, *args):
+raise NotImplementedError("gc_rawrefcount_to_obj")
+
+def op_gc_rawrefcount_from_obj(self, *args):
+raise NotImplementedError("gc_rawrefcount_from_obj")
+
+def op_gc_rawrefcount_create_link_pyobj(self, *args):
+raise NotImplementedError("gc_rawrefcount_create_link_pyobj")
+
+def op_gc_rawrefcount_create_link_pypy(self, *args):
+raise NotImplementedError("gc_rawrefcount_create_link_pypy")
+
 def op_do_malloc_fixedsize(self):
 raise NotImplementedError("do_malloc_fixedsize")
 def op_do_malloc_fixedsize_clear(self):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy llvm-translation-backend: hg merge default (+ fixes)

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: llvm-translation-backend
Changeset: r82492:d01ebac8cf46
Date: 2016-02-24 10:56 +0100
http://bitbucket.org/pypy/pypy/changeset/d01ebac8cf46/

Log:hg merge default (+ fixes)

diff too long, truncating to 2000 out of 11381 lines

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -22,6 +22,7 @@
 ^pypy/module/cpyext/test/.+\.obj$
 ^pypy/module/cpyext/test/.+\.manifest$
 ^pypy/module/test_lib_pypy/ctypes_tests/.+\.o$
+^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^pypy/module/cppyy/src/.+\.o$
 ^pypy/module/cppyy/bench/.+\.so$
 ^pypy/module/cppyy/bench/.+\.root$
@@ -35,7 +36,6 @@
 ^pypy/module/test_lib_pypy/cffi_tests/__pycache__.+$
 ^pypy/doc/.+\.html$
 ^pypy/doc/config/.+\.rst$
-^pypy/doc/basicblock\.asc$
 ^pypy/doc/.+\.svninfo$
 ^rpython/translator/c/src/libffi_msvc/.+\.obj$
 ^rpython/translator/c/src/libffi_msvc/.+\.dll$
@@ -45,53 +45,33 @@
 ^rpython/translator/c/src/cjkcodecs/.+\.obj$
 ^rpython/translator/c/src/stacklet/.+\.o$
 ^rpython/translator/c/src/.+\.o$
-^rpython/translator/jvm/\.project$
-^rpython/translator/jvm/\.classpath$
-^rpython/translator/jvm/eclipse-bin$
-^rpython/translator/jvm/src/pypy/.+\.class$
-^rpython/translator/benchmark/docutils$
-^rpython/translator/benchmark/templess$
-^rpython/translator/benchmark/gadfly$
-^rpython/translator/benchmark/mako$
-^rpython/translator/benchmark/bench-custom\.benchmark_result$
-^rpython/translator/benchmark/shootout_benchmarks$
+^rpython/translator/llvm/.+\.so$
 ^rpython/translator/goal/target.+-c$
 ^rpython/translator/goal/.+\.exe$
 ^rpython/translator/goal/.+\.dll$
 ^pypy/goal/pypy-translation-snapshot$
 ^pypy/goal/pypy-c
-^pypy/goal/pypy-jvm
-^pypy/goal/pypy-jvm.jar
 ^pypy/goal/.+\.exe$
 ^pypy/goal/.+\.dll$
 ^pypy/goal/.+\.lib$
 ^pypy/_cache$
-^pypy/doc/statistic/.+\.html$
-^pypy/doc/statistic/.+\.eps$
-^pypy/doc/statistic/.+\.pdf$
-^rpython/translator/cli/src/pypylib\.dll$
-^rpython/translator/cli/src/query\.exe$
-^rpython/translator/cli/src/main\.exe$
+^lib-python/2.7/lib2to3/.+\.pickle$
 ^lib_pypy/__pycache__$
 ^lib_pypy/ctypes_config_cache/_.+_cache\.py$
 ^lib_pypy/ctypes_config_cache/_.+_.+_\.py$
 ^lib_pypy/_libmpdec/.+.o$
-^rpython/translator/cli/query-descriptions$
 ^pypy/doc/discussion/.+\.html$
 ^include/.+\.h$
 ^include/.+\.inl$
 ^pypy/doc/_build/.*$
 ^pypy/doc/config/.+\.html$
 ^pypy/doc/config/style\.css$
-^pypy/doc/jit/.+\.html$
-^pypy/doc/jit/style\.css$
 ^pypy/doc/image/lattice1\.png$
 ^pypy/doc/image/lattice2\.png$
 ^pypy/doc/image/lattice3\.png$
 ^pypy/doc/image/stackless_informal\.png$
 ^pypy/doc/image/parsing_example.+\.png$
 ^rpython/doc/_build/.*$
-^pypy/module/test_lib_pypy/ctypes_tests/_ctypes_test\.o$
 ^compiled
 ^.git/
 ^release/
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -41,29 +41,29 @@
   Amaury Forgeot d'Arc
   Antonio Cuni
   Samuele Pedroni
+  Matti Picus
   Alex Gaynor
   Brian Kearns
-  Matti Picus
   Philip Jenvey
   Michael Hudson
+  Ronan Lamy
   David Schneider
+  Manuel Jacob
   Holger Krekel
   Christian Tismer
   Hakan Ardo
-  Manuel Jacob
-  Ronan Lamy
   Benjamin Peterson
+  Richard Plangger
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
-  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
+  Remi Meier
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
-  Remi Meier
   Aurelien Campeas
   Niklaus Haldimann
   Camillo Bruni
@@ -72,8 +72,8 @@
   Romain Guillebert
   Leonardo Santagada
   Seo Sanghyeon
+  Ronny Pfannschmidt
   Justin Peel
-  Ronny Pfannschmidt
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -95,6 +95,7 @@
   Tyler Wade
   Michael Foord
   Stephan Diehl
+  Vincent Legoll
   Stefan Schwarzer
   Valentino Volonghi
   Tomek Meka
@@ -105,9 +106,9 @@
   Jean-Paul Calderone
   Timo Paulssen
   Squeaky
+  Marius Gedminas
   Alexandre Fayolle
   Simon Burton
-  Marius Gedminas
   Martin Matusiak
   Konstantin Lopuhin
   Wenzhu Man
@@ -116,16 +117,20 @@
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
+  Stefano Rivera
   Mark Pearse
   Simon Cross
   Andreas Stührk
-  Stefano Rivera
+  Edd Barrett
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Jeremy Thurgood
   Paweł Piotr Przeradowski
+  Spenser Bauman
   Paul deGrandis
   Ilya Osadchiy
+  marky1991
   Tobias Oberstein
   Adrian Kuhn
   Boris Feigin
@@ -134,14 +139,12 @@
   Georg Brandl
   Bert Freudenberg
   Stian Andreassen
-  Edd Barrett
+  Tobias Pape
   Wanja Saatkamp
   Gerald Klix
   Mike Blume
-  Tobias Pape
   Oscar Nierstrasz
   Stefan H. Muller
-  Jeremy Thurgood
   Rami Chowdhury
   Eugene Oden
   Henry Mason
@@ -153,6 +156,8 @@
   Lukas Renggli
   Guenter Jantzen
   Ned Batchelder
+  Tim Felgentreff
+  Anton Gulenko
   Amit Regmi
   Ben Young
   Nicolas Chauvat
@@ -162,12 +167,12 @@
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
-  Tim Felgentreff
+  Yichao Yu
   Rocco Moretti
   Gintautas Miliauskas
   Michael Twomey
   Lucian Branescu Mihaila
-  Y

[pypy-commit] pypy default: Add app level tests for sys.dont_write_bytecode.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82493:423372b7d89b
Date: 2016-02-25 10:23 +0100
http://bitbucket.org/pypy/pypy/changeset/423372b7d89b/

Log:Add app level tests for sys.dont_write_bytecode.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -98,6 +98,10 @@
 'a=5\nb=6\rc="""hello\r\nworld"""\r', mode='wb')
 p.join('mod.py').write(
 'a=15\nb=16\rc="""foo\r\nbar"""\r', mode='wb')
+setuppkg("test_bytecode",
+ a = '',
+ b = '',
+ c = '')
 
 # create compiled/x.py and a corresponding pyc file
 p = setuppkg("compiled", x = "x = 84")
@@ -1342,6 +1346,36 @@
 assert isinstance(importer, zipimport.zipimporter)
 
 
+class AppTestWriteBytecode(object):
+def setup(cls):
+cls.saved_modules = _setup(cls.space)
+
+def teardown(cls):
+_teardown(cls.space, cls.saved_modules)
+
+def test_default(self):
+import os.path
+from test_bytecode import a
+assert a.__file__.endswith('a.py')
+assert os.path.exists(a.__file__ + 'c')
+
+def test_write_bytecode(self):
+import os.path
+import sys
+sys.dont_write_bytecode = False
+from test_bytecode import b
+assert b.__file__.endswith('b.py')
+assert os.path.exists(b.__file__ + 'c')
+
+def test_dont_write_bytecode(self):
+import os.path
+import sys
+sys.dont_write_bytecode = True
+from test_bytecode import c
+assert c.__file__.endswith('c.py')
+assert not os.path.exists(c.__file__ + 'c')
+
+
 class AppTestNoPycFile(object):
 spaceconfig = {
 "objspace.usepycfiles": False,
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Try to make import tests more independent from each other.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82501:34a4d2b7e371
Date: 2016-02-25 14:04 +0100
http://bitbucket.org/pypy/pypy/changeset/34a4d2b7e371/

Log:Try to make import tests more independent from each other.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -150,6 +150,8 @@
 """)
 
 def _teardown(space, w_saved_modules):
+p = udir.join('impsubdir')
+p.remove()
 space.appexec([w_saved_modules], """
 ((saved_path, saved_modules)):
 import sys
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Reset sys.dont_write_bytecode because apparently the tests are not independent from each other.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82500:b94753e4f5cc
Date: 2016-02-25 13:25 +0100
http://bitbucket.org/pypy/pypy/changeset/b94753e4f5cc/

Log:Reset sys.dont_write_bytecode because apparently the tests are not
independent from each other.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1347,11 +1347,16 @@
 
 
 class AppTestWriteBytecode(object):
-def setup(cls):
+def setup_class(cls):
 cls.saved_modules = _setup(cls.space)
 
-def teardown(cls):
+def teardown_class(cls):
 _teardown(cls.space, cls.saved_modules)
+cls.space.appexec([], """
+():
+import sys
+sys.dont_write_bytecode = False
+""")
 
 def test_default(self):
 import os.path
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Remove objspace.usepycfiles option.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82506:bc2f7f711496
Date: 2016-02-25 15:44 +0100
http://bitbucket.org/pypy/pypy/changeset/bc2f7f711496/

Log:Remove objspace.usepycfiles option.

This option was needed for the sandbox feature, where it might not
be allowed to write to the file system. Nowadays Python has a
sys.dont_write_bytecode flag, which can be used for that. By
default, this flags is `False`, unless when the sandbox feature is
enabled; in this case it's set to `True`.

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -170,12 +170,8 @@
cmdline="--translationmodules",
suggests=[("objspace.allworkingmodules", False)]),
 
-BoolOption("usepycfiles", "Write and read pyc files when importing",
-   default=True),
-
 BoolOption("lonepycfiles", "Import pyc files with no matching py file",
-   default=False,
-   requires=[("objspace.usepycfiles", True)]),
+   default=False),
 
 StrOption("soabi",
   "Tag to differentiate extension modules built for different 
Python interpreters",
diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -277,7 +277,6 @@
 
 if config.translation.sandbox:
 config.objspace.lonepycfiles = False
-config.objspace.usepycfiles = False
 
 config.translating = True
 
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -85,7 +85,7 @@
 # The "imp" module does not respect this, and is allowed to find
 # lone .pyc files.
 # check the .pyc file
-if space.config.objspace.usepycfiles and 
space.config.objspace.lonepycfiles:
+if space.config.objspace.lonepycfiles:
 pycfile = filepart + ".pyc"
 if file_exists(pycfile):
 # existing .pyc file
@@ -888,17 +888,11 @@
 """
 w = space.wrap
 
-if space.config.objspace.usepycfiles:
-src_stat = os.fstat(fd)
-cpathname = pathname + 'c'
-mtime = int(src_stat[stat.ST_MTIME])
-mode = src_stat[stat.ST_MODE]
-stream = check_compiled_module(space, cpathname, mtime)
-else:
-cpathname = None
-mtime = 0
-mode = 0
-stream = None
+src_stat = os.fstat(fd)
+cpathname = pathname + 'c'
+mtime = int(src_stat[stat.ST_MTIME])
+mode = src_stat[stat.ST_MODE]
+stream = check_compiled_module(space, cpathname, mtime)
 
 if stream:
 # existing and up-to-date .pyc file
@@ -913,7 +907,7 @@
 else:
 code_w = parse_source_module(space, pathname, source)
 
-if space.config.objspace.usepycfiles and write_pyc:
+if write_pyc:
 if not space.is_true(space.sys.get('dont_write_bytecode')):
 write_compiled_module(space, code_w, cpathname, mode, mtime)
 
diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -123,7 +123,7 @@
 stream.try_to_find_file_descriptor())
 finally:
 stream.close()
-if space.config.objspace.usepycfiles:
+if not space.config.translation.sandbox:
 # also create a lone .pyc file
 p.join('lone.pyc').write(p.join('x.pyc').read(mode='rb'),
  mode='wb')
@@ -1349,8 +1349,14 @@
 
 
 class AppTestWriteBytecode(object):
+spaceconfig = {
+"translation.sandbox": False
+}
+
 def setup_class(cls):
 cls.saved_modules = _setup(cls.space)
+sandbox = cls.spaceconfig['translation.sandbox']
+cls.w_sandbox = cls.space.wrap(sandbox)
 
 def teardown_class(cls):
 _teardown(cls.space, cls.saved_modules)
@@ -1364,7 +1370,7 @@
 import os.path
 from test_bytecode import a
 assert a.__file__.endswith('a.py')
-assert os.path.exists(a.__file__ + 'c')
+assert os.path.exists(a.__file__ + 'c') == (not self.sandbox)
 
 def test_write_bytecode(self):
 import os.path
@@ -1383,15 +1389,15 @@
 assert not os.path.exists(c.__file__ + 'c')
 
 
-class AppTestNoPycFile(object):
+class AppTestWriteBytecodeSandbox(AppTestWriteBytecode):
 spaceconfig = {
-"objspace.usepycfiles": False,
-"objspace.lonepycfiles": False
+"translation.sandbox": True
 }
+
+
+class _AppTestLonePycFileBase(object):
 def setup_class(cls):
-usepycfiles = cls.spaceconfig['objspace.usepycfiles']
 lonepycfiles = cls.spaceconfig['objspace.lonepycfiles']
-cls.w_usepycfiles = cls.space.wrap(usepycfiles)
 cls.w_lonepycfiles = cls.space.wrap(lonepyc

[pypy-commit] pypy py3k: hg merge default

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82515:299018381016
Date: 2016-02-25 16:38 +0100
http://bitbucket.org/pypy/pypy/changeset/299018381016/

Log:hg merge default

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -41,29 +41,29 @@
   Amaury Forgeot d'Arc
   Antonio Cuni
   Samuele Pedroni
+  Matti Picus
   Alex Gaynor
   Brian Kearns
-  Matti Picus
   Philip Jenvey
   Michael Hudson
+  Ronan Lamy
   David Schneider
+  Manuel Jacob
   Holger Krekel
   Christian Tismer
   Hakan Ardo
-  Manuel Jacob
-  Ronan Lamy
   Benjamin Peterson
+  Richard Plangger
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
-  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
+  Remi Meier
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
-  Remi Meier
   Aurelien Campeas
   Niklaus Haldimann
   Camillo Bruni
@@ -72,8 +72,8 @@
   Romain Guillebert
   Leonardo Santagada
   Seo Sanghyeon
+  Ronny Pfannschmidt
   Justin Peel
-  Ronny Pfannschmidt
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -95,6 +95,7 @@
   Tyler Wade
   Michael Foord
   Stephan Diehl
+  Vincent Legoll
   Stefan Schwarzer
   Valentino Volonghi
   Tomek Meka
@@ -105,9 +106,9 @@
   Jean-Paul Calderone
   Timo Paulssen
   Squeaky
+  Marius Gedminas
   Alexandre Fayolle
   Simon Burton
-  Marius Gedminas
   Martin Matusiak
   Konstantin Lopuhin
   Wenzhu Man
@@ -116,16 +117,20 @@
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
+  Stefano Rivera
   Mark Pearse
   Simon Cross
   Andreas Stührk
-  Stefano Rivera
+  Edd Barrett
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Jeremy Thurgood
   Paweł Piotr Przeradowski
+  Spenser Bauman
   Paul deGrandis
   Ilya Osadchiy
+  marky1991
   Tobias Oberstein
   Adrian Kuhn
   Boris Feigin
@@ -134,14 +139,12 @@
   Georg Brandl
   Bert Freudenberg
   Stian Andreassen
-  Edd Barrett
+  Tobias Pape
   Wanja Saatkamp
   Gerald Klix
   Mike Blume
-  Tobias Pape
   Oscar Nierstrasz
   Stefan H. Muller
-  Jeremy Thurgood
   Rami Chowdhury
   Eugene Oden
   Henry Mason
@@ -153,6 +156,8 @@
   Lukas Renggli
   Guenter Jantzen
   Ned Batchelder
+  Tim Felgentreff
+  Anton Gulenko
   Amit Regmi
   Ben Young
   Nicolas Chauvat
@@ -162,12 +167,12 @@
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
-  Tim Felgentreff
+  Yichao Yu
   Rocco Moretti
   Gintautas Miliauskas
   Michael Twomey
   Lucian Branescu Mihaila
-  Yichao Yu
+  Devin Jeanpierre
   Gabriel Lavoie
   Olivier Dormond
   Jared Grubb
@@ -191,33 +196,33 @@
   Stanislaw Halik
   Mikael Schönenberg
   Berkin Ilbeyi
-  Elmo M?ntynen
+  Elmo Mäntynen
+  Faye Zhao
   Jonathan David Riehl
   Anders Qvist
   Corbin Simpson
   Chirag Jadwani
   Beatrice During
   Alex Perry
-  Vincent Legoll
+  Vaibhav Sood
   Alan McIntyre
-  Spenser Bauman
+  William Leslie
   Alexander Sedov
   Attila Gobi
+  Jasper.Schulz
   Christopher Pope
-  Devin Jeanpierre
-  Vaibhav Sood
   Christian Tismer 
   Marc Abramowitz
   Dan Stromberg
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  Mark Young
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
   Karl Ramm
   Pieter Zieschang
-  Anton Gulenko
   Gabriel
   Lukas Vacek
   Andrew Dalke
@@ -225,6 +230,7 @@
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
+  Omer Katz
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -239,6 +245,7 @@
   Lars Wassermann
   Philipp Rustemeuer
   Henrik Vendelbo
+  Richard Lancaster
   Dan Buch
   Miguel de Val Borro
   Artur Lisiecki
@@ -250,18 +257,18 @@
   Tomo Cocoa
   Kim Jin Su
   Toni Mattis
+  Amber Brown
   Lucas Stadler
   Julian Berman
   Markus Holtermann
   roberto@goyle
   Yury V. Zaytsev
   Anna Katrina Dominguez
-  William Leslie
   Bobby Impollonia
-  Faye Zhao
   t...@eistee.fritz.box
   Andrew Thompson
   Yusei Tahara
+  Aaron Tubbs
   Ben Darnell
   Roberto De Ioris
   Juan Francisco Cantero Hurtado
@@ -273,6 +280,7 @@
   Christopher Armstrong
   Michael Hudson-Doyle
   Anders Sigfridsson
+  Nikolay Zinov
   Yasir Suhail
   Jason Michalski
   rafalgalczyn...@gmail.com
@@ -282,6 +290,7 @@
   Gustavo Niemeyer
   Stephan Busemann
   Rafał Gałczyński
+  Matt Bogosian
   Christian Muirhead
   Berker Peksag
   James Lan
@@ -316,9 +325,9 @@
   Stefan Marr
   jiaaro
   Mads Kiilerich
-  Richard Lancaster
   opassembler.py
   Antony Lee
+  Jason Madden
   Yaroslav Fedevych
   Jim Hunziker
   Markus Unterwaditzer
@@ -327,6 +336,7 @@
   squeaky
   Zearin
   soareschen
+  Jonas Pfannschmidt
   Kurt Griffiths
   Mike Bayer
   Matthew Miller
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -172,9 +172,6 @@
cmdline="--translationmodules",
suggests=[("objspace.allworkingmodules", False)]),
 
-BoolOption("usepycfiles", "Write and read pyc files when importing",
-   default=True),
-
 StrOption("soabi",
   "Tag to d

[pypy-commit] pypy py3.3: hg merge py3k

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82516:868d62ac2a40
Date: 2016-02-25 17:15 +0100
http://bitbucket.org/pypy/pypy/changeset/868d62ac2a40/

Log:hg merge py3k

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -41,29 +41,29 @@
   Amaury Forgeot d'Arc
   Antonio Cuni
   Samuele Pedroni
+  Matti Picus
   Alex Gaynor
   Brian Kearns
-  Matti Picus
   Philip Jenvey
   Michael Hudson
+  Ronan Lamy
   David Schneider
+  Manuel Jacob
   Holger Krekel
   Christian Tismer
   Hakan Ardo
-  Manuel Jacob
-  Ronan Lamy
   Benjamin Peterson
+  Richard Plangger
   Anders Chrigstrom
   Eric van Riet Paap
   Wim Lavrijsen
-  Richard Plangger
   Richard Emslie
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
+  Remi Meier
   Lukas Diekmann
   Sven Hager
   Anders Lehmann
-  Remi Meier
   Aurelien Campeas
   Niklaus Haldimann
   Camillo Bruni
@@ -72,8 +72,8 @@
   Romain Guillebert
   Leonardo Santagada
   Seo Sanghyeon
+  Ronny Pfannschmidt
   Justin Peel
-  Ronny Pfannschmidt
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -95,6 +95,7 @@
   Tyler Wade
   Michael Foord
   Stephan Diehl
+  Vincent Legoll
   Stefan Schwarzer
   Valentino Volonghi
   Tomek Meka
@@ -105,9 +106,9 @@
   Jean-Paul Calderone
   Timo Paulssen
   Squeaky
+  Marius Gedminas
   Alexandre Fayolle
   Simon Burton
-  Marius Gedminas
   Martin Matusiak
   Konstantin Lopuhin
   Wenzhu Man
@@ -116,16 +117,20 @@
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
+  Stefano Rivera
   Mark Pearse
   Simon Cross
   Andreas Stührk
-  Stefano Rivera
+  Edd Barrett
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Jeremy Thurgood
   Paweł Piotr Przeradowski
+  Spenser Bauman
   Paul deGrandis
   Ilya Osadchiy
+  marky1991
   Tobias Oberstein
   Adrian Kuhn
   Boris Feigin
@@ -134,14 +139,12 @@
   Georg Brandl
   Bert Freudenberg
   Stian Andreassen
-  Edd Barrett
+  Tobias Pape
   Wanja Saatkamp
   Gerald Klix
   Mike Blume
-  Tobias Pape
   Oscar Nierstrasz
   Stefan H. Muller
-  Jeremy Thurgood
   Rami Chowdhury
   Eugene Oden
   Henry Mason
@@ -153,6 +156,8 @@
   Lukas Renggli
   Guenter Jantzen
   Ned Batchelder
+  Tim Felgentreff
+  Anton Gulenko
   Amit Regmi
   Ben Young
   Nicolas Chauvat
@@ -162,12 +167,12 @@
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
-  Tim Felgentreff
+  Yichao Yu
   Rocco Moretti
   Gintautas Miliauskas
   Michael Twomey
   Lucian Branescu Mihaila
-  Yichao Yu
+  Devin Jeanpierre
   Gabriel Lavoie
   Olivier Dormond
   Jared Grubb
@@ -191,33 +196,33 @@
   Stanislaw Halik
   Mikael Schönenberg
   Berkin Ilbeyi
-  Elmo M?ntynen
+  Elmo Mäntynen
+  Faye Zhao
   Jonathan David Riehl
   Anders Qvist
   Corbin Simpson
   Chirag Jadwani
   Beatrice During
   Alex Perry
-  Vincent Legoll
+  Vaibhav Sood
   Alan McIntyre
-  Spenser Bauman
+  William Leslie
   Alexander Sedov
   Attila Gobi
+  Jasper.Schulz
   Christopher Pope
-  Devin Jeanpierre
-  Vaibhav Sood
   Christian Tismer 
   Marc Abramowitz
   Dan Stromberg
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  Mark Young
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
   Karl Ramm
   Pieter Zieschang
-  Anton Gulenko
   Gabriel
   Lukas Vacek
   Andrew Dalke
@@ -225,6 +230,7 @@
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
+  Omer Katz
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -239,6 +245,7 @@
   Lars Wassermann
   Philipp Rustemeuer
   Henrik Vendelbo
+  Richard Lancaster
   Dan Buch
   Miguel de Val Borro
   Artur Lisiecki
@@ -250,18 +257,18 @@
   Tomo Cocoa
   Kim Jin Su
   Toni Mattis
+  Amber Brown
   Lucas Stadler
   Julian Berman
   Markus Holtermann
   roberto@goyle
   Yury V. Zaytsev
   Anna Katrina Dominguez
-  William Leslie
   Bobby Impollonia
-  Faye Zhao
   t...@eistee.fritz.box
   Andrew Thompson
   Yusei Tahara
+  Aaron Tubbs
   Ben Darnell
   Roberto De Ioris
   Juan Francisco Cantero Hurtado
@@ -273,6 +280,7 @@
   Christopher Armstrong
   Michael Hudson-Doyle
   Anders Sigfridsson
+  Nikolay Zinov
   Yasir Suhail
   Jason Michalski
   rafalgalczyn...@gmail.com
@@ -282,6 +290,7 @@
   Gustavo Niemeyer
   Stephan Busemann
   Rafał Gałczyński
+  Matt Bogosian
   Christian Muirhead
   Berker Peksag
   James Lan
@@ -316,9 +325,9 @@
   Stefan Marr
   jiaaro
   Mads Kiilerich
-  Richard Lancaster
   opassembler.py
   Antony Lee
+  Jason Madden
   Yaroslav Fedevych
   Jim Hunziker
   Markus Unterwaditzer
@@ -327,6 +336,7 @@
   squeaky
   Zearin
   soareschen
+  Jonas Pfannschmidt
   Kurt Griffiths
   Mike Bayer
   Matthew Miller
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -174,9 +174,6 @@
cmdline="--translationmodules",
suggests=[("objspace.allworkingmodules", False)]),
 
-BoolOption("usepycfiles", "Write and read pyc files when importing",
-   default=True),
-
 StrOption("soabi",
   "Tag to dif

[pypy-commit] pypy py3.3: Intern keyword arguments.

2016-02-25 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82517:34c1abf3cd35
Date: 2016-02-25 17:36 +0100
http://bitbucket.org/pypy/pypy/changeset/34c1abf3cd35/

Log:Intern keyword arguments.

diff --git a/pypy/objspace/std/kwargsdict.py b/pypy/objspace/std/kwargsdict.py
--- a/pypy/objspace/std/kwargsdict.py
+++ b/pypy/objspace/std/kwargsdict.py
@@ -11,7 +11,7 @@
 
 
 def _wrapkey(space, key):
-return space.wrap(key.decode('utf-8'))
+return space.new_interned_str(key)
 
 
 class EmptyKwargsDictStrategy(EmptyDictStrategy):
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py 
b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -1134,6 +1134,9 @@
 def wrapbytes(self, obj):
 return obj
 
+def new_interned_str(self, s):
+return s.decode('utf-8')
+
 def isinstance_w(self, obj, klass):
 return isinstance(obj, klass)
 isinstance = isinstance_w
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Preimport module to reduce stack depth.

2016-02-26 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82561:0f700cec0352
Date: 2016-02-26 13:28 +0100
http://bitbucket.org/pypy/pypy/changeset/0f700cec0352/

Log:Preimport module to reduce stack depth.

This test file passes if run in isolation. However, if run in
conjunction with test_greenlet.py, it fails with a "maximum
recursion depth exceeded" RuntimeError because using greenlets
untranslated on top of CPython results in the recursion counter
being off. This turned out to be too hard too fix, so instead I
changed the subsequent test to use fewer stack frames.

diff --git a/pypy/module/test_lib_pypy/test_os_wait.py 
b/pypy/module/test_lib_pypy/test_os_wait.py
--- a/pypy/module/test_lib_pypy/test_os_wait.py
+++ b/pypy/module/test_lib_pypy/test_os_wait.py
@@ -17,6 +17,7 @@
 if not hasattr(os, "fork"):
 py.test.skip("Need fork() to test wait3/wait4()")
 rebuild.rebuild_one('resource.ctc.py')
+cls.space.appexec([], "(): import ctypes")
 cls.w__pypy_wait = import_lib_pypy(
 cls.space, '_pypy_wait')
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: Make sure test_os_wait tests are actually run.

2016-02-26 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82560:b1039c6babf1
Date: 2016-02-25 22:54 +0100
http://bitbucket.org/pypy/pypy/changeset/b1039c6babf1/

Log:Make sure test_os_wait tests are actually run.

diff --git a/pypy/module/test_lib_pypy/test_os_wait.py 
b/pypy/module/test_lib_pypy/test_os_wait.py
--- a/pypy/module/test_lib_pypy/test_os_wait.py
+++ b/pypy/module/test_lib_pypy/test_os_wait.py
@@ -11,15 +11,14 @@
 class AppTestOsWait:
 
 spaceconfig = dict(usemodules=('_rawffi', 'fcntl', 'itertools', 'select',
-   'signal'))
+   'signal', '_posixsubprocess'))
 
 def setup_class(cls):
 if not hasattr(os, "fork"):
 py.test.skip("Need fork() to test wait3/wait4()")
 rebuild.rebuild_one('resource.ctc.py')
 cls.w__pypy_wait = import_lib_pypy(
-cls.space, '_pypy_wait',
-'_pypy_wait not supported on this platform')
+cls.space, '_pypy_wait')
 
 def test_os_wait3(self):
 import os
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3k: hg merge default

2016-02-26 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82569:12537e5dacda
Date: 2016-02-26 17:30 +0100
http://bitbucket.org/pypy/pypy/changeset/12537e5dacda/

Log:hg 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
@@ -170,4 +170,17 @@
 
 When creating instances and adding attributes in several different orders
 depending on some condition, the JIT would create too much code. This is now
-fixed.
\ No newline at end of file
+fixed.
+
+.. branch: cpyext-gc-support-2
+
+Improve CPython C API support, which means lxml now runs unmodified
+(after removing pypy hacks, pending pull request)
+
+.. branch: look-inside-tuple-hash
+
+Look inside tuple hash, improving mdp benchmark
+
+.. branch: vlen-resume
+
+Compress resume data, saving 10-20% of memory consumed by the JIT
\ No newline at end of file
diff --git a/pypy/module/thread/test/test_thread.py 
b/pypy/module/thread/test/test_thread.py
--- a/pypy/module/thread/test/test_thread.py
+++ b/pypy/module/thread/test/test_thread.py
@@ -239,14 +239,12 @@
 if waiting:
 _thread.interrupt_main()
 return
-print('tock...', x)  # <-force the GIL to be released, as
-time.sleep(0.1)#   time.sleep doesn't do non-translated
+time.sleep(0.1)
 
 def busy_wait():
 waiting.append(None)
 for x in range(100):
-print('tick...', x)  # <-force the GIL to be released, as
-time.sleep(0.1)#   time.sleep doesn't do non-translated
+time.sleep(0.1)
 waiting.pop()
 
 # This is normally called by app_main.py
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -4,7 +4,7 @@
 from pypy.interpreter.gateway import unwrap_spec
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rlib.rarithmetic import intmask
-from rpython.rlib import rposix
+from rpython.rlib import rposix, rtime
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 import os
 import sys
@@ -314,13 +314,13 @@
 if secs < 0:
 raise OperationError(space.w_IOError,
  space.wrap("Invalid argument: negative time 
in sleep"))
-pytime.sleep(secs)
+rtime.sleep(secs)
 else:
 from rpython.rlib import rwin32
 from errno import EINTR
 def _simple_sleep(space, secs, interruptible):
 if secs == 0.0 or not interruptible:
-pytime.sleep(secs)
+rtime.sleep(secs)
 else:
 millisecs = int(secs * 1000)
 interrupt_event = space.fromcache(State).get_interrupt_event()
@@ -329,7 +329,7 @@
 if rc == rwin32.WAIT_OBJECT_0:
 # Yield to make sure real Python signal handler
 # called.
-pytime.sleep(0.001)
+rtime.sleep(0.001)
 raise wrap_oserror(space,
OSError(EINTR, "sleep() interrupted"))
 @unwrap_spec(secs=float)
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -65,21 +65,8 @@
 def delete(self, obj, name, index):
 pass
 
+@jit.elidable
 def find_map_attr(self, name, index):
-if jit.we_are_jitted():
-# hack for the jit:
-# the _find_map_attr method is pure too, but its argument is never
-# constant, because it is always a new tuple
-return self._find_map_attr_jit_pure(name, index)
-else:
-return self._find_map_attr_indirection(name, index)
-
-@jit.elidable
-def _find_map_attr_jit_pure(self, name, index):
-return self._find_map_attr_indirection(name, index)
-
-@jit.dont_look_inside
-def _find_map_attr_indirection(self, name, index):
 if (self.space.config.objspace.std.withmethodcache):
 return self._find_map_attr_cache(name, index)
 return self._find_map_attr(name, index)
diff --git a/pypy/tool/test/test_tab.py b/pypy/tool/test/test_tab.py
--- a/pypy/tool/test/test_tab.py
+++ b/pypy/tool/test/test_tab.py
@@ -6,6 +6,7 @@
 from pypy.conftest import pypydir
 
 ROOT = os.path.abspath(os.path.join(pypydir, '..'))
+RPYTHONDIR = os.path.join(ROOT, "rpython")
 EXCLUDE = {'/virt_test/lib/python2.7/site-packages/setuptools'}
 
 
@@ -28,3 +29,27 @@
 if not entry.startswith('.'):
 walk('%s/%s' % (reldir, entry))
 walk('')
+
+def test_no_pypy_import_in_rpython():
+def walk(reldir):
+print reldir
+if reldir:
+path = os.path.join(RPYTHONDIR, *reldir.split('/'))
+else:
+path = RPYTHONDIR
+if os.path.isfile(path):
+if not path.lo

[pypy-commit] pypy py3k: Remove py3k modification which is not needed since 4f2954127738.

2016-02-26 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82570:e3a8051cb5b8
Date: 2016-02-26 17:33 +0100
http://bitbucket.org/pypy/pypy/changeset/e3a8051cb5b8/

Log:Remove py3k modification which is not needed since 4f2954127738.

diff --git a/pypy/module/thread/test/test_thread.py 
b/pypy/module/thread/test/test_thread.py
--- a/pypy/module/thread/test/test_thread.py
+++ b/pypy/module/thread/test/test_thread.py
@@ -243,14 +243,14 @@
 
 def busy_wait():
 waiting.append(None)
-for x in range(100):
+for x in range(50):
 time.sleep(0.1)
 waiting.pop()
 
 # This is normally called by app_main.py
 signal.signal(signal.SIGINT, signal.default_int_handler)
 
-for i in range(10):
+for i in range(100):
 print()
 print("loop", i)
 waiting = []
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: (ronan, mjacob) Make app-level time.sleep() release the GIL untranslated.

2016-02-26 Thread mjacob
Author: Manuel Jacob 
Branch: 
Changeset: r82568:4f2954127738
Date: 2016-02-26 17:28 +0100
http://bitbucket.org/pypy/pypy/changeset/4f2954127738/

Log:(ronan, mjacob) Make app-level time.sleep() release the GIL
untranslated.

Some app-level tests call time.sleep() to release the GIL. This
didn't work reliably without hacks. This changeset also removes one
of these hacks. The modified test wouldn't have passed without the
interp_time.py change.

diff --git a/pypy/module/thread/test/test_thread.py 
b/pypy/module/thread/test/test_thread.py
--- a/pypy/module/thread/test/test_thread.py
+++ b/pypy/module/thread/test/test_thread.py
@@ -239,14 +239,12 @@
 if waiting:
 thread.interrupt_main()
 return
-print 'tock...', x  # <-force the GIL to be released, as
-time.sleep(0.1)#   time.sleep doesn't do non-translated
+time.sleep(0.1)
 
 def busy_wait():
 waiting.append(None)
 for x in range(50):
-print 'tick...', x  # <-force the GIL to be released, as
-time.sleep(0.1)#   time.sleep doesn't do non-translated
+time.sleep(0.1)
 waiting.pop()
 
 # This is normally called by app_main.py
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -4,7 +4,7 @@
 from pypy.interpreter.gateway import unwrap_spec
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rlib.rarithmetic import intmask
-from rpython.rlib import rposix
+from rpython.rlib import rposix, rtime
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 import os
 import sys
@@ -316,13 +316,13 @@
 if secs < 0:
 raise OperationError(space.w_IOError,
  space.wrap("Invalid argument: negative time 
in sleep"))
-pytime.sleep(secs)
+rtime.sleep(secs)
 else:
 from rpython.rlib import rwin32
 from errno import EINTR
 def _simple_sleep(space, secs, interruptible):
 if secs == 0.0 or not interruptible:
-pytime.sleep(secs)
+rtime.sleep(secs)
 else:
 millisecs = int(secs * 1000)
 interrupt_event = space.fromcache(State).get_interrupt_event()
@@ -331,7 +331,7 @@
 if rc == rwin32.WAIT_OBJECT_0:
 # Yield to make sure real Python signal handler
 # called.
-pytime.sleep(0.001)
+rtime.sleep(0.001)
 raise wrap_oserror(space,
OSError(EINTR, "sleep() interrupted"))
 @unwrap_spec(secs=float)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.3: hg merge py3k

2016-02-26 Thread mjacob
Author: Manuel Jacob 
Branch: py3.3
Changeset: r82573:e484ea33125b
Date: 2016-02-26 19:20 +0100
http://bitbucket.org/pypy/pypy/changeset/e484ea33125b/

Log:hg merge py3k

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
@@ -170,4 +170,17 @@
 
 When creating instances and adding attributes in several different orders
 depending on some condition, the JIT would create too much code. This is now
-fixed.
\ No newline at end of file
+fixed.
+
+.. branch: cpyext-gc-support-2
+
+Improve CPython C API support, which means lxml now runs unmodified
+(after removing pypy hacks, pending pull request)
+
+.. branch: look-inside-tuple-hash
+
+Look inside tuple hash, improving mdp benchmark
+
+.. branch: vlen-resume
+
+Compress resume data, saving 10-20% of memory consumed by the JIT
\ No newline at end of file
diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -65,7 +65,7 @@
 test_reload = "def test():\nraise ValueError\n",
 infinite_reload = "import infinite_reload, imp; 
imp.reload(infinite_reload)",
 del_sys_module = "import sys\ndel 
sys.modules['del_sys_module']\n",
-itertools = "hello_world = 42\n",
+_md5 = "hello_world = 42\n",
 gc = "should_never_be_seen = 42\n",
 )
 root.ensure("packagenamespace", dir=1)# empty, no __init__.py
@@ -202,7 +202,7 @@
 
 class AppTestImport(BaseImportTest):
 spaceconfig = {
-"usemodules": ['time', 'struct'],
+"usemodules": ['_md5', 'time', 'struct'],
 }
 
 def setup_class(cls):
@@ -696,13 +696,15 @@
 
 def test_shadow_extension_1(self):
 if self.runappdirect: skip("hard to test: module is already imported")
+# 'import _md5' is supposed to find _md5.py if there is
+# one in sys.path.
 import sys
-sys.modules.pop('itertools', None)
-import itertools
-assert hasattr(itertools, 'hello_world')
-assert not hasattr(itertools, 'count')
-assert '(built-in)' not in repr(itertools)
-del sys.modules['itertools']
+assert '_md5' not in sys.modules
+import _md5
+assert hasattr(_md5, 'hello_world')
+assert not hasattr(_md5, 'md5')
+assert '(built-in)' not in repr(_md5)
+del sys.modules['_md5']
 
 def test_shadow_extension_2(self):
 if self.runappdirect: skip("hard to test: module is already imported")
@@ -712,16 +714,16 @@
 # there is one in lib_pypy/_md5.py, which should not be seen
 # either; hence the (built-in) test below.)
 import sys
-sys.modules.pop('itertools', None)
+assert '_md5' not in sys.modules
 sys.path.append(sys.path.pop(0))
 try:
-import itertools
-assert not hasattr(itertools, 'hello_world')
-assert hasattr(itertools, 'islice')
-assert '(built-in)' in repr(itertools)
+import _md5
+assert not hasattr(_md5, 'hello_world')
+assert hasattr(_md5, 'md5')
+assert '(built-in)' in repr(_md5)
 finally:
 sys.path.insert(0, sys.path.pop())
-del sys.modules['itertools']
+del sys.modules['_md5']
 
 def test_invalid_pathname(self):
 skip("This test fails on CPython 3.3, but passes on CPython 3.4+")
diff --git a/pypy/module/thread/test/test_thread.py 
b/pypy/module/thread/test/test_thread.py
--- a/pypy/module/thread/test/test_thread.py
+++ b/pypy/module/thread/test/test_thread.py
@@ -239,20 +239,18 @@
 if waiting:
 _thread.interrupt_main()
 return
-print('tock...', x)  # <-force the GIL to be released, as
-time.sleep(0.1)#   time.sleep doesn't do non-translated
+time.sleep(0.1)
 
 def busy_wait():
 waiting.append(None)
-for x in range(100):
-print('tick...', x)  # <-force the GIL to be released, as
-time.sleep(0.1)#   time.sleep doesn't do non-translated
+for x in range(50):
+time.sleep(0.1)
 waiting.pop()
 
 # This is normally called by app_main.py
 signal.signal(signal.SIGINT, signal.default_int_handler)
 
-for i in range(10):
+for i in range(100):
 print()
 print("loop", i)
 waiting = []
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -5,7 +5,7 @@
 from rpython.rtyper.lltypesystem import lltype
 from rpython.rlib.rarithmetic import intmask
 from rpython.rlib.rtime import win_perf_cou

[pypy-commit] pypy py3k: hg merge default

2016-02-26 Thread mjacob
Author: Manuel Jacob 
Branch: py3k
Changeset: r82572:f564a192eb18
Date: 2016-02-26 19:13 +0100
http://bitbucket.org/pypy/pypy/changeset/f564a192eb18/

Log:hg merge default

Also, bring both test_shadow_extension_* tests closer to default.

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -41,7 +41,7 @@
 test_reload = "def test():\nraise ValueError\n",
 infinite_reload = "import infinite_reload, imp; 
imp.reload(infinite_reload)",
 del_sys_module = "import sys\ndel 
sys.modules['del_sys_module']\n",
-itertools = "hello_world = 42\n",
+_md5 = "hello_world = 42\n",
 gc = "should_never_be_seen = 42\n",
 )
 root.ensure("notapackage", dir=1)# empty, no __init__.py
@@ -209,7 +209,7 @@
 
 class AppTestImport(BaseImportTest):
 spaceconfig = {
-"usemodules": ['time', 'struct'],
+"usemodules": ['_md5', 'time', 'struct'],
 }
 
 def setup_class(cls):
@@ -732,13 +732,15 @@
 
 def test_shadow_extension_1(self):
 if self.runappdirect: skip("hard to test: module is already imported")
+# 'import _md5' is supposed to find _md5.py if there is
+# one in sys.path.
 import sys
-sys.modules.pop('itertools', None)
-import itertools
-assert hasattr(itertools, 'hello_world')
-assert not hasattr(itertools, 'count')
-assert '(built-in)' not in repr(itertools)
-del sys.modules['itertools']
+assert '_md5' not in sys.modules
+import _md5
+assert hasattr(_md5, 'hello_world')
+assert not hasattr(_md5, 'md5')
+assert '(built-in)' not in repr(_md5)
+del sys.modules['_md5']
 
 def test_shadow_extension_2(self):
 if self.runappdirect: skip("hard to test: module is already imported")
@@ -748,16 +750,16 @@
 # there is one in lib_pypy/_md5.py, which should not be seen
 # either; hence the (built-in) test below.)
 import sys
-sys.modules.pop('itertools', None)
+assert '_md5' not in sys.modules
 sys.path.append(sys.path.pop(0))
 try:
-import itertools
-assert not hasattr(itertools, 'hello_world')
-assert hasattr(itertools, 'islice')
-assert '(built-in)' in repr(itertools)
+import _md5
+assert not hasattr(_md5, 'hello_world')
+assert hasattr(_md5, 'md5')
+assert '(built-in)' in repr(_md5)
 finally:
 sys.path.insert(0, sys.path.pop())
-del sys.modules['itertools']
+del sys.modules['_md5']
 
 def test_invalid_pathname(self):
 import imp
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


  1   2   3   4   5   6   >