Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
# Class creation from C
with warnings_helper.check_warnings(
- ('.*custom tp_new.*in Python 3.14.*', DeprecationWarning),
+ ('.* _testcapi.Subclass .* custom tp_new.*in Python 3.14.*', DeprecationWarning),
):
sub = _testcapi.make_type_with_base(Base)
self.assertTrue(issubclass(sub, Base))
--- /dev/null
+Improve :exc:`DeprecationWarning` for uses of :c:type:`PyType_Spec` with metaclasses that have custom ``tp_new``.
if (_allow_tp_new) {
if (PyErr_WarnFormat(
PyExc_DeprecationWarning, 1,
- "Using PyType_Spec with metaclasses that have custom "
- "tp_new is deprecated and will no longer be allowed in "
- "Python 3.14.") < 0) {
+ "Type %s uses PyType_Spec with a metaclass that has custom "
+ "tp_new. This is deprecated and will no longer be allowed in "
+ "Python 3.14.", spec->name) < 0) {
goto finally;
}
}