Author: Ronan Lamy <ronan.l...@gmail.com> 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, @@ -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 @@ -149,7 +157,7 @@ # No tzinfo return py_datetime = rffi.cast(PyDateTime_Time, py_obj) - w_tzinfo = space.getattr(w_obj, space.newtext('tzinfo')) + w_tzinfo = space.getattr(w_obj, space.newtext('_tzinfo')) if space.is_none(w_tzinfo): py_datetime.c_hastzinfo = cts.cast('unsigned char', 0) py_datetime.c_tzinfo = lltype.nullptr(PyObject.TO) diff --git a/pypy/module/cpyext/test/test_arraymodule.py b/pypy/module/cpyext/test/test_arraymodule.py --- a/pypy/module/cpyext/test/test_arraymodule.py +++ b/pypy/module/cpyext/test/test_arraymodule.py @@ -187,7 +187,4 @@ self.attrib = True import gc module.subclass_with_attribute(Sub, "addattrib", "attrib", gc.collect) - if self.runappdirect: - assert Sub.__module__ == 'pypy.module.cpyext.test.test_arraymodule' - assert str(Sub) == "<class 'pypy.module.cpyext.test.test_arraymodule.Sub'>" - + assert Sub.__module__ == __name__ 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 - + diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -27,11 +27,8 @@ if(PyUnicode_GetSize(s) != 11) { result = -PyUnicode_GetSize(s); } -#ifdef PYPY_VERSION - // Slightly silly test that tp_basicsize is reasonable. - if(s->ob_type->tp_basicsize != sizeof(void*)*12) + if(s->ob_type->tp_basicsize != sizeof(PyUnicodeObject)) result = s->ob_type->tp_basicsize; -#endif // PYPY_VERSION Py_DECREF(s); return PyLong_FromLong(result); """), _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit