Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-103509: PEP 697 -- Limited C API for Extending Opaque Types #103511

Merged
merged 29 commits into from
May 4, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a9679fa
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types
encukou Oct 10, 2022
b8dc072
Add a blurb
encukou Apr 13, 2023
1fc5c52
Fix PyMember_SetOne error return (thanks MSVC!)
encukou Apr 17, 2023
075ca51
Add What's New entry
encukou Apr 17, 2023
439de5d
Fix warning in tests
encukou Apr 19, 2023
291731b
Work around lack of alignof & max_align_t
encukou Apr 19, 2023
2ba8084
Use the same Sphinx role for Py_TPFLAGS_ITEMS_AT_END as for other typ…
encukou Apr 19, 2023
b03d431
Add ALIGNOF_MAX_ALIGN_T to configure & PC/pyconfig.h
encukou Apr 19, 2023
ec9d5a8
Use ALIGNOF_MAX_ALIGN_T
encukou Apr 19, 2023
5cab814
Fix typo
encukou Apr 20, 2023
3ade585
Don't include <stdalign.h>, it's not always available on Windows
encukou Apr 20, 2023
986bf26
Define ALIGNOF_MAX_ALIGN_T with long double if it's not available
encukou Apr 20, 2023
e7838ee
tests: Compute data_offset in C to avoid overflow issues
encukou Apr 20, 2023
93d86d1
Merge branch 'main' into extend-opaque-sq
arhadthedev Apr 21, 2023
266834d
Cast to `char*` for pointer arithmetic
encukou Apr 24, 2023
f968206
Fix ALIGNOF_MAX_ALIGN_T value for 32-bit Windows
encukou Apr 25, 2023
37158af
Fix C++ behaviour and comments for ALIGNOF_MAX_ALIGN_T
encukou Apr 25, 2023
402ecc6
Merge branch 'main' into extend-opaque-sq
encukou Apr 27, 2023
1701688
Don't rely on PyObject* being aligned to ALIGNOF_MAX_ALIGN_T
encukou Apr 28, 2023
db5d49b
Merge in main branch
encukou Apr 28, 2023
9d9911d
Apply suggestions from code review
encukou May 2, 2023
06bcf5b
Raise TypeError on missing flag
encukou May 2, 2023
0b69748
Wrap new tests in a class
encukou May 2, 2023
33c5258
Use PyModule_AddIntMacro in tests
encukou May 2, 2023
88dade7
Test failure of extending non-ITEMS_AT_END variable-sized types
encukou May 2, 2023
8720b25
Test error cases around members
encukou May 2, 2023
0474e69
Merge in the main branch
encukou May 2, 2023
a975de9
Apply suggestions from code review
encukou May 3, 2023
b9ddf21
Merge in the main branch
encukou May 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge in the main branch
  • Loading branch information
encukou committed May 3, 2023
commit b9ddf21f2968d342725003398f16a2e5b7f704c2
17 changes: 16 additions & 1 deletion Modules/_testcapi/heaptype.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ create_type_from_repeated_slots(PyObject *self, PyObject *variant_obj)
}



static PyObject *
make_immutable_type_with_base(PyObject *self, PyObject *base)
{
Expand All @@ -385,6 +384,20 @@ make_immutable_type_with_base(PyObject *self, PyObject *base)
return PyType_FromSpecWithBases(&ImmutableSubclass_spec, base);
}

static PyObject *
make_type_with_base(PyObject *self, PyObject *base)
{
assert(PyType_Check(base));
PyType_Spec ImmutableSubclass_spec = {
.name = "_testcapi.Subclass",
.basicsize = (int)((PyTypeObject*)base)->tp_basicsize,
.slots = empty_type_slots,
.flags = Py_TPFLAGS_DEFAULT,
};
return PyType_FromSpecWithBases(&ImmutableSubclass_spec, base);
}


static PyObject *
pyobject_getitemdata(PyObject *self, PyObject *o)
{
Expand All @@ -395,6 +408,7 @@ pyobject_getitemdata(PyObject *self, PyObject *o)
return PyLong_FromVoidPtr(pointer);
}


static PyMethodDef TestMethods[] = {
{"pytype_fromspec_meta", pytype_fromspec_meta, METH_O},
{"test_type_from_ephemeral_spec", test_type_from_ephemeral_spec, METH_NOARGS},
Expand All @@ -406,6 +420,7 @@ static PyMethodDef TestMethods[] = {
test_from_spec_invalid_metatype_inheritance,
METH_NOARGS},
{"make_immutable_type_with_base", make_immutable_type_with_base, METH_O},
{"make_type_with_base", make_type_with_base, METH_O},
{"pyobject_getitemdata", pyobject_getitemdata, METH_O},
{NULL},
};
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.