Skip to content

Commit a9ed8f1

Browse files
authored
Drop Python 3.9 (#956)
1 parent 1bc64dd commit a9ed8f1

File tree

7 files changed

+4
-55
lines changed

7 files changed

+4
-55
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ jobs:
5656
# - windows-latest
5757
# - macos-latest
5858
python-version:
59-
- "3.9"
6059
- "3.10"
6160
- "3.11"
6261
- "3.12"

.pytest.ini

Lines changed: 0 additions & 7 deletions
This file was deleted.

.ruff.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ extend-exclude = [
33
"src/msgspec/_version.py",
44
"tests/typing/basic_typing_examples.py",
55
"tests/unit/test_JSONTestSuite.py",
6-
# TODO: remove when this when we drop support for Python 3.9 (example uses match statements)
7-
"examples/asyncio-kv/kv.py",
86
]
97

108
[lint]

examples/asyncio-kv/kv.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from __future__ import annotations
22

33
import asyncio
4-
import msgspec
54
from typing import Any
65

6+
import msgspec
7+
78

89
# Some utilities for writing and reading length-prefix framed messages. Using
910
# length-prefixed framing makes it easier for the reader to determine the

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license = "BSD-3-Clause"
1616
license-files = [
1717
"LICENSE",
1818
]
19-
requires-python = ">=3.9"
19+
requires-python = ">=3.10"
2020
maintainers = [
2121
{ name = "Jim Crist-Harif", email = "jcristharif@gmail.com" },
2222
{ name = "Ofek Lev", email = "oss@ofek.dev" },
@@ -33,7 +33,6 @@ keywords = [
3333
]
3434
classifiers = [
3535
"Development Status :: 4 - Beta",
36-
"Programming Language :: Python :: 3.9",
3736
"Programming Language :: Python :: 3.10",
3837
"Programming Language :: Python :: 3.11",
3938
"Programming Language :: Python :: 3.12",
@@ -85,8 +84,7 @@ hooks = [
8584
"ruff==0.14.1",
8685
]
8786
test-base = [
88-
# TODO: require >=9 once we drop support for Python 3.9
89-
"pytest>=8",
87+
"pytest>=9",
9088
]
9189
test-prof = [
9290
{ include-group = "test-base" },
@@ -103,7 +101,6 @@ test-unit = [
103101
{ include-group = "test-base" },
104102
"attrs",
105103
"coverage",
106-
"eval-type-backport; python_version < '3.10'",
107104
"msgpack",
108105
"pyyaml",
109106
"tomli; python_version < '3.11'",

src/msgspec/_core.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "atof.h"
1818

1919
/* Python version checks */
20-
#define PY310_PLUS (PY_VERSION_HEX >= 0x030a0000)
2120
#define PY311_PLUS (PY_VERSION_HEX >= 0x030b0000)
2221
#define PY312_PLUS (PY_VERSION_HEX >= 0x030c0000)
2322
#define PY313_PLUS (PY_VERSION_HEX >= 0x030d0000)
@@ -511,9 +510,7 @@ typedef struct {
511510
PyObject *get_typeddict_info;
512511
PyObject *get_dataclass_info;
513512
PyObject *rebuild;
514-
#if PY310_PLUS
515513
PyObject *types_uniontype;
516-
#endif
517514
#if PY312_PLUS
518515
PyObject *typing_typealiastype;
519516
#endif
@@ -4899,15 +4896,13 @@ typenode_origin_args_metadata(
48994896
}
49004897
}
49014898

4902-
#if PY310_PLUS
49034899
if (Py_TYPE(t) == (PyTypeObject *)(state->mod->types_uniontype)) {
49044900
/* Handle types.UnionType unions (`int | float | ...`) */
49054901
args = PyObject_GetAttr(t, state->mod->str___args__);
49064902
if (args == NULL) goto error;
49074903
origin = state->mod->typing_union;
49084904
Py_INCREF(origin);
49094905
}
4910-
#endif
49114906

49124907
*out_origin = origin;
49134908
*out_args = args;
@@ -10500,15 +10495,8 @@ ms_encode_err_type_unsupported(PyTypeObject *type) {
1050010495
*************************************************************************/
1050110496

1050210497
#define MS_HAS_TZINFO(o) (((_PyDateTime_BaseTZInfo *)(o))->hastzinfo)
10503-
#if PY310_PLUS
1050410498
#define MS_DATE_GET_TZINFO(o) PyDateTime_DATE_GET_TZINFO(o)
1050510499
#define MS_TIME_GET_TZINFO(o) PyDateTime_TIME_GET_TZINFO(o)
10506-
#else
10507-
#define MS_DATE_GET_TZINFO(o) (MS_HAS_TZINFO(o) ? \
10508-
((PyDateTime_DateTime *)(o))->tzinfo : Py_None)
10509-
#define MS_TIME_GET_TZINFO(o) (MS_HAS_TZINFO(o) ? \
10510-
((PyDateTime_Time *)(o))->tzinfo : Py_None)
10511-
#endif
1051210500

1051310501
#ifndef Py_GIL_DISABLED
1051410502
#ifndef TIMEZONE_CACHE_SIZE
@@ -22298,9 +22286,7 @@ msgspec_clear(PyObject *m)
2229822286
Py_CLEAR(st->get_typeddict_info);
2229922287
Py_CLEAR(st->get_dataclass_info);
2230022288
Py_CLEAR(st->rebuild);
22301-
#if PY310_PLUS
2230222289
Py_CLEAR(st->types_uniontype);
22303-
#endif
2230422290
#if PY312_PLUS
2230522291
Py_CLEAR(st->typing_typealiastype);
2230622292
#endif
@@ -22372,9 +22358,7 @@ msgspec_traverse(PyObject *m, visitproc visit, void *arg)
2237222358
Py_VISIT(st->get_typeddict_info);
2237322359
Py_VISIT(st->get_dataclass_info);
2237422360
Py_VISIT(st->rebuild);
22375-
#if PY310_PLUS
2237622361
Py_VISIT(st->types_uniontype);
22377-
#endif
2237822362
#if PY312_PLUS
2237922363
Py_VISIT(st->typing_typealiastype);
2238022364
#endif
@@ -22594,12 +22578,10 @@ PyInit__core(void)
2259422578
SET_REF(rebuild, "rebuild");
2259522579
Py_DECREF(temp_module);
2259622580

22597-
#if PY310_PLUS
2259822581
temp_module = PyImport_ImportModule("types");
2259922582
if (temp_module == NULL) return NULL;
2260022583
SET_REF(types_uniontype, "UnionType");
2260122584
Py_DECREF(temp_module);
22602-
#endif
2260322585

2260422586
/* Get the EnumMeta type */
2260522587
temp_module = PyImport_ImportModule("enum");

src/msgspec/_utils.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,7 @@ def _forward_ref(value):
4444

4545
def _eval_type(t, globalns, localns):
4646
return typing._eval_type(t, globalns, localns, ())
47-
elif sys.version_info < (3, 10):
4847

49-
def _eval_type(t, globalns, localns):
50-
try:
51-
return typing._eval_type(t, globalns, localns)
52-
except TypeError as e:
53-
try:
54-
from eval_type_backport import eval_type_backport
55-
except ImportError:
56-
raise TypeError(
57-
f"Unable to evaluate type annotation {t.__forward_arg__!r}. If you are making use "
58-
"of the new typing syntax (unions using `|` since Python 3.10 or builtins subscripting "
59-
"since Python 3.9), you should either replace the use of new syntax with the existing "
60-
"`typing` constructs or install the `eval_type_backport` package."
61-
) from e
62-
63-
return eval_type_backport(
64-
t,
65-
globalns,
66-
localns,
67-
try_default=False,
68-
)
6948
else:
7049
_eval_type = typing._eval_type
7150

0 commit comments

Comments
 (0)