Skip to content

Update to use multi-phase module init in C #115

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.0-beta.4"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [windows-latest, ubuntu-latest, macos-latest]
arch: [x64, x86]
exclude:
1,159 changes: 745 additions & 414 deletions immutables/_map.c

Large diffs are not rendered by default.

28 changes: 9 additions & 19 deletions immutables/_map.h
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@ This constant is used to define a datastucture for storing iteration state.
#define _Py_HAMT_MAX_TREE_DEPTH 8


#define Map_Check(o) (Py_TYPE(o) == &_Map_Type)
#define MapMutation_Check(o) (Py_TYPE(o) == &_MapMutation_Type)
#define Map_Check(state, o) (Py_IS_TYPE(o, state->MapType))
#define MapMutation_Check(state, o) (Py_IS_TYPE(o, state->MapMutationType))


/* Abstract tree node. */
@@ -28,12 +28,18 @@ typedef struct {
} MapNode;


#ifdef Py_TPFLAGS_MANAGED_WEAKREF
#define _MapCommonFields(pref) \
PyObject_HEAD \
MapNode *pref##_root; \
Py_ssize_t pref##_count;
#else
#define _MapCommonFields(pref) \
PyObject_HEAD \
MapNode *pref##_root; \
PyObject *pref##_weakreflist; \
Py_ssize_t pref##_count;

#endif

/* Base mapping struct; used in methods shared between
MapObject and MapMutationObject types. */
@@ -99,20 +105,4 @@ typedef struct {
} MapIterator;


/* PyTypes */


PyTypeObject _Map_Type;
PyTypeObject _MapMutation_Type;
PyTypeObject _Map_ArrayNode_Type;
PyTypeObject _Map_BitmapNode_Type;
PyTypeObject _Map_CollisionNode_Type;
PyTypeObject _MapKeys_Type;
PyTypeObject _MapValues_Type;
PyTypeObject _MapItems_Type;
PyTypeObject _MapKeysIter_Type;
PyTypeObject _MapValuesIter_Type;
PyTypeObject _MapItemsIter_Type;


#endif