[pypy-commit] pypy.org extradoc: Fix bogus source link to pypy2-v5.10.1

2018-04-20 Thread arigo
Author: Armin Rigo 
Branch: extradoc
Changeset: r922:11b8477b9161
Date: 2018-04-20 11:39 +0200
http://bitbucket.org/pypy/pypy.org/changeset/11b8477b9161/

Log:Fix bogus source link to pypy2-v5.10.1

diff --git a/download.html b/download.html
--- a/download.html
+++ b/download.html
@@ -269,7 +269,7 @@
 Alternatively, get one of the following smaller packages for the source at
 the same revision as the above binaries:
 
-https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.1-src.tar.bz2";>pypy2-v5.10.1-src.tar.bz2
 (sources, PyPy 2 only)
+https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.0-src.tar.bz2";>pypy2-v5.10.0-src.tar.bz2
 (sources, PyPy 2 only)
 https://bitbucket.org/pypy/pypy/downloads/pypy3-v5.10.1-src.tar.bz2";>pypy3-v5.10.1-src.tar.bz2
 (sources, PyPy 3 only)
 
 
diff --git a/source/download.txt b/source/download.txt
--- a/source/download.txt
+++ b/source/download.txt
@@ -309,10 +309,10 @@
Alternatively, get one of the following smaller packages for the source at
the same revision as the above binaries:
 
-   * `pypy2-v5.10.1-src.tar.bz2`__ (sources, PyPy 2 only)
+   * `pypy2-v5.10.0-src.tar.bz2`__ (sources, PyPy 2 only)
* `pypy3-v5.10.1-src.tar.bz2`__ (sources, PyPy 3 only)
 
-   .. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.1-src.tar.bz2
+   .. __: https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.10.0-src.tar.bz2
.. __: https://bitbucket.org/pypy/pypy/downloads/pypy3-v5.10.1-src.tar.bz2
 
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: merge default into py3.5

2018-04-20 Thread mattip
Author: Matti Picus 
Branch: py3.5
Changeset: r94393:580e3e26cd32
Date: 2018-04-20 14:21 +0300
http://bitbucket.org/pypy/pypy/changeset/580e3e26cd32/

Log:merge default into py3.5

diff --git a/pypy/doc/release-v6.0.0.rst b/pypy/doc/release-v6.0.0.rst
--- a/pypy/doc/release-v6.0.0.rst
+++ b/pypy/doc/release-v6.0.0.rst
@@ -18,6 +18,8 @@
 getting started writing code. We have improved our parser to emit more friendly
 `syntax errors`_,  making PyPy not only faster but more friendly.
 
+The GC now has `hooks`_ to gain more insights into its performance
+
 The Windows PyPy3.5 release is still considered beta-quality. There are open
 issues with unicode handling especially around system calls and c-extensions.
 
@@ -53,6 +55,7 @@
 .. _`blog post`: 
https://morepypy.blogspot.it/2017/10/cape-of-good-hope-for-pypy-hello-from.html
 .. _pygobject: https://lazka.github.io/posts/2018-04_pypy-pygobject/index.html
 .. _`syntax errors`: 
https://morepypy.blogspot.com/2018/04/improving-syntaxerror-in-pypy.html
+.. _`hooks`: gc_info.html#gc-hooks
 
 What is PyPy?
 =
@@ -101,8 +104,9 @@
 * Added missing attributes to C-API ``instancemethod`` on pypy3
 * Store error state in thread-local storage for C-API.
 * Fix JIT bugs exposed in the sre module
-* Improve speed of Python parser, improve ParseError messages slightly
+* Improve speed of Python parser, improve ParseError messages and SyntaxError
 * Handle JIT hooks more efficiently
+* Fix a rare GC bug exposed by intensive use of cpyext `Buffer` s
 
 We also refactored many parts of the JIT bridge optimizations, as well as 
cpyext
 internals, and together with new contributors fixed issues, added new
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
@@ -3,18 +3,7 @@
 ==
 
 .. this is a revision shortly after release-pypy-6.0.0
-.. startrev: f22145c34985
+.. startrev: ad79cc0ce9a8
 
 
-.. branch: issue2752
 
-Fix a rare GC bug that was introduced more than one year ago, but was
-not diagnosed before issue #2752.
-
-.. branch: gc-hooks
-
-Introduce GC hooks, as documented in doc/gc_info.rst
-
-.. branch: gc-hook-better-timestamp
-
-Improve GC hooks
diff --git a/pypy/doc/whatsnew-pypy2-6.0.0.rst 
b/pypy/doc/whatsnew-pypy2-6.0.0.rst
--- a/pypy/doc/whatsnew-pypy2-6.0.0.rst
+++ b/pypy/doc/whatsnew-pypy2-6.0.0.rst
@@ -113,3 +113,16 @@
 
 Improve line offsets that are reported by SyntaxError. Improve error messages
 for a few situations, including mismatched parenthesis.
+
+.. branch: issue2752
+
+Fix a rare GC bug that was introduced more than one year ago, but was
+not diagnosed before issue #2752.
+
+.. branch: gc-hooks
+
+Introduce GC hooks, as documented in doc/gc_info.rst
+
+.. branch: gc-hook-better-timestamp
+
+Improve GC hooksd
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: restart whatsnew-pypy3-head

2018-04-20 Thread mattip
Author: Matti Picus 
Branch: py3.5
Changeset: r94394:95916fa94a60
Date: 2018-04-20 14:23 +0300
http://bitbucket.org/pypy/pypy/changeset/95916fa94a60/

Log:restart whatsnew-pypy3-head

diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst
--- a/pypy/doc/whatsnew-pypy3-head.rst
+++ b/pypy/doc/whatsnew-pypy3-head.rst
@@ -3,5 +3,5 @@
 
 
 .. this is the revision after release-pypy3.5-v6.0
-.. startrev: bf74662ee4fa
+.. startrev: 580e3e26cd32
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-pypy2.7-6.x: merge default into release

2018-04-20 Thread mattip
Author: Matti Picus 
Branch: release-pypy2.7-6.x
Changeset: r94392:0f99a0bed290
Date: 2018-04-20 14:20 +0300
http://bitbucket.org/pypy/pypy/changeset/0f99a0bed290/

Log:merge default into release

diff too long, truncating to 2000 out of 4130 lines

diff --git a/pypy/doc/gc_info.rst b/pypy/doc/gc_info.rst
--- a/pypy/doc/gc_info.rst
+++ b/pypy/doc/gc_info.rst
@@ -121,6 +121,166 @@
   alive by GC objects, but not accounted in the GC
 
 
+GC Hooks
+
+
+GC hooks are user-defined functions which are called whenever a specific GC
+event occur, and can be used to monitor GC activity and pauses.  You can
+install the hooks by setting the following attributes:
+
+``gc.hook.on_gc_minor``
+Called whenever a minor collection occurs. It corresponds to
+``gc-minor`` sections inside ``PYPYLOG``.
+
+``gc.hook.on_gc_collect_step``
+Called whenever an incremental step of a major collection occurs. It
+corresponds to ``gc-collect-step`` sections inside ``PYPYLOG``.
+
+``gc.hook.on_gc_collect``
+Called after the last incremental step, when a major collection is fully
+done. It corresponds to ``gc-collect-done`` sections inside ``PYPYLOG``.
+
+To uninstall a hook, simply set the corresponding attribute to ``None``.  To
+install all hooks at once, you can call ``gc.hooks.set(obj)``, which will look
+for methods ``on_gc_*`` on ``obj``.  To uninstall all the hooks at once, you
+can call ``gc.hooks.reset()``.
+
+The functions called by the hooks receive a single ``stats`` argument, which
+contains various statistics about the event.
+
+Note that PyPy cannot call the hooks immediately after a GC event, but it has
+to wait until it reaches a point in which the interpreter is in a known state
+and calling user-defined code is harmless.  It might happen that multiple
+events occur before the hook is invoked: in this case, you can inspect the
+value ``stats.count`` to know how many times the event occured since the last
+time the hook was called.  Similarly, ``stats.duration`` contains the
+**total** time spent by the GC for this specific event since the last time the
+hook was called.
+
+On the other hand, all the other fields of the ``stats`` object are relative
+only to the **last** event of the series.
+
+The attributes for ``GcMinorStats`` are:
+
+``count``
+The number of minor collections occured since the last hook call.
+
+``duration``
+The total time spent inside minor collections since the last hook
+call. See below for more information on the unit.
+
+``duration_min``
+The duration of the fastest minor collection since the last hook call.
+
+``duration_max``
+The duration of the slowest minor collection since the last hook call.
+
+ ``total_memory_used``
+The amount of memory used at the end of the minor collection, in
+bytes. This include the memory used in arenas (for GC-managed memory) and
+raw-malloced memory (e.g., the content of numpy arrays).
+
+``pinned_objects``
+the number of pinned objects.
+
+
+The attributes for ``GcCollectStepStats`` are:
+
+``count``, ``duration``, ``duration_min``, ``duration_max``
+See above.
+
+``oldstate``, ``newstate``
+Integers which indicate the state of the GC before and after the step.
+
+The value of ``oldstate`` and ``newstate`` is one of these constants, defined
+inside ``gc.GcCollectStepStats``: ``STATE_SCANNING``, ``STATE_MARKING``,
+``STATE_SWEEPING``, ``STATE_FINALIZING``.  It is possible to get a string
+representation of it by indexing the ``GC_STATS`` tuple.
+
+
+The attributes for ``GcCollectStats`` are:
+
+``count``
+See above.
+
+``num_major_collects``
+The total number of major collections which have been done since the
+start. Contrarily to ``count``, this is an always-growing counter and it's
+not reset between invocations.
+
+``arenas_count_before``, ``arenas_count_after``
+Number of arenas used before and after the major collection.
+
+``arenas_bytes``
+Total number of bytes used by GC-managed objects.
+
+``rawmalloc_bytes_before``, ``rawmalloc_bytes_after``
+Total number of bytes used by raw-malloced objects, before and after the
+major collection.
+
+Note that ``GcCollectStats`` has **not** got a ``duration`` field. This is
+because all the GC work is done inside ``gc-collect-step``:
+``gc-collect-done`` is used only to give additional stats, but doesn't do any
+actual work.
+
+A note about the ``duration`` field: depending on the architecture and
+operating system, PyPy uses different ways to read timestamps, so ``duration``
+is expressed in varying units. It is possible to know which by calling
+``__pypy__.debug_get_timestamp_unit()``, which can be one of the following
+values:
+
+``tsc``
+The default on ``x86`` machines: timestamps are expressed in CPU ticks, as
+read by the `Time Stamp Counter`_.
+
+``ns``
+Timestamps are expressed in nanoseconds.
+
+``QueryPerformanceCounter``
+On Windows, in case for some reason ``tsc`` is not av

[pypy-commit] pypy release-pypy3.5-6.x: merge py3.5 into release

2018-04-20 Thread mattip
Author: Matti Picus 
Branch: release-pypy3.5-6.x
Changeset: r94395:aa0e948e1bc4
Date: 2018-04-20 14:25 +0300
http://bitbucket.org/pypy/pypy/changeset/aa0e948e1bc4/

Log:merge py3.5 into release

diff too long, truncating to 2000 out of 4118 lines

diff --git a/lib-python/3/test/test_exceptions.py 
b/lib-python/3/test/test_exceptions.py
--- a/lib-python/3/test/test_exceptions.py
+++ b/lib-python/3/test/test_exceptions.py
@@ -164,10 +164,10 @@
 
 is_pypy = check_impl_detail(pypy=True)
 check('def fact(x):\n\treturn x!\n', 2, 10)
-check('1 +\n', 1, 4 - is_pypy)
-check('def spam():\n  print(1)\n print(2)', 3, 0 if is_pypy else 10)
-check('Python = "Python" +', 1, 20 - is_pypy)
-check('Python = "\u1e54\xfd\u0163\u0125\xf2\xf1" +', 1, 20 - is_pypy)
+check('1 +\n', 1, 4)
+check('def spam():\n  print(1)\n print(2)', 3, 2 if is_pypy else 10)
+check('Python = "Python" +', 1, 20)
+check('Python = "\u1e54\xfd\u0163\u0125\xf2\xf1" +', 1, 20)
 
 @cpython_only
 def testSettingException(self):
diff --git a/lib-python/3/test/test_fstring.py 
b/lib-python/3/test/test_fstring.py
--- a/lib-python/3/test/test_fstring.py
+++ b/lib-python/3/test/test_fstring.py
@@ -319,7 +319,7 @@
 ["f'{3)+(4}'",
  ])
 
-self.assertAllRaise(SyntaxError, 'EOL while scanning string literal',
+self.assertAllRaise(SyntaxError, r'end of line \(EOL\) while scanning 
string literal',
 ["f'{\n}'",
  ])
 
@@ -741,7 +741,7 @@
 self.assertEqual('{d[0]}'.format(d=d), 'integer')
 
 def test_invalid_expressions(self):
-self.assertAllRaise(SyntaxError, 'invalid syntax',
+self.assertAllRaise(SyntaxError, "closing parenthesis '.' does not 
match opening parenthesis '.'",
 [r"f'{a[4)}'",
  r"f'{a(4]}'",
 ])
diff --git a/pypy/doc/gc_info.rst b/pypy/doc/gc_info.rst
--- a/pypy/doc/gc_info.rst
+++ b/pypy/doc/gc_info.rst
@@ -121,6 +121,166 @@
   alive by GC objects, but not accounted in the GC
 
 
+GC Hooks
+
+
+GC hooks are user-defined functions which are called whenever a specific GC
+event occur, and can be used to monitor GC activity and pauses.  You can
+install the hooks by setting the following attributes:
+
+``gc.hook.on_gc_minor``
+Called whenever a minor collection occurs. It corresponds to
+``gc-minor`` sections inside ``PYPYLOG``.
+
+``gc.hook.on_gc_collect_step``
+Called whenever an incremental step of a major collection occurs. It
+corresponds to ``gc-collect-step`` sections inside ``PYPYLOG``.
+
+``gc.hook.on_gc_collect``
+Called after the last incremental step, when a major collection is fully
+done. It corresponds to ``gc-collect-done`` sections inside ``PYPYLOG``.
+
+To uninstall a hook, simply set the corresponding attribute to ``None``.  To
+install all hooks at once, you can call ``gc.hooks.set(obj)``, which will look
+for methods ``on_gc_*`` on ``obj``.  To uninstall all the hooks at once, you
+can call ``gc.hooks.reset()``.
+
+The functions called by the hooks receive a single ``stats`` argument, which
+contains various statistics about the event.
+
+Note that PyPy cannot call the hooks immediately after a GC event, but it has
+to wait until it reaches a point in which the interpreter is in a known state
+and calling user-defined code is harmless.  It might happen that multiple
+events occur before the hook is invoked: in this case, you can inspect the
+value ``stats.count`` to know how many times the event occured since the last
+time the hook was called.  Similarly, ``stats.duration`` contains the
+**total** time spent by the GC for this specific event since the last time the
+hook was called.
+
+On the other hand, all the other fields of the ``stats`` object are relative
+only to the **last** event of the series.
+
+The attributes for ``GcMinorStats`` are:
+
+``count``
+The number of minor collections occured since the last hook call.
+
+``duration``
+The total time spent inside minor collections since the last hook
+call. See below for more information on the unit.
+
+``duration_min``
+The duration of the fastest minor collection since the last hook call.
+
+``duration_max``
+The duration of the slowest minor collection since the last hook call.
+
+ ``total_memory_used``
+The amount of memory used at the end of the minor collection, in
+bytes. This include the memory used in arenas (for GC-managed memory) and
+raw-malloced memory (e.g., the content of numpy arrays).
+
+``pinned_objects``
+the number of pinned objects.
+
+
+The attributes for ``GcCollectStepStats`` are:
+
+``count``, ``duration``, ``duration_min``, ``duration_max``
+See above.
+
+``oldstate``, ``newstate``
+Integers which indicate the state of the GC before and after the

[pypy-commit] pypy default: restart whatsnew-head, release notice

2018-04-20 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r94391:8941ee7fcd8f
Date: 2018-04-20 14:13 +0300
http://bitbucket.org/pypy/pypy/changeset/8941ee7fcd8f/

Log:restart whatsnew-head, release notice

diff --git a/pypy/doc/release-v6.0.0.rst b/pypy/doc/release-v6.0.0.rst
--- a/pypy/doc/release-v6.0.0.rst
+++ b/pypy/doc/release-v6.0.0.rst
@@ -18,6 +18,8 @@
 getting started writing code. We have improved our parser to emit more friendly
 `syntax errors`_,  making PyPy not only faster but more friendly.
 
+The GC now has `hooks`_ to gain more insights into its performance
+
 The Windows PyPy3.5 release is still considered beta-quality. There are open
 issues with unicode handling especially around system calls and c-extensions.
 
@@ -53,6 +55,7 @@
 .. _`blog post`: 
https://morepypy.blogspot.it/2017/10/cape-of-good-hope-for-pypy-hello-from.html
 .. _pygobject: https://lazka.github.io/posts/2018-04_pypy-pygobject/index.html
 .. _`syntax errors`: 
https://morepypy.blogspot.com/2018/04/improving-syntaxerror-in-pypy.html
+.. _`hooks`: gc_info.html#gc-hooks
 
 What is PyPy?
 =
@@ -101,8 +104,9 @@
 * Added missing attributes to C-API ``instancemethod`` on pypy3
 * Store error state in thread-local storage for C-API.
 * Fix JIT bugs exposed in the sre module
-* Improve speed of Python parser, improve ParseError messages slightly
+* Improve speed of Python parser, improve ParseError messages and SyntaxError
 * Handle JIT hooks more efficiently
+* Fix a rare GC bug exposed by intensive use of cpyext `Buffer` s
 
 We also refactored many parts of the JIT bridge optimizations, as well as 
cpyext
 internals, and together with new contributors fixed issues, added new
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
@@ -3,18 +3,7 @@
 ==
 
 .. this is a revision shortly after release-pypy-6.0.0
-.. startrev: f22145c34985
+.. startrev: ad79cc0ce9a8
 
 
-.. branch: issue2752
 
-Fix a rare GC bug that was introduced more than one year ago, but was
-not diagnosed before issue #2752.
-
-.. branch: gc-hooks
-
-Introduce GC hooks, as documented in doc/gc_info.rst
-
-.. branch: gc-hook-better-timestamp
-
-Improve GC hooks
diff --git a/pypy/doc/whatsnew-pypy2-6.0.0.rst 
b/pypy/doc/whatsnew-pypy2-6.0.0.rst
--- a/pypy/doc/whatsnew-pypy2-6.0.0.rst
+++ b/pypy/doc/whatsnew-pypy2-6.0.0.rst
@@ -109,3 +109,16 @@
 
 Improve line offsets that are reported by SyntaxError. Improve error messages
 for a few situations, including mismatched parenthesis.
+
+.. branch: issue2752
+
+Fix a rare GC bug that was introduced more than one year ago, but was
+not diagnosed before issue #2752.
+
+.. branch: gc-hooks
+
+Introduce GC hooks, as documented in doc/gc_info.rst
+
+.. branch: gc-hook-better-timestamp
+
+Improve GC hooksd
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: Test that tp_basicsize is correctly set (fails on py3.5)

2018-04-20 Thread rlamy
Author: Ronan Lamy 
Branch: 
Changeset: r94396:2a9fc2de357a
Date: 2018-04-20 17:12 +0100
http://bitbucket.org/pypy/pypy/changeset/2a9fc2de357a/

Log:Test that tp_basicsize is correctly set (fails on py3.5)

diff --git a/pypy/module/cpyext/test/test_datetime.py 
b/pypy/module/cpyext/test/test_datetime.py
--- a/pypy/module/cpyext/test/test_datetime.py
+++ b/pypy/module/cpyext/test/test_datetime.py
@@ -1,3 +1,5 @@
+import pytest
+
 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
 from pypy.module.cpyext.test.test_api import BaseApiTest
 from pypy.module.cpyext.cdatetime import *
@@ -82,6 +84,14 @@
 date = datetime.datetime.fromtimestamp(0)
 assert space.unwrap(space.str(w_date)) == str(date)
 
+@pytest.mark.parametrize('name', ['Time', 'DateTime', 'Date', 'Delta'])
+def test_basicsize(self, space, name):
+datetime = _PyDateTime_Import(space)
+py_size = getattr(datetime, "c_%sType" % name).c_tp_basicsize
+c_size = rffi.sizeof(cts.gettype("PyDateTime_%s" % name))
+assert py_size == c_size
+
+
 class AppTestDatetime(AppTestCpythonExtensionBase):
 def test_CAPI(self):
 module = self.import_extension('foo', [
@@ -271,9 +281,9 @@
 6, 6, 6, 6, args, PyDateTimeAPI->TimeType);
  """),
 ("datetime_with_tzinfo", "METH_O",
- """ 
+ """
  PyObject * obj;
- int tzrefcnt = args->ob_refcnt; 
+ int tzrefcnt = args->ob_refcnt;
  PyDateTime_IMPORT;
  obj = PyDateTimeAPI->DateTime_FromDateAndTime(
 2000, 6, 6, 6, 6, 6, 6, args,
@@ -291,7 +301,7 @@
 return NULL;
 }
 return obj;
-
+
  """),
 ], prologue='#include "datetime.h"\n')
 from datetime import tzinfo, datetime, timedelta, time
@@ -339,4 +349,4 @@
 assert module.checks(o) == (True,) * 3 + (False,) * 7 # 
isinstance(datetime, date)
 o = tzinfo()
 assert module.checks(o) == (False,) * 8 + (True,) * 2
-
+
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: hg merge default

2018-04-20 Thread rlamy
Author: Ronan Lamy 
Branch: py3.5
Changeset: r94397:b7da70a8fd2c
Date: 2018-04-20 17:13 +0100
http://bitbucket.org/pypy/pypy/changeset/b7da70a8fd2c/

Log:hg merge default

diff --git a/pypy/module/cpyext/test/test_datetime.py 
b/pypy/module/cpyext/test/test_datetime.py
--- a/pypy/module/cpyext/test/test_datetime.py
+++ b/pypy/module/cpyext/test/test_datetime.py
@@ -1,3 +1,5 @@
+import pytest
+
 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
 from pypy.module.cpyext.test.test_api import BaseApiTest
 from pypy.module.cpyext.cdatetime import *
@@ -82,6 +84,14 @@
 date = datetime.datetime.fromtimestamp(0)
 assert space.unwrap(space.str(w_date)) == str(date)
 
+@pytest.mark.parametrize('name', ['Time', 'DateTime', 'Date', 'Delta'])
+def test_basicsize(self, space, name):
+datetime = _PyDateTime_Import(space)
+py_size = getattr(datetime, "c_%sType" % name).c_tp_basicsize
+c_size = rffi.sizeof(cts.gettype("PyDateTime_%s" % name))
+assert py_size == c_size
+
+
 class AppTestDatetime(AppTestCpythonExtensionBase):
 def test_CAPI(self):
 module = self.import_extension('foo', [
@@ -271,9 +281,9 @@
 6, 6, 6, 6, args, PyDateTimeAPI->TimeType);
  """),
 ("datetime_with_tzinfo", "METH_O",
- """ 
+ """
  PyObject * obj;
- int tzrefcnt = args->ob_refcnt; 
+ int tzrefcnt = args->ob_refcnt;
  PyDateTime_IMPORT;
  obj = PyDateTimeAPI->DateTime_FromDateAndTime(
 2000, 6, 6, 6, 6, 6, 6, args,
@@ -291,7 +301,7 @@
 return NULL;
 }
 return obj;
-
+
  """),
 ], prologue='#include "datetime.h"\n')
 from datetime import tzinfo, datetime, timedelta, time
@@ -339,4 +349,4 @@
 assert module.checks(o) == (True,) * 3 + (False,) * 7 # 
isinstance(datetime, date)
 o = tzinfo()
 assert module.checks(o) == (False,) * 8 + (True,) * 2
-
+
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.5: Brute-force tp_basicsize to the correct value on the datetime types

2018-04-20 Thread rlamy
Author: Ronan Lamy 
Branch: py3.5
Changeset: r94398:7ac5e33a8260
Date: 2018-04-20 23:33 +0100
http://bitbucket.org/pypy/pypy/changeset/7ac5e33a8260/

Log:Brute-force tp_basicsize to the correct value on the datetime types

diff --git a/pypy/module/__pypy__/interp_pypydatetime.py 
b/pypy/module/__pypy__/interp_pypydatetime.py
--- a/pypy/module/__pypy__/interp_pypydatetime.py
+++ b/pypy/module/__pypy__/interp_pypydatetime.py
@@ -5,7 +5,7 @@
 
 def create_class(name):
 class W_Class(W_Root):
-'builtin base clasee for datetime.%s to allow interop with cpyext' % 
name
+'builtin base class for datetime.%s to allow interop with cpyext' % 
name
 def descr_new__(space, w_type):
 return space.allocate_instance(W_Class, w_type)
 
diff --git a/pypy/module/cpyext/cdatetime.py b/pypy/module/cpyext/cdatetime.py
--- a/pypy/module/cpyext/cdatetime.py
+++ b/pypy/module/cpyext/cdatetime.py
@@ -40,18 +40,26 @@
 w_type = space.getattr(w_datetime, space.newtext("datetime"))
 datetimeAPI.c_DateTimeType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_DateTimeType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_DateTime'))
 
 w_type = space.getattr(w_datetime, space.newtext("time"))
 datetimeAPI.c_TimeType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_TimeType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_Time'))
 
 w_type = space.getattr(w_datetime, space.newtext("timedelta"))
 datetimeAPI.c_DeltaType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_DeltaType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_Delta'))
 
 w_type = space.getattr(w_datetime, space.newtext("tzinfo"))
 datetimeAPI.c_TZInfoType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_TZInfoType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_TZInfo'))
 
 datetimeAPI.c_Date_FromDate = llhelper(
 _PyDate_FromDate.api_func.functype,
@@ -124,7 +132,7 @@
 # app level datetime.date. If a c-extension class uses datetime.date for 
its
 # base class and defines a tp_dealloc, we will get this:
 # c_class->tp_dealloc == tp_dealloc_func
-# c_class->tp_base == datetime.date, 
+# c_class->tp_base == datetime.date,
 # datetime.date->tp_dealloc = _PyPy_subtype_dealloc
 # datetime.date->tp_base = W_DateTime_Date
 #W_DateTime_Date->tp_dealloc = _PyPy_subtype_dealloc
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.6: hg merge py3.5

2018-04-20 Thread rlamy
Author: Ronan Lamy 
Branch: py3.6
Changeset: r94399:d1a46c216644
Date: 2018-04-20 23:47 +0100
http://bitbucket.org/pypy/pypy/changeset/d1a46c216644/

Log:hg merge py3.5

diff --git a/pypy/doc/release-v6.0.0.rst b/pypy/doc/release-v6.0.0.rst
--- a/pypy/doc/release-v6.0.0.rst
+++ b/pypy/doc/release-v6.0.0.rst
@@ -18,6 +18,8 @@
 getting started writing code. We have improved our parser to emit more friendly
 `syntax errors`_,  making PyPy not only faster but more friendly.
 
+The GC now has `hooks`_ to gain more insights into its performance
+
 The Windows PyPy3.5 release is still considered beta-quality. There are open
 issues with unicode handling especially around system calls and c-extensions.
 
@@ -53,6 +55,7 @@
 .. _`blog post`: 
https://morepypy.blogspot.it/2017/10/cape-of-good-hope-for-pypy-hello-from.html
 .. _pygobject: https://lazka.github.io/posts/2018-04_pypy-pygobject/index.html
 .. _`syntax errors`: 
https://morepypy.blogspot.com/2018/04/improving-syntaxerror-in-pypy.html
+.. _`hooks`: gc_info.html#gc-hooks
 
 What is PyPy?
 =
@@ -101,8 +104,9 @@
 * Added missing attributes to C-API ``instancemethod`` on pypy3
 * Store error state in thread-local storage for C-API.
 * Fix JIT bugs exposed in the sre module
-* Improve speed of Python parser, improve ParseError messages slightly
+* Improve speed of Python parser, improve ParseError messages and SyntaxError
 * Handle JIT hooks more efficiently
+* Fix a rare GC bug exposed by intensive use of cpyext `Buffer` s
 
 We also refactored many parts of the JIT bridge optimizations, as well as 
cpyext
 internals, and together with new contributors fixed issues, added new
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
@@ -3,18 +3,7 @@
 ==
 
 .. this is a revision shortly after release-pypy-6.0.0
-.. startrev: f22145c34985
+.. startrev: ad79cc0ce9a8
 
 
-.. branch: issue2752
 
-Fix a rare GC bug that was introduced more than one year ago, but was
-not diagnosed before issue #2752.
-
-.. branch: gc-hooks
-
-Introduce GC hooks, as documented in doc/gc_info.rst
-
-.. branch: gc-hook-better-timestamp
-
-Improve GC hooks
diff --git a/pypy/doc/whatsnew-pypy2-6.0.0.rst 
b/pypy/doc/whatsnew-pypy2-6.0.0.rst
--- a/pypy/doc/whatsnew-pypy2-6.0.0.rst
+++ b/pypy/doc/whatsnew-pypy2-6.0.0.rst
@@ -113,3 +113,16 @@
 
 Improve line offsets that are reported by SyntaxError. Improve error messages
 for a few situations, including mismatched parenthesis.
+
+.. branch: issue2752
+
+Fix a rare GC bug that was introduced more than one year ago, but was
+not diagnosed before issue #2752.
+
+.. branch: gc-hooks
+
+Introduce GC hooks, as documented in doc/gc_info.rst
+
+.. branch: gc-hook-better-timestamp
+
+Improve GC hooksd
diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst
--- a/pypy/doc/whatsnew-pypy3-head.rst
+++ b/pypy/doc/whatsnew-pypy3-head.rst
@@ -3,5 +3,5 @@
 
 
 .. this is the revision after release-pypy3.5-v6.0
-.. startrev: bf74662ee4fa
+.. startrev: 580e3e26cd32
 
diff --git a/pypy/module/__pypy__/interp_pypydatetime.py 
b/pypy/module/__pypy__/interp_pypydatetime.py
--- a/pypy/module/__pypy__/interp_pypydatetime.py
+++ b/pypy/module/__pypy__/interp_pypydatetime.py
@@ -5,7 +5,7 @@
 
 def create_class(name):
 class W_Class(W_Root):
-'builtin base clasee for datetime.%s to allow interop with cpyext' % 
name
+'builtin base class for datetime.%s to allow interop with cpyext' % 
name
 def descr_new__(space, w_type):
 return space.allocate_instance(W_Class, w_type)
 
diff --git a/pypy/module/cpyext/cdatetime.py b/pypy/module/cpyext/cdatetime.py
--- a/pypy/module/cpyext/cdatetime.py
+++ b/pypy/module/cpyext/cdatetime.py
@@ -40,18 +40,26 @@
 w_type = space.getattr(w_datetime, space.newtext("datetime"))
 datetimeAPI.c_DateTimeType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_DateTimeType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_DateTime'))
 
 w_type = space.getattr(w_datetime, space.newtext("time"))
 datetimeAPI.c_TimeType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_TimeType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_Time'))
 
 w_type = space.getattr(w_datetime, space.newtext("timedelta"))
 datetimeAPI.c_DeltaType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_DeltaType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_Delta'))
 
 w_type = space.getattr(w_datetime, space.newtext("tzinfo"))
 datetimeAPI.c_TZInfoType = rffi.cast(
 PyTypeObjectPtr, make_ref(space, w_type))
+datetimeAPI.c_TZInfoType.c_tp_basicsize = rffi.sizeof(
+cts.gettype('PyDateTime_TZInfo'))
 
 datetimeAPI.c_Date_FromDate = llhelper(
 _PyDate_FromDate.api_func.functype

[pypy-commit] pypy cppyy-packaging: naming consistency w/ CPython/cppyy

2018-04-20 Thread wlav
Author: Wim Lavrijsen 
Branch: cppyy-packaging
Changeset: r94400:0df7710aad8b
Date: 2017-10-30 13:14 -0700
http://bitbucket.org/pypy/pypy/changeset/0df7710aad8b/

Log:naming consistency w/ CPython/cppyy

diff --git a/pypy/module/_cppyy/__init__.py b/pypy/module/_cppyy/__init__.py
--- a/pypy/module/_cppyy/__init__.py
+++ b/pypy/module/_cppyy/__init__.py
@@ -13,7 +13,7 @@
 '_set_function_generator': 'interp_cppyy.set_function_generator',
 '_register_class': 'interp_cppyy.register_class',
 '_get_nullptr'   : 'interp_cppyy.get_nullptr',
-'CPPClassBase'   : 'interp_cppyy.W_CPPClass',
+'CPPInstanceBase': 'interp_cppyy.W_CPPInstance',
 'addressof'  : 'interp_cppyy.addressof',
 '_bind_object'   : 'interp_cppyy._bind_object',
 'bind_object': 'interp_cppyy.bind_object',
diff --git a/pypy/module/_cppyy/capi/loadable_capi.py 
b/pypy/module/_cppyy/capi/loadable_capi.py
--- a/pypy/module/_cppyy/capi/loadable_capi.py
+++ b/pypy/module/_cppyy/capi/loadable_capi.py
@@ -607,7 +607,7 @@
 """Return a python string taking into account \0"""
 
 from pypy.module._cppyy import interp_cppyy
-cppstr = space.interp_w(interp_cppyy.W_CPPClass, w_self, can_be_None=False)
+cppstr = space.interp_w(interp_cppyy.W_CPPInstance, w_self, 
can_be_None=False)
 return space.newtext(c_stdstring2charp(space, cppstr._rawobject))
 
 # setup pythonizations for later use at run-time
diff --git a/pypy/module/_cppyy/converter.py b/pypy/module/_cppyy/converter.py
--- a/pypy/module/_cppyy/converter.py
+++ b/pypy/module/_cppyy/converter.py
@@ -22,8 +22,8 @@
 
 
 def get_rawobject(space, w_obj, can_be_None=True):
-from pypy.module._cppyy.interp_cppyy import W_CPPClass
-cppinstance = space.interp_w(W_CPPClass, w_obj, can_be_None=can_be_None)
+from pypy.module._cppyy.interp_cppyy import W_CPPInstance
+cppinstance = space.interp_w(W_CPPInstance, w_obj, can_be_None=can_be_None)
 if cppinstance:
 rawobject = cppinstance.get_rawobject()
 assert lltype.typeOf(rawobject) == capi.C_OBJECT
@@ -31,15 +31,15 @@
 return capi.C_NULL_OBJECT
 
 def set_rawobject(space, w_obj, address):
-from pypy.module._cppyy.interp_cppyy import W_CPPClass
-cppinstance = space.interp_w(W_CPPClass, w_obj, can_be_None=True)
+from pypy.module._cppyy.interp_cppyy import W_CPPInstance
+cppinstance = space.interp_w(W_CPPInstance, w_obj, can_be_None=True)
 if cppinstance:
 assert lltype.typeOf(cppinstance._rawobject) == capi.C_OBJECT
 cppinstance._rawobject = rffi.cast(capi.C_OBJECT, address)
 
 def get_rawobject_nonnull(space, w_obj):
-from pypy.module._cppyy.interp_cppyy import W_CPPClass
-cppinstance = space.interp_w(W_CPPClass, w_obj, can_be_None=True)
+from pypy.module._cppyy.interp_cppyy import W_CPPInstance
+cppinstance = space.interp_w(W_CPPInstance, w_obj, can_be_None=True)
 if cppinstance:
 cppinstance._nullcheck()
 rawobject = cppinstance.get_rawobject()
@@ -502,8 +502,8 @@
 self.clsdecl = clsdecl
 
 def _unwrap_object(self, space, w_obj):
-from pypy.module._cppyy.interp_cppyy import W_CPPClass
-if isinstance(w_obj, W_CPPClass):
+from pypy.module._cppyy.interp_cppyy import W_CPPInstance
+if isinstance(w_obj, W_CPPInstance):
 from pypy.module._cppyy.interp_cppyy import 
INSTANCE_FLAGS_IS_R_VALUE
 if w_obj.flags & INSTANCE_FLAGS_IS_R_VALUE:
 # reject moves as all are explicit
@@ -534,8 +534,8 @@
 class InstanceMoveConverter(InstanceRefConverter):
 def _unwrap_object(self, space, w_obj):
 # moving is same as by-ref, but have to check that move is allowed
-from pypy.module._cppyy.interp_cppyy import W_CPPClass, 
INSTANCE_FLAGS_IS_R_VALUE
-if isinstance(w_obj, W_CPPClass):
+from pypy.module._cppyy.interp_cppyy import W_CPPInstance, 
INSTANCE_FLAGS_IS_R_VALUE
+if isinstance(w_obj, W_CPPInstance):
 if w_obj.flags & INSTANCE_FLAGS_IS_R_VALUE:
 w_obj.flags &= ~INSTANCE_FLAGS_IS_R_VALUE
 return InstanceRefConverter._unwrap_object(self, space, w_obj)
@@ -598,8 +598,8 @@
 raise FastCallNotPossible
 
 def finalize_call(self, space, w_obj, call_local):
-from pypy.module._cppyy.interp_cppyy import W_CPPClass
-assert isinstance(w_obj, W_CPPClass)
+from pypy.module._cppyy.interp_cppyy import W_CPPInstance
+assert isinstance(w_obj, W_CPPInstance)
 r = rffi.cast(rffi.VOIDPP, call_local)
 w_obj._rawobject = rffi.cast(capi.C_OBJECT, r[0])
 
@@ -617,8 +617,8 @@
 InstanceConverter.__init__(self, space, cppclass)
 
 def _unwrap_object(self, space, w_obj):
-from pypy.module._cppyy.interp_cppyy import W_CPPClass
-if isinstance(w_obj, W_CPPClass):
+from pypy.module._cppyy.interp_cppyy impo

[pypy-commit] pypy cppyy-packaging: merge default into branch

2018-04-20 Thread wlav
Author: Wim Lavrijsen 
Branch: cppyy-packaging
Changeset: r94402:b74ad9bd1274
Date: 2018-01-26 14:27 -0800
http://bitbucket.org/pypy/pypy/changeset/b74ad9bd1274/

Log:merge default into branch

diff too long, truncating to 2000 out of 93932 lines

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -44,3 +44,10 @@
 d72f9800a42b46a8056951b1da2426d2c2d8d502 release-pypy3.5-v5.9.0
 03d614975835870da65ff0481e1edad68ebbcb8d release-pypy2.7-v5.9.0
 84a2f3e6a7f88f2fe698e473998755b3bd1a12e2 release-pypy2.7-v5.9.0
+0e7ea4fe15e82d5124e805e2e4a37cae1a402d4b release-pypy2.7-v5.10.0
+a91df6163fb76df245091f741dbf6a23ddc72374 release-pypy3.5-v5.10.0
+a91df6163fb76df245091f741dbf6a23ddc72374 release-pypy3.5-v5.10.0
+ release-pypy3.5-v5.10.0
+ release-pypy3.5-v5.10.0
+09f9160b643e3f02ccb8c843b2fbb4e5cbf54082 release-pypy3.5-v5.10.0
+3f6eaa010fce78cc7973bdc1dfdb95970f08fed2 release-pypy3.5-v5.10.1
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -30,7 +30,7 @@
 DEALINGS IN THE SOFTWARE.
 
 
-PyPy Copyright holders 2003-2017
+PyPy Copyright holders 2003-2018
 --- 
 
 Except when otherwise stated (look for LICENSE files or information at
@@ -339,8 +339,10 @@
   Stanisław Halik
   Julien Phalip
   Roman Podoliaka
+  Steve Papanik
   Eli Stevens
   Boglarka Vezer
+  gabrielg
   PavloKapyshin
   Tomer Chachamu
   Christopher Groskopf
@@ -363,11 +365,13 @@
   Konrad Delong
   Dinu Gherman
   pizi
+  Tomáš Pružina
   James Robert
   Armin Ronacher
   Diana Popa
   Mads Kiilerich
   Brett Cannon
+  Caleb Hattingh
   aliceinwire
   Zooko Wilcox-O Hearn
   James Lan
@@ -388,6 +392,7 @@
   Jason Madden
   Yaroslav Fedevych
   Even Wiik Thomassen
+  m...@funkyhat.org
   Stefan Marr
 
   Heinrich-Heine University, Germany 
diff --git a/_pytest/terminal.py b/_pytest/terminal.py
--- a/_pytest/terminal.py
+++ b/_pytest/terminal.py
@@ -366,11 +366,11 @@
 EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, EXIT_USAGEERROR,
 EXIT_NOTESTSCOLLECTED)
 if exitstatus in summary_exit_codes:
-self.config.hook.pytest_terminal_summary(terminalreporter=self)
 self.summary_errors()
 self.summary_failures()
 self.summary_warnings()
 self.summary_passes()
+self.config.hook.pytest_terminal_summary(terminalreporter=self)
 if exitstatus == EXIT_INTERRUPTED:
 self._report_keyboardinterrupt()
 del self._keyboardinterrupt_memo
diff --git a/extra_tests/requirements.txt b/extra_tests/requirements.txt
new file mode 100644
--- /dev/null
+++ b/extra_tests/requirements.txt
@@ -0,0 +1,3 @@
+pytest
+hypothesis
+vmprof
diff --git a/extra_tests/test_bytes.py b/extra_tests/test_bytes.py
new file mode 100644
--- /dev/null
+++ b/extra_tests/test_bytes.py
@@ -0,0 +1,84 @@
+from hypothesis import strategies as st
+from hypothesis import given, example
+
+st_bytestring = st.binary() | st.binary().map(bytearray)
+
+@given(st_bytestring, st_bytestring, st_bytestring)
+def test_find(u, prefix, suffix):
+s = prefix + u + suffix
+assert 0 <= s.find(u) <= len(prefix)
+assert s.find(u, len(prefix), len(s) - len(suffix)) == len(prefix)
+
+@given(st_bytestring, st_bytestring, st_bytestring)
+def test_index(u, prefix, suffix):
+s = prefix + u + suffix
+assert 0 <= s.index(u) <= len(prefix)
+assert s.index(u, len(prefix), len(s) - len(suffix)) == len(prefix)
+
+@given(st_bytestring, st_bytestring, st_bytestring)
+def test_rfind(u, prefix, suffix):
+s = prefix + u + suffix
+assert s.rfind(u) >= len(prefix)
+assert s.rfind(u, len(prefix), len(s) - len(suffix)) == len(prefix)
+
+@given(st_bytestring, st_bytestring, st_bytestring)
+def test_rindex(u, prefix, suffix):
+s = prefix + u + suffix
+assert s.rindex(u) >= len(prefix)
+assert s.rindex(u, len(prefix), len(s) - len(suffix)) == len(prefix)
+
+def adjust_indices(u, start, end):
+if end < 0:
+end = max(end + len(u), 0)
+else:
+end = min(end, len(u))
+if start < 0:
+start = max(start + len(u), 0)
+return start, end
+
+@given(st_bytestring, st_bytestring)
+def test_startswith_basic(u, v):
+assert u.startswith(v) is (u[:len(v)] == v)
+
+@example(b'x', b'', 1)
+@example(b'x', b'', 2)
+@given(st_bytestring, st_bytestring, st.integers())
+def test_startswith_start(u, v, start):
+expected = u[start:].startswith(v) if v else (start <= len(u))
+assert u.startswith(v, start) is expected
+
+@example(b'x', b'', 1, 0)
+@example(b'xx', b'', -1, 0)
+@given(st_bytestring, st_bytestring, st.integers(), st.integers())
+def test_startswith_3(u, v, start, end):
+if v:
+expected = u[start:end].startswith(v)
+else:  # CPython leaks implementation details in this case
+start0, end0 = adjust_indices(u, start, end)
+expected = start0 <= len(u) and start0 <= end0
+   

[pypy-commit] pypy cppyy-packaging: fix C++ warnings

2018-04-20 Thread wlav
Author: Wim Lavrijsen 
Branch: cppyy-packaging
Changeset: r94401:edb9132eda33
Date: 2017-10-30 13:17 -0700
http://bitbucket.org/pypy/pypy/changeset/edb9132eda33/

Log:fix C++ warnings

diff --git a/pypy/module/_cppyy/test/advancedcpp.h 
b/pypy/module/_cppyy/test/advancedcpp.h
--- a/pypy/module/_cppyy/test/advancedcpp.h
+++ b/pypy/module/_cppyy/test/advancedcpp.h
@@ -59,7 +59,7 @@
 class a_class {// for esoteric inheritance testing
 public:
 a_class() { m_a = 1; m_da = 1.1; }
-~a_class() {}
+virtual ~a_class() {}
 virtual int get_value() = 0;
 
 public:
@@ -221,6 +221,7 @@
 //===
 class some_abstract_class {// to test abstract class handling
 public:
+virtual ~some_abstract_class() {}
 virtual void a_virtual_method() = 0;
 };
 
diff --git a/pypy/module/_cppyy/test/fragile.h 
b/pypy/module/_cppyy/test/fragile.h
--- a/pypy/module/_cppyy/test/fragile.h
+++ b/pypy/module/_cppyy/test/fragile.h
@@ -30,6 +30,7 @@
 void overload(int, no_such_class* p = 0) {}
 };
 
+
 static const int dummy_location = 0xdead;
 
 class E {
@@ -105,6 +106,7 @@
 
 class M {
 public:
+virtual ~M() {}
 enum E1 { kOnce=42 };
 enum E2 { kTwice=12 };
 };
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy cppyy-packaging: upgrade to backend 0.6.0

2018-04-20 Thread wlav
Author: Wim Lavrijsen 
Branch: cppyy-packaging
Changeset: r94404:e98cf77f5b72
Date: 2018-04-20 16:00 -0700
http://bitbucket.org/pypy/pypy/changeset/e98cf77f5b72/

Log:upgrade to backend 0.6.0

diff --git a/pypy/module/_cppyy/capi/loadable_capi.py 
b/pypy/module/_cppyy/capi/loadable_capi.py
--- a/pypy/module/_cppyy/capi/loadable_capi.py
+++ b/pypy/module/_cppyy/capi/loadable_capi.py
@@ -121,11 +121,11 @@
 
 # TODO: the following need to match up with the globally defined C_XYZ 
low-level
 # types (see capi/__init__.py), but by using strings here, that isn't 
guaranteed
-c_opaque_ptr = state.c_ulong
+c_opaque_ptr = state.c_ulong# not ptrdiff_t (which is signed)
  
 c_scope   = c_opaque_ptr
 c_type= c_scope
-c_object  = c_opaque_ptr
+c_object  = c_opaque_ptr# not voidp (to stick with one handle 
type)
 c_method  = c_opaque_ptr
 c_index   = state.c_long
 c_index_array = state.c_voidp
@@ -150,16 +150,17 @@
 
 self.capi_call_ifaces = {
 # name to opaque C++ scope representation
-'num_scopes'   : ([c_scope],  c_int),
-'scope_name'   : ([c_scope, c_int],   
c_ccharp),
-
 'resolve_name' : ([c_ccharp], 
c_ccharp),
+'resolve_enum' : ([c_ccharp], 
c_ccharp),
 'get_scope': ([c_ccharp], c_scope),
 'actual_class' : ([c_type, c_object], c_type),
+'size_of_klass': ([c_type],   
c_size_t),
+'size_of_type' : ([c_ccharp], 
c_size_t),
 
 # memory management
 'allocate' : ([c_type],   
c_object),
 'deallocate'   : ([c_type, c_object], c_void),
+'construct': ([c_type],   
c_object),
 'destruct' : ([c_type, c_object], c_void),
 
 # method/function dispatching
@@ -182,7 +183,8 @@
 'constructor'  : ([c_method, c_object, c_int, c_voidp],   
c_object),
 'call_o'   : ([c_method, c_object, c_int, c_voidp, c_type],
 c_object),
 
-'get_function_address' : ([c_scope, c_index], 
c_voidp), # TODO: verify
+'function_address_from_index'  : ([c_scope, c_index], 
c_voidp), # TODO: verify
+'function_address_from_method' : ([c_method], 
c_voidp), # id.
 
 # handling of function argument buffer
 'allocate_function_args'   : ([c_int],c_voidp),
@@ -196,6 +198,8 @@
 'is_abstract'  : ([c_type],   c_int),
 'is_enum'  : ([c_ccharp], c_int),
 
+'get_all_cpp_names': ([c_scope, c_voidp], 
c_voidp), # const char**
+
 # type/class reflection information
 'final_name'   : ([c_type],   
c_ccharp),
 'scoped_final_name': ([c_type],   
c_ccharp),
@@ -208,10 +212,10 @@
 
 # method/function reflection information
 'num_methods'  : ([c_scope],  c_int),
-'method_index_at'  : ([c_scope, c_int],   c_index),
 'method_indices_from_name' : ([c_scope, c_ccharp],
c_index_array),
 
 'method_name'  : ([c_scope, c_index], 
c_ccharp),
+'method_mangled_name'  : ([c_scope, c_index], 
c_ccharp),
 'method_result_type'   : ([c_scope, c_index], 
c_ccharp),
 'method_num_args'  : ([c_scope, c_index], c_int),
 'method_req_args'  : ([c_scope, c_index], c_int),
@@ -219,7 +223,9 @@
 'method_arg_default'   : ([c_scope, c_index, c_int],  
c_ccharp),
 'method_signature' : ([c_scope, c_index, c_int],  
c_ccharp),
 'method_prototype' : ([c_scope, c_index, c_int],  
c_ccharp),
+'is_const_method'  : ([c_method], c_int),
 
+'exists_method_template'   : ([c_scope, c_ccharp],c_int),
 'method_is_template'   : ([c_scope, c_index], c_int),
 'method_num_template_args' : ([c_scope, c_index], c_int),
 'method_template_arg_name' : ([c_scope, c_index, c_index], 
 c_ccharp),
@@ -228,7 +234,9 @@
 'get_global_operator'  : ([c_scope, c_scope, c_scope, 
c_ccharp],   c_index),
 
 # method properties
+'is_public_method' : ([c_type, c_index],  c_int),
 'is_constructor'   : ([c_ty

[pypy-commit] pypy cppyy-packaging: translator fix

2018-04-20 Thread wlav
Author: Wim Lavrijsen 
Branch: cppyy-packaging
Changeset: r94405:55cdebafb2de
Date: 2018-04-20 17:15 -0700
http://bitbucket.org/pypy/pypy/changeset/55cdebafb2de/

Log:translator fix

diff --git a/pypy/module/_cppyy/interp_cppyy.py 
b/pypy/module/_cppyy/interp_cppyy.py
--- a/pypy/module/_cppyy/interp_cppyy.py
+++ b/pypy/module/_cppyy/interp_cppyy.py
@@ -848,7 +848,7 @@
 alldir = capi.c_get_all_cpp_names(self.space, self)
 w_alldir = self.space.newlist([])
 for name in alldir:
-w_alldir.append(self.space.wrap(name))
+w_alldir.append(self.space.newtext(name))
 return w_alldir
 
 def missing_attribute_error(self, name):
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy cppyy-packaging: merge default into branch

2018-04-20 Thread wlav
Author: Wim Lavrijsen 
Branch: cppyy-packaging
Changeset: r94403:60b72b97202f
Date: 2018-04-19 10:47 -0700
http://bitbucket.org/pypy/pypy/changeset/60b72b97202f/

Log:merge default into branch

diff too long, truncating to 2000 out of 19728 lines

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -6,36 +6,36 @@
 Except when otherwise stated (look for LICENSE files in directories or
 information at the beginning of each file) all software and documentation in
 the 'rpython', 'pypy', 'ctype_configure', 'dotviewer', 'demo', 'lib_pypy',
-'py', and '_pytest' directories is licensed as follows: 
+'py', and '_pytest' directories is licensed as follows:
 
 The MIT License
 
-Permission is hereby granted, free of charge, to any person 
-obtaining a copy of this software and associated documentation 
-files (the "Software"), to deal in the Software without 
-restriction, including without limitation the rights to use, 
-copy, modify, merge, publish, distribute, sublicense, and/or 
-sell copies of the Software, and to permit persons to whom the 
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following conditions:
 
-The above copyright notice and this permission notice shall be included 
+The above copyright notice and this permission notice shall be included
 in all copies or substantial portions of the Software.
 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 DEALINGS IN THE SOFTWARE.
 
 
 PyPy Copyright holders 2003-2018
 
+
 
 Except when otherwise stated (look for LICENSE files or information at
 the beginning of each file) the files in the 'pypy' directory are each
-copyrighted by one or more of the following people and organizations:
+copyrighted by one or more of the following people and organizations:
 
   Armin Rigo
   Maciej Fijalkowski
@@ -89,13 +89,13 @@
   Niko Matsakis
   Alexander Hesse
   Ludovic Aubry
+  stian
   Jacob Hallen
   Jason Creighton
   Mark Young
   Alex Martelli
   Spenser Bauman
   Michal Bendowski
-  stian
   Jan de Mooij
   Tyler Wade
   Vincent Legoll
@@ -123,10 +123,10 @@
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
+  Jeremy Thurgood
   Greg Price
   Ivan Sichmann Freitas
   Dario Bertini
-  Jeremy Thurgood
   Mark Pearse
   Simon Cross
   Tobias Pape
@@ -145,18 +145,19 @@
   Adrian Kuhn
   tav
   Georg Brandl
+  Joannah Nanjekye
   Bert Freudenberg
   Stian Andreassen
   Wanja Saatkamp
   Mike Blume
-  Joannah Nanjekye
   Gerald Klix
   Oscar Nierstrasz
   Rami Chowdhury
   Stefan H. Muller
+  Dodan Mihai
   Tim Felgentreff
   Eugene Oden
-  Dodan Mihai
+  Colin Valliant
   Jeff Terrace
   Henry Mason
   Vasily Kuznetsov
@@ -225,12 +226,14 @@
   Vaibhav Sood
   Reuben Cummings
   Attila Gobi
+  Floris Bruynooghe
   Christopher Pope
   Tristan Arthur
   Christian Tismer 
   Dan Stromberg
   Carl Meyer
   Florin Papa
+  Arianna Avanzini
   Jens-Uwe Mager
   Valentina Mukhamedzhanova
   Stefano Parmesan
@@ -250,9 +253,11 @@
   Alejandro J. Cura
   Vladimir Kryachko
   Gabriel
+  Thomas Hisch
   Mark Williams
   Kunal Grover
   Nathan Taylor
+  Barry Hart
   Travis Francis Athougies
   Yasir Suhail
   Sergey Kishchenko
@@ -260,6 +265,7 @@
   Lutz Paelike
   Ian Foote
   Philipp Rustemeuer
+  Logan Chien
   Catalin Gabriel Manciu
   Jacob Oscarson
   Ryan Gonzalez
@@ -295,7 +301,6 @@
   Akira Li
   Gustavo Niemeyer
   Rafał Gałczyński
-  Logan Chien
   Lucas Stadler
   roberto@goyle
   Matt Bogosian
@@ -308,6 +313,7 @@
   Anna Katrina Dominguez
   Kim Jin Su
   Amber Brown
+  Miro Hrončok
   Anthony Sottile
   Nate Bragg
   Ben Darnell
@@ -315,7 +321,6 @@
   Godefroid Chappelle