Skip to content

Commit

Permalink
Support Python 3.11 (#375)
Browse files Browse the repository at this point in the history
Co-authored-by: Fantix King <fantix.king@gmail.com>
  • Loading branch information
msullivan and fantix committed Oct 7, 2022
1 parent 819a234 commit 04b0da2
Show file tree
Hide file tree
Showing 5 changed files with 532 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0-rc.2"]
edgedb-version: [stable , nightly]
os: [ubuntu-latest, macos-latest, windows-2019]
loop: [asyncio, uvloop]
Expand Down
6 changes: 4 additions & 2 deletions edgedb/datatypes/namedtuple.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "pythoncapi_compat.h"

/*
* This source file is part of the EdgeDB open source project.
*
Expand Down Expand Up @@ -75,7 +77,7 @@ EdgeNamedTuple_New(PyObject *type)
_EDGE_NAMED_TUPLE_FL_NUM_FREE[size]--;
_Py_NewReference((PyObject *)nt);
Py_INCREF(type);
Py_TYPE(nt) = type;
Py_SET_TYPE(nt, type);
}
} else {
if (
Expand Down Expand Up @@ -451,7 +453,7 @@ EdgeNamedTuple_Type_New(PyObject *desc)
assert(Py_TYPE(rv)->tp_itemsize > sizeof(PyObject *));
EdgeNamedTuple_Type_DESC(rv) = desc; // store the fast-access pointer

Py_SIZE(rv) = 0; // hack the size so the member is not visible to user
Py_SET_SIZE(rv, 0); // hack the size so the member is not visible to user

// desc is also stored in tp_dict for refcount.
if (PyDict_SetItemString(rv->tp_dict, "__desc__", desc) < 0) {
Expand Down
4 changes: 3 additions & 1 deletion edgedb/datatypes/object.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "pythoncapi_compat.h"

/*
* This source file is part of the EdgeDB open source project.
*
Expand Down Expand Up @@ -241,7 +243,7 @@ object_getitem(EdgeObject *o, PyObject *name)
if (PyList_Check(val)) {
return EdgeLinkSet_New(name, (PyObject *)o, val);
}
else if (val == Py_None) {
else if (Py_IsNone(val)) {
Py_RETURN_NONE;
}
else {
Expand Down
Loading

0 comments on commit 04b0da2

Please sign in to comment.