Staging
v0.5.1
https://github.com/python/cpython
Revision 700cb6617545cdb8a9e16bb2e6efe90788a60d4d authored by Miss Islington (bot) on 19 July 2020, 07:50:54 UTC, committed by GitHub on 19 July 2020, 07:50:54 UTC

GH-msg373510

[bpo-32528]()/GH-13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document.

Automerge-Triggered-By: @1st1
(cherry picked from commit 2a5181829af394b82e8e8c917183c709ee72a2b7)

Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
1 parent 38d930f
Raw File
Tip revision: 700cb6617545cdb8a9e16bb2e6efe90788a60d4d authored by Miss Islington (bot) on 19 July 2020, 07:50:54 UTC
bpo-32528: Document the change in inheritance of asyncio.CancelledError (GH-21474)
Tip revision: 700cb66
custom.c
#define PY_SSIZE_T_CLEAN
#include <Python.h>

typedef struct {
    PyObject_HEAD
    /* Type-specific fields go here. */
} CustomObject;

static PyTypeObject CustomType = {
    PyVarObject_HEAD_INIT(NULL, 0)
    .tp_name = "custom.Custom",
    .tp_doc = "Custom objects",
    .tp_basicsize = sizeof(CustomObject),
    .tp_itemsize = 0,
    .tp_flags = Py_TPFLAGS_DEFAULT,
    .tp_new = PyType_GenericNew,
};

static PyModuleDef custommodule = {
    PyModuleDef_HEAD_INIT,
    .m_name = "custom",
    .m_doc = "Example module that creates an extension type.",
    .m_size = -1,
};

PyMODINIT_FUNC
PyInit_custom(void)
{
    PyObject *m;
    if (PyType_Ready(&CustomType) < 0)
        return NULL;

    m = PyModule_Create(&custommodule);
    if (m == NULL)
        return NULL;

    Py_INCREF(&CustomType);
    if (PyModule_AddObject(m, "Custom", (PyObject *) &CustomType) < 0) {
        Py_DECREF(&CustomType);
        Py_DECREF(m);
        return NULL;
    }

    return m;
}
back to top