public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-msgspec] rawhide: Update to 0.22.0 (rhbz#2334591)
@ 2026-10-12 11:34 Federico Pellegrin
  0 siblings, 0 replies; only message in thread
From: Federico Pellegrin @ 2026-10-12 11:34 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-msgspec
            Branch : rawhide
            Commit : 4b62b8224e652e87bc0c42efddee844903897f68
            Author : Federico Pellegrin <fede@evolware.org>
            Date   : 2026-10-04T07:28:18+02:00
            Stats  : +4/-314 in 4 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-msgspec/c/4b62b8224e652e87bc0c42efddee844903897f68?branch=rawhide

            Log:
            Update to 0.22.0 (rhbz#2334591)

- Update package
- Drop upstreamed fixes
- Fix project URL

---
diff --git a/852.patch b/852.patch
deleted file mode 100644
index fcadfed..0000000
--- a/852.patch
+++ /dev/null
@@ -1,157 +0,0 @@
-From 89ecb0bd481cd4f355dd41b97153155d4463faed Mon Sep 17 00:00:00 2001
-From: Jelle Zijlstra <jelle.zijlstra@gmail.com>
-Date: Mon, 26 May 2025 09:06:43 -0700
-Subject: [PATCH] Fix annotations support on 3.14
-
-With this change, the tests run for me on a local build of Python 3.14.
-There are a lot of failures related to sys.getrefcount() but that seems
-to be an unrelated issue.
-
-Closes #810. Fixes #651. Fixes #795.
----
- msgspec/_core.c   | 59 +++++++++++++++++++++++++++++++++++++++++++++--
- msgspec/_utils.py | 16 +++++++++----
- 2 files changed, 69 insertions(+), 6 deletions(-)
-
-diff --git a/msgspec/_core.c b/msgspec/_core.c
-index 147ad95a..e5a48042 100644
---- a/msgspec/_core.c
-+++ b/msgspec/_core.c
-@@ -452,6 +452,7 @@ typedef struct {
- #endif
-     PyObject *astimezone;
-     PyObject *re_compile;
-+    PyObject *get_annotate_from_class_namespace;
-     uint8_t gc_cycle;
- } MsgspecState;
- 
-@@ -5814,12 +5815,45 @@ structmeta_is_classvar(
- 
- static int
- structmeta_collect_fields(StructMetaInfo *info, MsgspecState *mod, bool kwonly) {
--    PyObject *annotations = PyDict_GetItemString(
-+    PyObject *annotations = PyDict_GetItemString(  // borrowed reference
-         info->namespace, "__annotations__"
-     );
--    if (annotations == NULL) return 0;
-+    if (annotations == NULL) {
-+        if (mod->get_annotate_from_class_namespace != NULL) {
-+            PyObject *annotate = PyObject_CallOneArg(
-+                mod->get_annotate_from_class_namespace, info->namespace
-+            );
-+            if (annotate == NULL) {
-+                return -1;
-+            }
-+            if (annotate == Py_None) {
-+                Py_DECREF(annotate);
-+                return 0;
-+            }
-+            PyObject *format = PyLong_FromLong(1);  /* annotationlib.Format.VALUE */
-+            if (format == NULL) {
-+                Py_DECREF(annotate);
-+                return -1;
-+            }
-+            annotations = PyObject_CallOneArg(
-+                annotate, format
-+            );
-+            Py_DECREF(annotate);
-+            Py_DECREF(format);
-+            if (annotations == NULL) {
-+                return -1;
-+            }
-+        }
-+        else {
-+            return 0;  // No annotations, nothing to do
-+        }
-+    }
-+    else {
-+        Py_INCREF(annotations);
-+    }
- 
-     if (!PyDict_Check(annotations)) {
-+        Py_DECREF(annotations);
-         PyErr_SetString(PyExc_TypeError, "__annotations__ must be a dict");
-         return -1;
-     }
-@@ -5869,6 +5903,7 @@ structmeta_collect_fields(StructMetaInfo *info, MsgspecState *mod, bool kwonly)
-     }
-     return 0;
- error:
-+    Py_DECREF(annotations);
-     Py_XDECREF(module_ns);
-     return -1;
- }
-@@ -22225,6 +22260,26 @@ PyInit__core(void)
-     Py_DECREF(temp_module);
-     if (st->re_compile == NULL) return NULL;
- 
-+    /* annotationlib.get_annotate_from_class_namespace */
-+    temp_module = PyImport_ImportModule("annotationlib");
-+    if (temp_module == NULL) {
-+        if (PyErr_ExceptionMatches(PyExc_ModuleNotFoundError)) {
-+            // Below Python 3.14
-+            PyErr_Clear();
-+            st->get_annotate_from_class_namespace = NULL;
-+        }
-+        else {
-+            return NULL;
-+        }
-+    }
-+    else {
-+        st->get_annotate_from_class_namespace = PyObject_GetAttrString(
-+            temp_module, "get_annotate_from_class_namespace"
-+        );
-+        Py_DECREF(temp_module);
-+        if (st->get_annotate_from_class_namespace == NULL) return NULL;
-+    }
-+
-     /* Initialize cached constant strings */
- #define CACHED_STRING(attr, str) \
-     if ((st->attr = PyUnicode_InternFromString(str)) == NULL) return NULL
-diff --git a/msgspec/_utils.py b/msgspec/_utils.py
-index 6d338104..534d17f5 100644
---- a/msgspec/_utils.py
-+++ b/msgspec/_utils.py
-@@ -1,5 +1,6 @@
- # type: ignore
- import collections
-+import inspect
- import sys
- import typing
- 
-@@ -71,6 +72,13 @@ def _eval_type(t, globalns, localns):
-     _eval_type = typing._eval_type
- 
- 
-+if sys.version_info >= (3, 10):
-+    from inspect import get_annotations as _get_class_annotations
-+else:
-+    def _get_class_annotations(cls):
-+        return cls.__dict__.get("__annotations__", {})
-+
-+
- def _apply_params(obj, mapping):
-     if isinstance(obj, typing.TypeVar):
-         return mapping.get(obj, obj)
-@@ -149,17 +157,17 @@ def get_class_annotations(obj):
-         cls_locals = dict(vars(cls))
-         cls_globals = getattr(sys.modules.get(cls.__module__, None), "__dict__", {})
- 
--        ann = cls.__dict__.get("__annotations__", {})
-+        ann = _get_class_annotations(cls)
-         for name, value in ann.items():
-             if name in hints:
-                 continue
--            if value is None:
--                value = type(None)
--            elif isinstance(value, str):
-+            if isinstance(value, str):
-                 value = _forward_ref(value)
-             value = _eval_type(value, cls_locals, cls_globals)
-             if mapping is not None:
-                 value = _apply_params(value, mapping)
-+            if value is None:
-+                value = type(None)
-             hints[name] = value
-     return hints
- 

diff --git a/msgspec-0.18.6-python3.13-pr-711.patch b/msgspec-0.18.6-python3.13-pr-711.patch
deleted file mode 100644
index 3ea5235..0000000
--- a/msgspec-0.18.6-python3.13-pr-711.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-diff -Naur msgspec-0.18.6-original/msgspec/_core.c msgspec-0.18.6/msgspec/_core.c
---- msgspec-0.18.6-original/msgspec/_core.c	2024-01-21 22:57:36.000000000 -0500
-+++ msgspec-0.18.6/msgspec/_core.c	2024-09-18 07:55:29.865441590 -0400
-@@ -20,6 +20,7 @@
- #define PY310_PLUS (PY_VERSION_HEX >= 0x030a0000)
- #define PY311_PLUS (PY_VERSION_HEX >= 0x030b0000)
- #define PY312_PLUS (PY_VERSION_HEX >= 0x030c0000)
-+#define PY313_PLUS (PY_VERSION_HEX >= 0x030d0000)
- 
- /* 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
-@@ -497,7 +498,7 @@
-     for (i = 0; i < nkwargs; i++) {
-         PyObject *kwname = PyTuple_GET_ITEM(kwnames, i);
-         assert(PyUnicode_Check(kwname));
--        if (_PyUnicode_EQ(kwname, key)) {
-+        if (PyUnicode_Compare(kwname, key) == 0) {
-             return kwstack[i];
-         }
-     }
-@@ -4440,8 +4441,6 @@
-      */
-     PyObject *tag_mapping = NULL, *tag_field = NULL, *set_item = NULL;
-     PyObject *struct_info = NULL;
--    Py_ssize_t set_pos = 0;
--    Py_hash_t set_hash;
-     bool array_like = false;
-     bool tags_are_strings = true;
-     int status = -1;
-@@ -4449,7 +4448,14 @@
-     tag_mapping = PyDict_New();
-     if (tag_mapping == NULL) goto cleanup;
- 
-+#if PY313_PLUS
-+    PyObject *iter_set = PyObject_GetIter(state->structs_set);
-+    while ((set_item = PyIter_Next(iter_set)) != NULL) {
-+#else
-+    Py_ssize_t set_pos = 0;
-+    Py_hash_t set_hash;
-     while (_PySet_NextEntry(state->structs_set, &set_pos, &set_item, &set_hash)) {
-+#endif
-         struct_info = StructInfo_Convert(set_item);
-         if (struct_info == NULL) goto cleanup;
- 
-@@ -7313,7 +7319,7 @@
-          * check for parameters passed both as arg and kwarg */
-         for (field_index = 0; field_index < nfields; field_index++) {
-             PyObject *field = PyTuple_GET_ITEM(fields, field_index);
--            if (_PyUnicode_EQ(kwname, field)) {
-+            if (PyUnicode_Compare(kwname, field) == 0) {
-                 if (MS_UNLIKELY(field_index < nargs)) {
-                     PyErr_Format(
-                         PyExc_TypeError,
-@@ -7720,7 +7726,7 @@
-         }
-         for (field_index = 0; field_index < nfields; field_index++) {
-             PyObject *field = PyTuple_GET_ITEM(fields, field_index);
--            if (_PyUnicode_EQ(kwname, field)) goto kw_found;
-+            if (PyUnicode_Compare(kwname, field) == 0) goto kw_found;
-         }
- 
-         /* Unknown keyword */
-@@ -11251,7 +11257,11 @@
-         PyErr_SetString(PyExc_TypeError, "uuid.int must be an int");
-         return -1;
-     }
-+#if PY313_PLUS
-+    int out = _PyLong_AsByteArray((PyLongObject *)int128, buf, 16, 0, 0, 1);
-+#else
-     int out = _PyLong_AsByteArray((PyLongObject *)int128, buf, 16, 0, 0);
-+#endif
-     Py_DECREF(int128);
-     return out;
- }
-@@ -12403,8 +12413,7 @@
- static int
- mpack_encode_set(EncoderState *self, PyObject *obj)
- {
--    Py_ssize_t len, ppos = 0;
--    Py_hash_t hash;
-+    Py_ssize_t len = 0;
-     PyObject *item;
-     int status = -1;
- 
-@@ -12423,7 +12432,14 @@
- 
-     if (mpack_encode_array_header(self, len, "set") < 0) return -1;
-     if (Py_EnterRecursiveCall(" while serializing an object")) return -1;
-+#if PY313_PLUS
-+    PyObject *iter_set = PyObject_GetIter(obj);
-+    while ((item = PyIter_Next(iter_set)) != NULL) {
-+#else
-+    Py_ssize_t ppos = 0;
-+    Py_hash_t hash;
-     while (_PySet_NextEntry(obj, &ppos, &item, &hash)) {
-+#endif
-         if (mpack_encode_inline(self, item) < 0) goto cleanup;
-     }
-     status = 0;
-@@ -13725,8 +13741,7 @@
- static int
- json_encode_set(EncoderState *self, PyObject *obj)
- {
--    Py_ssize_t len, ppos = 0;
--    Py_hash_t hash;
-+    Py_ssize_t len = 0;
-     PyObject *item;
-     int status = -1;
- 
-@@ -13745,7 +13760,14 @@
- 
-     if (ms_write(self, "[", 1) < 0) return -1;
-     if (Py_EnterRecursiveCall(" while serializing an object")) return -1;
-+#if PY313_PLUS
-+    PyObject *iter_set = PyObject_GetIter(obj);
-+    while ((item = PyIter_Next(iter_set)) != NULL) {
-+#else
-+    Py_ssize_t ppos = 0;
-+    Py_hash_t hash;
-     while (_PySet_NextEntry(obj, &ppos, &item, &hash)) {
-+#endif
-         if (json_encode_inline(self, item) < 0) goto cleanup;
-         if (ms_write(self, ",", 1) < 0) goto cleanup;
-     }
-diff -Naur msgspec-0.18.6-original/msgspec/__init__.pyi msgspec-0.18.6/msgspec/__init__.pyi
---- msgspec-0.18.6-original/msgspec/__init__.pyi	2024-01-21 22:57:36.000000000 -0500
-+++ msgspec-0.18.6/msgspec/__init__.pyi	2024-09-18 07:55:29.867441616 -0400
-@@ -108,7 +108,7 @@
-     @overload
-     def __new__(cls) -> "Raw": ...
-     @overload
--    def __new__(cls, msg: Union[bytes, str]) -> "Raw": ...
-+    def __new__(cls, msg: Union[bytes, str, bytearray, memoryview]) -> "Raw": ...
-     def copy(self) -> "Raw": ...
- 
- class Meta:
-diff -Naur msgspec-0.18.6-original/msgspec/_utils.py msgspec-0.18.6/msgspec/_utils.py
---- msgspec-0.18.6-original/msgspec/_utils.py	2024-01-21 22:57:36.000000000 -0500
-+++ msgspec-0.18.6/msgspec/_utils.py	2024-09-18 07:55:29.865441590 -0400
-@@ -127,6 +127,7 @@
-                 value = type(None)
-             elif isinstance(value, str):
-                 value = _forward_ref(value)
-+            # TODO: Pass `type_params` to `_eval_type` to fix deprecation warning
-             value = typing._eval_type(value, cls_locals, cls_globals)
-             if mapping is not None:
-                 value = _apply_params(value, mapping)

diff --git a/python-msgspec.spec b/python-msgspec.spec
index 7343772..6d72799 100644
--- a/python-msgspec.spec
+++ b/python-msgspec.spec
@@ -3,15 +3,12 @@
 
 Name:           python-%{pypi_name}
 Summary:        Fast serialization and validation library
-Version:        0.19.0
-Source:         https://github.com/jcrist/%{pypi_name}/archive/refs/tags/%{version}/msgspec-%{version}.tar.gz
+Version:        0.22.0
+Source:         https://github.com/msgspec/%{pypi_name}/archive/refs/tags/%{version}/msgspec-%{version}.tar.gz
 Release:        %autorelease
 
 License:        BSD-3-Clause
-URL:            https://jcristharif.com/msgspec/
-
-# Python 3.14: Fix annotations support
-Patch:          https://github.com/jcrist/msgspec/pull/852.patch
+URL:            https://github.com/msgspec/msgspec
 
 BuildRequires:  python3-devel
 BuildRequires:  python3dist(wheel)
@@ -36,9 +33,6 @@ JSON, MessagePack, YAML, and TOML.}
 
 %prep
 %autosetup -p1 -n %{pypi_name}-%{version}
-# Relax all getrefcount tests to allow lower numbers
-# Proposed as https://github.com/jcrist/msgspec/pull/854 but does not apply cleanly
-sed -Ei 's/sys\.getrefcount\(([^\)]+)\) == ([0-9]+)/sys.getrefcount(\1) <= \2/' tests/test_*.py
 
 %build
 %pyproject_wheel

diff --git a/sources b/sources
index 09abc24..eb55651 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (msgspec-0.19.0.tar.gz) = d1a34598b42595bb396ea99058b8133a8473daffd2b311151c92ccbe1c1b42908e0116588998466b9efbc56e8ec27e2c262a9a56adeeeb2673edab4277119da2
+SHA512 (msgspec-0.22.0.tar.gz) = 5ca501fe6851ca18152a32da4adf7970d7102455f47f41615c9c5ba555087096d3491b38f6207d5f571f47a318054201dced94357e0b4eaca0f3c1ab003b4bc3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-12 11:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 11:34 [rpms/python-msgspec] rawhide: Update to 0.22.0 (rhbz#2334591) Federico Pellegrin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox