Skip to content

Port mypyc to Python 3.11: use Py_SET_SIZE() #11652

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

Merged
merged 1 commit into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions mypyc/lib-rt/misc_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// These are registered in mypyc.primitives.misc_ops.

#include <Python.h>
#include "pythoncapi_compat.h"
#include "CPy.h"

PyObject *CPy_GetCoro(PyObject *obj)
Expand Down Expand Up @@ -148,7 +149,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
// to being type. (This allows us to avoid needing to initialize
// it explicitly on windows.)
if (!Py_TYPE(template_)) {
Py_TYPE(template_) = &PyType_Type;
Py_SET_TYPE(template_, &PyType_Type);
}
PyTypeObject *metaclass = Py_TYPE(template_);

Expand Down Expand Up @@ -249,7 +250,7 @@ PyObject *CPyType_FromTemplate(PyObject *template,
// the mro. It was needed for mypy.stats. I need to investigate
// what is actually going on here.
Py_INCREF(metaclass);
Py_TYPE(t) = metaclass;
Py_SET_TYPE(t, metaclass);

if (dummy_class) {
if (PyDict_Merge(t->ht_type.tp_dict, dummy_class->tp_dict, 0) != 0)
Expand Down
Loading