FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MNT: account for CPython 314 changes by tacaswell · Pull Request #760 · msgspec/msgspec · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 9 additions & 2 deletions msgspec/_core.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define PY311_PLUS (PY_VERSION_HEX >= 0x030b0000)
#define PY312_PLUS (PY_VERSION_HEX >= 0x030c0000)
#define PY313_PLUS (PY_VERSION_HEX >= 0x030d0000)
#define PY314_PLUS (PY_VERSION_HEX >= 0x030e0000)

/* Hint to the compiler not to store `x` in a register since it is likely to
* change. Results in much higher performance on GCC, with smaller benefits on
Expand Down Expand Up @@ -71,6 +72,12 @@ ms_popcount(uint64_t i) { \
#define MS_UNICODE_EQ(a, b) _PyUnicode_EQ(a, b)
#endif

#if PY314_PLUS
#define MS_IMMORTAL_INITIAL_REFCNT _Py_IMMORTAL_INITIAL_REFCNT
#else
#define MS_IMMORTAL_INITIAL_REFCNT _Py_IMMORTAL_REFCNT
#endif

#define DIV_ROUND_CLOSEST(n, d) ((((n) < 0) == ((d) < 0)) ? (((n) + (d)/2)/(d)) : (((n) - (d)/2)/(d)))

/* These macros are used to manually unroll some loops */
Expand Down Expand Up @@ -2155,7 +2162,7 @@ PyTypeObject NoDefault_Type = {
#if PY312_PLUS
PyObject _NoDefault_Object = {
_PyObject_EXTRA_INIT
{ _Py_IMMORTAL_REFCNT },
{ MS_IMMORTAL_INITIAL_REFCNT },
&NoDefault_Type
};
#else
Expand Down Expand Up @@ -2259,7 +2266,7 @@ PyTypeObject Unset_Type = {
#if PY312_PLUS
PyObject _Unset_Object = {
_PyObject_EXTRA_INIT
{ _Py_IMMORTAL_REFCNT },
{ MS_IMMORTAL_INITIAL_REFCNT },
&Unset_Type
};
#else
Expand Down

Back | FazBrowse Home | New Git URL