Author: Ronan Lamy <ronan.l...@gmail.com> Branch: multiphase Changeset: r91595:1426701d43f0 Date: 2017-06-12 18:56 +0100 http://bitbucket.org/pypy/pypy/changeset/1426701d43f0/
Log: Make typeslot numbers accessible from RPython diff --git a/pypy/module/cpyext/include/typeslots.h b/pypy/module/cpyext/parse/typeslots.h rename from pypy/module/cpyext/include/typeslots.h rename to pypy/module/cpyext/parse/typeslots.h --- a/pypy/module/cpyext/include/typeslots.h +++ b/pypy/module/cpyext/parse/typeslots.h @@ -1,7 +1,4 @@ /* Do not renumber the file; these numbers are part of the stable ABI. */ -/* Disabled, see #10181 */ -#undef Py_bf_getbuffer -#undef Py_bf_releasebuffer #define Py_mp_ass_subscript 3 #define Py_mp_length 4 #define Py_mp_subscript 5 @@ -79,7 +76,5 @@ #define Py_am_await 77 #define Py_am_aiter 78 #define Py_am_anext 79 -#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* New in 3.5 */ #define Py_tp_finalize 80 -#endif diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py --- a/pypy/module/cpyext/test/test_typeobject.py +++ b/pypy/module/cpyext/test/test_typeobject.py @@ -4,7 +4,7 @@ from pypy.module.cpyext.test.test_api import BaseApiTest from pypy.module.cpyext.api import generic_cpy_call from pypy.module.cpyext.pyobject import make_ref, from_ref -from pypy.module.cpyext.typeobject import PyTypeObjectPtr +from pypy.module.cpyext.typeobject import cts, PyTypeObjectPtr import sys import pytest @@ -435,6 +435,9 @@ ref = make_ref(space, w_obj) api.Py_DecRef(ref) + def test_typeslots(self, space): + assert cts.macros['Py_tp_doc'] == 56 + class AppTestSlots(AppTestCpythonExtensionBase): def setup_class(cls): AppTestCpythonExtensionBase.setup_class.im_func(cls) diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py --- a/pypy/module/cpyext/typeobject.py +++ b/pypy/module/cpyext/typeobject.py @@ -41,6 +41,7 @@ PyType_Check, PyType_CheckExact = build_type_checkers("Type", "w_type") PyHeapTypeObject = cts.gettype('PyHeapTypeObject *') +cts.parse_header(parse_dir / "typeslots.h") class W_GetSetPropertyEx(GetSetProperty): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit