[pypy-commit] pypy release-5.x: fix b127faf95f86 which updated contributors but removed the rest of LICENSE

2016-09-01 Thread mattip
Author: Matti Picus 
Branch: release-5.x
Changeset: r86834:d68da509772b
Date: 2016-09-02 08:43 +0300
http://bitbucket.org/pypy/pypy/changeset/d68da509772b/

Log:fix b127faf95f86 which updated contributors but removed the rest of
LICENSE (grafted from d6a8fc8b6b278362d6a4c7602135354b91ac2e9a)

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -369,3 +369,109 @@
   Roman Podoliaka
   Dan Loewenherz
   werat
+
+  Heinrich-Heine University, Germany 
+  Open End AB (formerly AB Strakt), Sweden
+  merlinux GmbH, Germany 
+  tismerysoft GmbH, Germany 
+  Logilab Paris, France 
+  DFKI GmbH, Germany 
+  Impara, Germany
+  Change Maker, Sweden 
+  University of California Berkeley, USA
+  Google Inc.
+  King's College London
+
+The PyPy Logo as used by http://speed.pypy.org and others was created
+by Samuel Reis and is distributed on terms of Creative Commons Share Alike
+License.
+ 
+License for 'lib-python/2.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 terms that you can find here: https://docs.python.org/2/license.html
+
+License for 'pypy/module/unicodedata/'
+==
+
+The following files are from the website of The Unicode Consortium
+at http://www.unicode.org/.  For the terms of use of these files, see
+http://www.unicode.org/terms_of_use.html .  Or they are derived from
+files from the above website, and the same terms of use apply.
+
+CompositionExclusions-*.txt
+EastAsianWidth-*.txt
+LineBreak-*.txt
+UnicodeData-*.txt
+UnihanNumeric-*.txt
+
+License for 'dotviewer/font/'
+=
+
+Copyright (C) 2008 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Detailed license information is contained in the NOTICE file in the
+directory.
+
+
+Licenses and Acknowledgements for Incorporated Software
+===
+
+This section is an incomplete, but growing list of licenses and
+acknowledgements for third-party software incorporated in the PyPy
+distribution.
+
+License for 'Tcl/Tk'
+
+
+This copy of PyPy contains library code that may, when used, result in
+the Tcl/Tk library to be loaded.  PyPy also includes code that may be
+regarded as being a copy of some parts of the Tcl/Tk header files.
+You may see a copy of the License for Tcl/Tk in the file
+`lib_pypy/_tkinter/license.terms` included here.
+
+License for 'bzip2'
+---
+
+This copy of PyPy may be linked (dynamically or statically) with the
+bzip2 library.  You may see a copy of the License for bzip2/libbzip2 at
+
+http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html
+
+License for 'openssl'
+-
+
+This copy of PyPy may be linked (dynamically or statically) with the
+openssl library.  You may see a copy of the License for OpenSSL at
+
+https://www.openssl.org/source/license.html
+
+License for 'gdbm'
+--
+
+The gdbm module includes code from gdbm.h, which is distributed under
+the terms of the GPL license version 2 or any later version.  Thus the
+gdbm module, provided in the file lib_pypy/gdbm.py, is redistributed
+under the terms of the GPL license as well.
+
+License for 'rpython/rlib/rvmprof/src'
+--
+
+The code is based on gperftools. You may see a copy of the License for it at
+
+https://github.com/gperftools/gperftools/blob/master/COPYING
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: fix b127faf95f86 which updated contributors but removed the rest of LICENSE

2016-09-01 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r86833:d6a8fc8b6b27
Date: 2016-09-02 08:42 +0300
http://bitbucket.org/pypy/pypy/changeset/d6a8fc8b6b27/

Log:fix b127faf95f86 which updated contributors but removed the rest of
LICENSE

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -369,3 +369,109 @@
   Roman Podoliaka
   Dan Loewenherz
   werat
+
+  Heinrich-Heine University, Germany 
+  Open End AB (formerly AB Strakt), Sweden
+  merlinux GmbH, Germany 
+  tismerysoft GmbH, Germany 
+  Logilab Paris, France 
+  DFKI GmbH, Germany 
+  Impara, Germany
+  Change Maker, Sweden 
+  University of California Berkeley, USA
+  Google Inc.
+  King's College London
+
+The PyPy Logo as used by http://speed.pypy.org and others was created
+by Samuel Reis and is distributed on terms of Creative Commons Share Alike
+License.
+ 
+License for 'lib-python/2.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 terms that you can find here: https://docs.python.org/2/license.html
+
+License for 'pypy/module/unicodedata/'
+==
+
+The following files are from the website of The Unicode Consortium
+at http://www.unicode.org/.  For the terms of use of these files, see
+http://www.unicode.org/terms_of_use.html .  Or they are derived from
+files from the above website, and the same terms of use apply.
+
+CompositionExclusions-*.txt
+EastAsianWidth-*.txt
+LineBreak-*.txt
+UnicodeData-*.txt
+UnihanNumeric-*.txt
+
+License for 'dotviewer/font/'
+=
+
+Copyright (C) 2008 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+  
+ http://www.apache.org/licenses/LICENSE-2.0
+  
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Detailed license information is contained in the NOTICE file in the
+directory.
+
+
+Licenses and Acknowledgements for Incorporated Software
+===
+
+This section is an incomplete, but growing list of licenses and
+acknowledgements for third-party software incorporated in the PyPy
+distribution.
+
+License for 'Tcl/Tk'
+
+
+This copy of PyPy contains library code that may, when used, result in
+the Tcl/Tk library to be loaded.  PyPy also includes code that may be
+regarded as being a copy of some parts of the Tcl/Tk header files.
+You may see a copy of the License for Tcl/Tk in the file
+`lib_pypy/_tkinter/license.terms` included here.
+
+License for 'bzip2'
+---
+
+This copy of PyPy may be linked (dynamically or statically) with the
+bzip2 library.  You may see a copy of the License for bzip2/libbzip2 at
+
+http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html
+
+License for 'openssl'
+-
+
+This copy of PyPy may be linked (dynamically or statically) with the
+openssl library.  You may see a copy of the License for OpenSSL at
+
+https://www.openssl.org/source/license.html
+
+License for 'gdbm'
+--
+
+The gdbm module includes code from gdbm.h, which is distributed under
+the terms of the GPL license version 2 or any later version.  Thus the
+gdbm module, provided in the file lib_pypy/gdbm.py, is redistributed
+under the terms of the GPL license as well.
+
+License for 'rpython/rlib/rvmprof/src'
+--
+
+The code is based on gperftools. You may see a copy of the License for it at
+
+https://github.com/gperftools/gperftools/blob/master/COPYING
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-5.x: pfff another hack on top of this pile of hacks

2016-09-01 Thread mattip
Author: Matti Picus 
Branch: release-5.x
Changeset: r86832:3e411b32904e
Date: 2016-09-02 08:10 +0300
http://bitbucket.org/pypy/pypy/changeset/3e411b32904e/

Log:pfff another hack on top of this pile of hacks (grafted from
76e37b5f30ae446c64388d1d7cd2d2f01999621e)

diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -170,11 +170,15 @@
 #
 # hck for 'pypy py.test -A' if libm.so is a linker script
 # (see reason in _dlerror_on_dlopen_untranslated())
+must_free = False
 if not we_are_translated() and platform.name == "linux":
 if name and rffi.charp2str(name) == 'libm.so':
-name = rffi.str2charp('libm.so.6', track_allocation=False)
+name = rffi.str2charp('libm.so.6')
+must_free = True
 #
 res = c_dlopen(name, rffi.cast(rffi.INT, mode))
+if must_free:
+rffi.free_charp(name)
 if not res:
 if not we_are_translated():
 err = _dlerror_on_dlopen_untranslated(name)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-5.x: Add a failing (skipped) whitebox test and a test about ctypes that fails

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: release-5.x
Changeset: r86829:2cab10de65ad
Date: 2016-09-01 20:35 -0700
http://bitbucket.org/pypy/pypy/changeset/2cab10de65ad/

Log:Add a failing (skipped) whitebox test and a test about ctypes that
fails on -A (xfailed)

diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_numbers.py 
b/pypy/module/test_lib_pypy/ctypes_tests/test_numbers.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_numbers.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_numbers.py
@@ -195,6 +195,29 @@
 _fields_ = [('t', enum)]
 assert isinstance(S().t, enum)
 
+def test_no_missing_shape_to_ffi_type(self):
+# whitebox test
+import sys
+if '__pypy__' not in sys.builtin_module_names:
+skip("only for pypy's ctypes")
+skip("re-enable after adding 'g' to _shape_to_ffi_type.typemap, "
+ "which I think needs fighting all the way up from "
+ "rpython.rlib.libffi")
+from _ctypes.basics import _shape_to_ffi_type
+from _rawffi import Array
+for i in range(1, 256):
+try:
+Array(chr(i))
+except ValueError:
+pass
+else:
+assert chr(i) in _shape_to_ffi_type.typemap
+
+@py.test.mark.xfail
+def test_pointer_to_long_double(self):
+import ctypes
+ctypes.POINTER(ctypes.c_longdouble)
+
 ##def test_perf(self):
 ##check_perf()
 
diff --git a/rpython/rlib/libffi.py b/rpython/rlib/libffi.py
--- a/rpython/rlib/libffi.py
+++ b/rpython/rlib/libffi.py
@@ -47,6 +47,8 @@
 cls.ulonglong = clibffi.cast_type_to_ffitype(rffi.ULONGLONG)
 cls.signed = clibffi.cast_type_to_ffitype(rffi.SIGNED)
 cls.wchar_t = clibffi.cast_type_to_ffitype(lltype.UniChar)
+# XXX long double support: clibffi.ffi_type_longdouble, but then
+# XXX fix the whole rest of this file to add a case for long double
 del cls._import
 
 @staticmethod
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-5.x: name can be None

2016-09-01 Thread stefanor
Author: Stefano Rivera 
Branch: release-5.x
Changeset: r86828:3806b361cac3
Date: 2016-09-01 20:35 -0700
http://bitbucket.org/pypy/pypy/changeset/3806b361cac3/

Log:name can be None

diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -171,7 +171,7 @@
 # hck for 'pypy py.test -A' if libm.so is a linker script
 # (see reason in _dlerror_on_dlopen_untranslated())
 if not we_are_translated() and platform.name == "linux":
-if rffi.charp2str(name) == 'libm.so':
+if name and rffi.charp2str(name) == 'libm.so':
 name = rffi.str2charp('libm.so.6', track_allocation=False)
 #
 res = c_dlopen(name, rffi.cast(rffi.INT, mode))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-5.x: haaaack on top of previous hacks

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: release-5.x
Changeset: r86827:12bd393e0411
Date: 2016-09-01 20:35 -0700
http://bitbucket.org/pypy/pypy/changeset/12bd393e0411/

Log:hck on top of previous hacks

diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -98,8 +98,15 @@
 try:
 ctypes.CDLL(name)
 except OSError as e:
+# common case: ctypes fails too, with the real dlerror()
+# message in str(e).  Return that error message.
 return str(e)
 else:
+# uncommon case: may happen if 'name' is a linker script
+# (which the C-level dlopen() can't handle) and we are
+# directly running on pypy (whose implementation of ctypes
+# or cffi will resolve linker scripts).  In that case, 
+# unsure what we can do.
 return ("opening %r with ctypes.CDLL() works, "
 "but not with c_dlopen()??" % (name,))
 
@@ -160,6 +167,13 @@
 mode = _dlopen_default_mode()
 elif (mode & (RTLD_LAZY | RTLD_NOW)) == 0:
 mode |= RTLD_NOW
+#
+# hck for 'pypy py.test -A' if libm.so is a linker script
+# (see reason in _dlerror_on_dlopen_untranslated())
+if not we_are_translated() and platform.name == "linux":
+if rffi.charp2str(name) == 'libm.so':
+name = rffi.str2charp('libm.so.6', track_allocation=False)
+#
 res = c_dlopen(name, rffi.cast(rffi.INT, mode))
 if not res:
 if not we_are_translated():
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-5.x: Avoid blowing up with results that are ~0 but <0 due to floating point imprecision

2016-09-01 Thread stefanor
Author: Stefano Rivera 
Branch: release-5.x
Changeset: r86831:5169ca3e696d
Date: 2016-09-01 20:35 -0700
http://bitbucket.org/pypy/pypy/changeset/5169ca3e696d/

Log:Avoid blowing up with results that are ~0 but <0 due to floating
point imprecision

diff --git a/rpython/translator/backendopt/inline.py 
b/rpython/translator/backendopt/inline.py
--- a/rpython/translator/backendopt/inline.py
+++ b/rpython/translator/backendopt/inline.py
@@ -532,8 +532,7 @@
 return sys.maxint
 else:
 res = Solution[blockmap[graph.startblock]]
-assert res >= 0
-return res
+return max(res, 0.0)
 
 def static_instruction_count(graph):
 count = 0
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-5.x: Bump recursionlimit, for translating with cpython

2016-09-01 Thread stefanor
Author: Stefano Rivera 
Branch: release-5.x
Changeset: r86830:a5db0f4359ab
Date: 2016-09-01 20:35 -0700
http://bitbucket.org/pypy/pypy/changeset/a5db0f4359ab/

Log:Bump recursionlimit, for translating with cpython

diff --git a/rpython/translator/goal/translate.py 
b/rpython/translator/goal/translate.py
--- a/rpython/translator/goal/translate.py
+++ b/rpython/translator/goal/translate.py
@@ -213,6 +213,7 @@
 log.WARNING(warning)
 
 def main():
+sys.setrecursionlimit(2000)  # PyPy can't translate within cpython's 1k 
limit
 targetspec_dic, translateconfig, config, args = 
parse_options_and_load_target()
 from rpython.translator import translator
 from rpython.translator import driver
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy force-virtual-state: Merge

2016-09-01 Thread sbauman
Author: Spenser Andrew Bauman 
Branch: force-virtual-state
Changeset: r86826:5649730037a2
Date: 2016-09-01 15:17 -0400
http://bitbucket.org/pypy/pypy/changeset/5649730037a2/

Log:Merge

diff too long, truncating to 2000 out of 213792 lines

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -27,3 +27,6 @@
 40497617ae91caa1a394d8be6f9cd2de31cb0628 release-pypy3.3-v5.2
 c09c19272c990a0611b17569a0085ad1ab00c8ff release-pypy2.7-v5.3
 7e8df3df96417c16c2d55b41352ec82c9c69c978 release-pypy2.7-v5.3.1
+68bb3510d8212ae9efb687e12e58c09d29e74f87 release-pypy2.7-v5.4.0
+68bb3510d8212ae9efb687e12e58c09d29e74f87 release-pypy2.7-v5.4.0
+77392ad263504df011ccfcabf6a62e21d04086d0 release-pypy2.7-v5.4.0
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -74,6 +74,7 @@
   Seo Sanghyeon
   Ronny Pfannschmidt
   Justin Peel
+  Raffael Tfirst
   David Edelsohn
   Anders Hammarquist
   Jakub Gustak
@@ -117,7 +118,6 @@
   Wenzhu Man
   John Witulski
   Laurence Tratt
-  Raffael Tfirst
   Ivan Sichmann Freitas
   Greg Price
   Dario Bertini
@@ -141,6 +141,7 @@
   tav
   Taavi Burns
   Georg Brandl
+  Nicolas Truessel
   Bert Freudenberg
   Stian Andreassen
   Wanja Saatkamp
@@ -211,6 +212,7 @@
   Vaibhav Sood
   Alan McIntyre
   Alexander Sedov
+  p_ziesch...@yahoo.de
   Attila Gobi
   Jasper.Schulz
   Christopher Pope
@@ -221,6 +223,7 @@
   Arjun Naik
   Valentina Mukhamedzhanova
   Stefano Parmesan
+  touilleMan
   Alexis Daboville
   Jens-Uwe Mager
   Carl Meyer
@@ -229,12 +232,14 @@
   Gabriel
   Lukas Vacek
   Kunal Grover
+  Aaron Gallagher
   Andrew Dalke
   Sylvain Thenault
   Jakub Stasiak
   Nathan Taylor
   Vladimir Kryachko
   Omer Katz
+  Mark Williams
   Jacek Generowicz
   Alejandro J. Cura
   Jacob Oscarson
@@ -355,115 +360,12 @@
   yasirs
   Michael Chermside
   Anna Ravencroft
+  pizi
   Andrey Churin
   Dan Crosta
+  Eli Stevens
   Tobias Diaz
   Julien Phalip
   Roman Podoliaka
   Dan Loewenherz
-
-  Heinrich-Heine University, Germany 
-  Open End AB (formerly AB Strakt), Sweden
-  merlinux GmbH, Germany 
-  tismerysoft GmbH, Germany 
-  Logilab Paris, France 
-  DFKI GmbH, Germany 
-  Impara, Germany
-  Change Maker, Sweden 
-  University of California Berkeley, USA
-  Google Inc.
-  King's College London
-
-The PyPy Logo as used by http://speed.pypy.org and others was created
-by Samuel Reis and is distributed on terms of Creative Commons Share Alike
-License.
- 
-License for 'lib-python/2.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 terms that you can find here: https://docs.python.org/2/license.html
-
-License for 'pypy/module/unicodedata/'
-==
-
-The following files are from the website of The Unicode Consortium
-at http://www.unicode.org/.  For the terms of use of these files, see
-http://www.unicode.org/terms_of_use.html .  Or they are derived from
-files from the above website, and the same terms of use apply.
-
-CompositionExclusions-*.txt
-EastAsianWidth-*.txt
-LineBreak-*.txt
-UnicodeData-*.txt
-UnihanNumeric-*.txt
-
-License for 'dotviewer/font/'
-=
-
-Copyright (C) 2008 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-  
- http://www.apache.org/licenses/LICENSE-2.0
-  
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Detailed license information is contained in the NOTICE file in the
-directory.
-
-
-Licenses and Acknowledgements for Incorporated Software
-===
-
-This section is an incomplete, but growing list of licenses and
-acknowledgements for third-party software incorporated in the PyPy
-distribution.
-
-License for 'Tcl/Tk'
-
-
-This copy of PyPy contains library code that may, when used, result in
-the Tcl/Tk library to be loaded.  PyPy also includes code that may be
-regarded as being a copy of some parts of the Tcl/Tk header files.
-You may see a copy of the License for Tcl/Tk in the file
-`lib_pypy/_tkinter/license.terms` included here.
-
-License for 'bzip2'

-
-This copy of PyPy may be linked (dynamically or statically) with the
-bzip2 library.  You may see a copy of the License for bzip2/libbzip2 at
-
-http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html
-
-License for 'openssl'
--
-
-This copy of PyPy 

[pypy-commit] pypy default: Fix translation and add a warning in annmodel.unionof

2016-09-01 Thread rlamy
Author: Ronan Lamy 
Branch: 
Changeset: r86825:82980a978280
Date: 2016-09-01 23:02 +0100
http://bitbucket.org/pypy/pypy/changeset/82980a978280/

Log:Fix translation and add a warning in annmodel.unionof

diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -165,7 +165,9 @@
 # graph -- it's already low-level operations!
 for a, s_newarg in zip(block.inputargs, cells):
 s_oldarg = a.annotation
-if not s_oldarg.contains(s_newarg):
+# XXX: Should use s_oldarg.contains(s_newarg) but that breaks
+# PyPy translation
+if annmodel.unionof(s_oldarg, s_newarg) != s_oldarg:
 raise annmodel.AnnotatorError(
 "Late-stage annotation is not allowed to modify the "
 "existing annotation for variable %s: %s" %
diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
--- a/rpython/annotator/model.py
+++ b/rpython/annotator/model.py
@@ -750,6 +750,7 @@
 s1 = pair(s1, s2).union()
 else:
 # this is just a performance shortcut
+# XXX: This is a lie! Grep for no_side_effects_in_union and weep.
 if s1 != s2:
 s1 = pair(s1, s2).union()
 return s1
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy.org extradoc: update the values

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r784:8cea640f2073
Date: 2016-09-01 23:45 +0200
http://bitbucket.org/pypy/pypy.org/changeset/8cea640f2073/

Log:update the values

diff --git a/don1.html b/don1.html
--- a/don1.html
+++ b/don1.html
@@ -9,13 +9,13 @@
 
   $(function() {
 $("#progressbar").progressbar({
-  value: 61.8
+  value: 61.9
});
   });
 
 

-   $64931 of $105000 (61.8%)
+   $64959 of $105000 (61.9%)


 
@@ -23,7 +23,7 @@
   
   This donation goes towards supporting Python 3 in 
PyPy.
   Current status:
-we have $5400 left
+we have $5426 left
   in the account. Read proposal
   
   
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Issue #2389: the custom error handler may return a 'pos' that is smaller

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86816:e9dd5882eed6
Date: 2016-09-01 12:23 +0200
http://bitbucket.org/pypy/pypy/changeset/e9dd5882eed6/

Log:Issue #2389: the custom error handler may return a 'pos' that is
smaller than 'size', in which case we need to continue looping

diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -157,22 +157,26 @@
 if pos + n > size:
 if not final:
 break
+# argh, this obscure block of code is mostly a copy of
+# what follows :-(
 charsleft = size - pos - 1 # either 0, 1, 2
-# note: when we get the 'unexpected end of data' we don't care
-# about the pos anymore and we just ignore the value
+# note: when we get the 'unexpected end of data' we need
+# to care about the pos returned; it can be lower than size,
+# in case we need to continue running this loop
 if not charsleft:
 # there's only the start byte and nothing else
 r, pos = errorhandler(errors, 'utf8',
   'unexpected end of data',
   s, pos, pos+1)
 result.append(r)
-break
+continue
 ordch2 = ord(s[pos+1])
 if n == 3:
 # 3-bytes seq with only a continuation byte
 if (ordch2>>6 != 0x2 or   # 0b10
-(ordch1 == 0xe0 and ordch2 < 0xa0)):
-# or (ordch1 == 0xed and ordch2 > 0x9f)
+(ordch1 == 0xe0 and ordch2 < 0xa0)
+or (not allow_surrogates and ordch1 == 0xed and ordch2 > 0x9f)
+):
 # second byte invalid, take the first and continue
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
@@ -185,7 +189,7 @@
   'unexpected end of data',
   s, pos, pos+2)
 result.append(r)
-break
+continue
 elif n == 4:
 # 4-bytes seq with 1 or 2 continuation bytes
 if (ordch2>>6 != 0x2 or# 0b10
@@ -210,7 +214,8 @@
   'unexpected end of data',
   s, pos, pos+charsleft+1)
 result.append(r)
-break
+continue
+raise AssertionError("unreachable")
 
 if n == 0:
 r, pos = errorhandler(errors, 'utf8',
diff --git a/rpython/rlib/test/test_runicode.py 
b/rpython/rlib/test/test_runicode.py
--- a/rpython/rlib/test/test_runicode.py
+++ b/rpython/rlib/test/test_runicode.py
@@ -289,6 +289,12 @@
 def setup_method(self, meth):
 self.decoder = self.getdecoder('utf-8')
 
+def custom_replace(self, errors, encoding, msg, s, startingpos, endingpos):
+assert errors == 'custom'
+# returns FOO, but consumes only one character (not up to endingpos)
+FOO = u'\u1234'
+return FOO, startingpos + 1
+
 def to_bytestring(self, bytes):
 return ''.join(chr(int(c, 16)) for c in bytes.split())
 
@@ -309,6 +315,7 @@
 E.g. <80> is a continuation byte and can appear only after a start 
byte.
 """
 FFFD = u'\ufffd'
+FOO = u'\u1234'
 for byte in '\x80\xA0\x9F\xBF\xC0\xC1\xF5\xFF':
 py.test.raises(UnicodeDecodeError, self.decoder, byte, 1, None, 
final=True)
 self.checkdecodeerror(byte, 'utf-8', 0, 1, addstuff=False,
@@ -320,6 +327,11 @@
 assert self.decoder(byte, 1, 'ignore', final=True) == (u'', 1)
 assert (self.decoder('' + byte + '', 9, 'ignore',
 final=True) == (u'', 9))
+assert self.decoder(byte, 1, 'custom', final=True,
+errorhandler=self.custom_replace) == (FOO, 1)
+assert (self.decoder('' + byte + '', 9, 'custom',
+final=True, errorhandler=self.custom_replace) ==
+(u''+ FOO + u'', 9))
 
 def test_unexpected_end_of_data(self):
 """
@@ -343,6 +355,7 @@
 'F4 80', 'F4 8F', 'F4 80 80', 'F4 80 BF', 'F4 8F 80', 'F4 8F BF'
 ]
 FFFD = u'\ufffd'
+FOO = u'\u1234'
 for seq in sequences:
 seq = self.to_bytestring(seq)
 py.test.raises(UnicodeDecodeError, self.decoder, seq, len(seq),
@@ -358,6 +371,12 @@
 ) == (u'', len(seq))
 assert (self.decoder('' + seq + '', len(seq) + 8, 'ignore',
 final=True) == (u'', len(seq) + 8))
+assert (self.decoder(seq, 

[pypy-commit] pypy default: Move the bit checking inside helpers, share it from the two places

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86817:ee3a2fbec01a
Date: 2016-09-01 12:36 +0200
http://bitbucket.org/pypy/pypy/changeset/ee3a2fbec01a/

Log:Move the bit checking inside helpers, share it from the two places

diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -137,6 +137,25 @@
  result=result)
 return result.build(), pos
 
+def _invalid_cont_byte(ordch):
+return ordch>>6 != 0x2# 0b10
+
+_invalid_byte_2_of_2 = _invalid_cont_byte
+_invalid_byte_3_of_3 = _invalid_cont_byte
+_invalid_byte_3_of_4 = _invalid_cont_byte
+_invalid_byte_4_of_4 = _invalid_cont_byte
+
+def _invalid_byte_2_of_3(ordch1, ordch2, allow_surrogates):
+return (ordch2>>6 != 0x2 or# 0b10
+(ordch1 == 0xe0 and ordch2 < 0xa0)
+# surrogates shouldn't be valid UTF-8!
+or (not allow_surrogates and ordch1 == 0xed and ordch2 > 0x9f))
+
+def _invalid_byte_2_of_4(ordch1, ordch2):
+return (ordch2>>6 != 0x2 or# 0b10
+(ordch1 == 0xf0 and ordch2 < 0x90) or
+(ordch1 == 0xf4 and ordch2 > 0x8f))
+
 @specialize.argtype(6)
 def str_decode_utf_8_impl(s, size, errors, final, errorhandler,
   allow_surrogates, result):
@@ -173,10 +192,7 @@
 ordch2 = ord(s[pos+1])
 if n == 3:
 # 3-bytes seq with only a continuation byte
-if (ordch2>>6 != 0x2 or   # 0b10
-(ordch1 == 0xe0 and ordch2 < 0xa0)
-or (not allow_surrogates and ordch1 == 0xed and ordch2 > 0x9f)
-):
+if _invalid_byte_2_of_3(ordch1, ordch2, allow_surrogates):
 # second byte invalid, take the first and continue
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
@@ -192,16 +208,14 @@
 continue
 elif n == 4:
 # 4-bytes seq with 1 or 2 continuation bytes
-if (ordch2>>6 != 0x2 or# 0b10
-(ordch1 == 0xf0 and ordch2 < 0x90) or
-(ordch1 == 0xf4 and ordch2 > 0x8f)):
+if _invalid_byte_2_of_4(ordch1, ordch2):
 # second byte invalid, take the first and continue
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
   s, pos, pos+1)
 result.append(r)
 continue
-elif charsleft == 2 and ord(s[pos+2])>>6 != 0x2:   # 0b10
+elif charsleft == 2 and _invalid_byte_3_of_4(ord(s[pos+2])):
 # third byte invalid, take the first two and continue
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
@@ -228,7 +242,7 @@
 
 elif n == 2:
 ordch2 = ord(s[pos+1])
-if ordch2>>6 != 0x2:   # 0b10
+if _invalid_byte_2_of_2(ordch2):
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
   s, pos, pos+1)
@@ -242,17 +256,13 @@
 elif n == 3:
 ordch2 = ord(s[pos+1])
 ordch3 = ord(s[pos+2])
-if (ordch2>>6 != 0x2 or# 0b10
-(ordch1 == 0xe0 and ordch2 < 0xa0)
-# surrogates shouldn't be valid UTF-8!
-or (not allow_surrogates and ordch1 == 0xed and ordch2 > 0x9f)
-):
+if _invalid_byte_2_of_3(ordch1, ordch2, allow_surrogates):
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
   s, pos, pos+1)
 result.append(r)
 continue
-elif ordch3>>6 != 0x2: # 0b10
+elif _invalid_byte_3_of_3(ordch3):
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
   s, pos, pos+2)
@@ -268,21 +278,19 @@
 ordch2 = ord(s[pos+1])
 ordch3 = ord(s[pos+2])
 ordch4 = ord(s[pos+3])
-if (ordch2>>6 != 0x2 or # 0b10
-(ordch1 == 0xf0 and ordch2 < 0x90) or
-(ordch1 == 0xf4 and ordch2 > 0x8f)):
+if _invalid_byte_2_of_4(ordch1, ordch2):
 r, pos = errorhandler(errors, 'utf8',
   'invalid continuation byte',
   s, pos, pos+1)
 result.append(r)
 continue
-elif ordch3>>6 != 0x2: # 0b10
+elif _invalid_byte_3_of_4(ordch3):
  

[pypy-commit] pypy default: Rename the exception that we call TestException to some class name that

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86814:955998701207
Date: 2016-09-01 11:02 +0100
http://bitbucket.org/pypy/pypy/changeset/955998701207/

Log:Rename the exception that we call TestException to some class name
that doesn't start with Test, which confuses py.test

diff --git a/rpython/translator/c/test/test_exception.py 
b/rpython/translator/c/test/test_exception.py
--- a/rpython/translator/c/test/test_exception.py
+++ b/rpython/translator/c/test/test_exception.py
@@ -9,7 +9,7 @@
 getcompiledopt = test_backendoptimized.TestTypedOptimizedTestCase().getcompiled
 
 
-class TestException(Exception):
+class InTestException(Exception):
 pass
 
 class MyException(Exception):
@@ -18,7 +18,7 @@
 def test_simple1():
 def raise_(i):
 if i == 0:
-raise TestException()
+raise InTestException()
 elif i == 1:
 raise MyException()
 else:
@@ -29,7 +29,7 @@
 b = raise_(i) + 12
 c = raise_(i) + 13
 return a+b+c
-except TestException:
+except InTestException:
 return 7
 except MyException:
 return 123
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Hack at our included py.test to fail, not quietly skip, when it sees a

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86815:0ace73a20a81
Date: 2016-09-01 11:03 +0100
http://bitbucket.org/pypy/pypy/changeset/0ace73a20a81/

Log:Hack at our included py.test to fail, not quietly skip, when it sees
a TestXxx class with an __init__() method

diff --git a/_pytest/python.py b/_pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -498,7 +498,10 @@
 """ Collector for test methods. """
 def collect(self):
 if hasinit(self.obj):
-pytest.skip("class %s.%s with __init__ won't get collected" % (
+# XXX used to be skip(), but silently skipping classes
+# XXX just because they have been written long ago is
+# XXX imho a very, very, very bad idea
+pytest.fail("class %s.%s with __init__ won't get collected" % (
 self.obj.__module__,
 self.obj.__name__,
 ))
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Don't put an __init__ in a Test class, it makes py.test skip(!?!!) that class

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86813:8e7fe0c9ab70
Date: 2016-09-01 11:49 +0200
http://bitbucket.org/pypy/pypy/changeset/8e7fe0c9ab70/

Log:Don't put an __init__ in a Test class, it makes py.test skip(!?!!)
that class

diff --git a/rpython/rlib/test/test_runicode.py 
b/rpython/rlib/test/test_runicode.py
--- a/rpython/rlib/test/test_runicode.py
+++ b/rpython/rlib/test/test_runicode.py
@@ -286,7 +286,7 @@
 
 
 class TestUTF8Decoding(UnicodeTests):
-def __init__(self):
+def setup_method(self, meth):
 self.decoder = self.getdecoder('utf-8')
 
 def to_bytestring(self, bytes):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Issue #2388: the problem is obscure interaction with a different call (I

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86812:7d6c66b14770
Date: 2016-09-01 10:26 +0200
http://bitbucket.org/pypy/pypy/changeset/7d6c66b14770/

Log:Issue #2388: the problem is obscure interaction with a different
call (I don't know which one) with the signature (string, float),
which was considered as more general than the signature (string,
int) of os.access().

diff --git a/rpython/annotator/binaryop.py b/rpython/annotator/binaryop.py
--- a/rpython/annotator/binaryop.py
+++ b/rpython/annotator/binaryop.py
@@ -17,7 +17,7 @@
 from rpython.flowspace.model import Variable, Constant, const
 from rpython.flowspace.operation import op
 from rpython.rlib import rarithmetic
-from rpython.annotator.model import AnnotatorError
+from rpython.annotator.model import AnnotatorError, TLS
 
 BINARY_OPERATIONS = set([oper.opname for oper in op.__dict__.values()
 if oper.dispatch == 2])
@@ -436,6 +436,11 @@
 class __extend__(pairtype(SomeFloat, SomeFloat)):
 
 def union((flt1, flt2)):
+if not TLS.allow_int_to_float:
+# in this mode, if one of the two is actually the
+# subclass SomeInteger, complain
+if isinstance(flt1, SomeInteger) or isinstance(flt2, SomeInteger):
+raise UnionError(flt1, flt2)
 return SomeFloat()
 
 add = sub = mul = union
diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
--- a/rpython/annotator/model.py
+++ b/rpython/annotator/model.py
@@ -44,6 +44,7 @@
 # A global attribute :-(  Patch it with 'True' to enable checking of
 # the no_nul attribute...
 check_str_without_nul = False
+allow_int_to_float = True
 TLS = State()
 
 class SomeObject(object):
diff --git a/rpython/rlib/rmarshal.py b/rpython/rlib/rmarshal.py
--- a/rpython/rlib/rmarshal.py
+++ b/rpython/rlib/rmarshal.py
@@ -346,11 +346,15 @@
 # on s_bigger.  It relies on the fact that s_bigger was created with
 # an expression like 'annotation([s_item])' which returns a ListDef with
 # no bookkeeper, on which side-effects are not allowed.
+saved = annmodel.TLS.allow_int_to_float
 try:
+annmodel.TLS.allow_int_to_float = False
 s_union = annmodel.unionof(s_bigger, s_smaller)
 return s_bigger.contains(s_union)
 except (annmodel.UnionError, TooLateForChange):
 return False
+finally:
+annmodel.TLS.allow_int_to_float = saved
 
 
 class __extend__(pairtype(MTag, annmodel.SomeObject)):
diff --git a/rpython/rlib/test/test_rmarshal.py 
b/rpython/rlib/test/test_rmarshal.py
--- a/rpython/rlib/test/test_rmarshal.py
+++ b/rpython/rlib/test/test_rmarshal.py
@@ -128,10 +128,12 @@
 
 def test_llinterp_marshal():
 from rpython.rtyper.test.test_llinterp import interpret
-marshaller = get_marshaller([(int, str, float)])
+marshaller1 = get_marshaller([(int, str, float)])
+marshaller2 = get_marshaller([(int, str, int)])
 def f():
 buf = []
-marshaller(buf, [(5, "hello", -0.5), (7, "world", 1E100)])
+marshaller1(buf, [(5, "hello", -0.5), (7, "world", 1E100)])
+marshaller2(buf, [(5, "hello", 1)])
 return ''.join(buf)
 res = interpret(f, [])
 res = ''.join(res.chars)
@@ -139,14 +141,20 @@
 assert res == ('[\x02\x00\x00\x00(\x03\x00\x00\x00i\x05\x00\x00\x00'
's\x05\x00\x00\x00hellof\x04-0.5(\x03\x00\x00\x00'
'i\x07\x00\x00\x00s\x05\x00\x00\x00world'
-   'f\x061e+100')
+   'f\x061e+100'
+   '[\x01\x00\x00\x00(\x03\x00\x00\x00i\x05\x00\x00\x00'
+   's\x05\x00\x00\x00helloi\x01\x00\x00\x00')
 else:
 assert res == ('[\x02\x00\x00\x00(\x03\x00\x00\x00'
'I\x05\x00\x00\x00\x00\x00\x00\x00'
's\x05\x00\x00\x00hellof\x04-0.5(\x03\x00\x00\x00'
'I\x07\x00\x00\x00\x00\x00\x00\x00'
's\x05\x00\x00\x00world'
-   'f\x061e+100')
+   'f\x061e+100'
+   '[\x01\x00\x00\x00(\x03\x00\x00\x00'
+   'I\x05\x00\x00\x00\x00\x00\x00\x00'
+   's\x05\x00\x00\x00hello'
+   'I\x01\x00\x00\x00\x00\x00\x00\x00')
 
 def test_llinterp_unmarshal():
 from rpython.rtyper.test.test_llinterp import interpret
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: pfff another hack on top of this pile of hacks

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86811:76e37b5f30ae
Date: 2016-09-01 09:50 +0200
http://bitbucket.org/pypy/pypy/changeset/76e37b5f30ae/

Log:pfff another hack on top of this pile of hacks

diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py
--- a/rpython/rlib/rdynload.py
+++ b/rpython/rlib/rdynload.py
@@ -170,11 +170,15 @@
 #
 # hck for 'pypy py.test -A' if libm.so is a linker script
 # (see reason in _dlerror_on_dlopen_untranslated())
+must_free = False
 if not we_are_translated() and platform.name == "linux":
 if name and rffi.charp2str(name) == 'libm.so':
-name = rffi.str2charp('libm.so.6', track_allocation=False)
+name = rffi.str2charp('libm.so.6')
+must_free = True
 #
 res = c_dlopen(name, rffi.cast(rffi.INT, mode))
+if must_free:
+rffi.free_charp(name)
 if not res:
 if not we_are_translated():
 err = _dlerror_on_dlopen_untranslated(name)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Another passing test

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86810:809a3f78b64f
Date: 2016-09-01 09:43 +0200
http://bitbucket.org/pypy/pypy/changeset/809a3f78b64f/

Log:Another passing test

diff --git a/rpython/translator/sandbox/test/test_sandbox.py 
b/rpython/translator/sandbox/test/test_sandbox.py
--- a/rpython/translator/sandbox/test/test_sandbox.py
+++ b/rpython/translator/sandbox/test/test_sandbox.py
@@ -29,6 +29,7 @@
 assert msg == fnname
 msg = read_message(f)
 assert msg == args
+assert [type(x) for x in msg] == [type(x) for x in args]
 if isinstance(result, Exception):
 write_exception(g, result)
 else:
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Add a passing test that direct running and annotation both crash

2016-09-01 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r86809:ce916c69cf00
Date: 2016-09-01 09:35 +0200
http://bitbucket.org/pypy/pypy/changeset/ce916c69cf00/

Log:Add a passing test that direct running and annotation both crash if
we give a float to an llexternal function expecting an int

diff --git a/rpython/rtyper/lltypesystem/test/test_rffi.py 
b/rpython/rtyper/lltypesystem/test/test_rffi.py
--- a/rpython/rtyper/lltypesystem/test/test_rffi.py
+++ b/rpython/rtyper/lltypesystem/test/test_rffi.py
@@ -38,6 +38,24 @@
 xf = self.compile(f, [])
 assert xf() == 8+3
 
+def test_no_float_to_int_conversion(self):
+c_source = py.code.Source("""
+int someexternalfunction(int x)
+{
+return (x + 3);
+}
+""")
+
+eci = ExternalCompilationInfo(separate_module_sources=[c_source])
+z = llexternal('someexternalfunction', [Signed], Signed,
+   compilation_info=eci)
+
+def f():
+return z(8.2)
+
+py.test.raises(TypeError, f)
+py.test.raises(TypeError, self.compile, f, [])
+
 def test_hashdefine(self):
 h_source = """
 #define X(i) (i+3)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit