Skip to content

Commit 36e56c4

Browse files
committed
Suppress hashing error when parsing annotated types
1 parent a0cc7ea commit 36e56c4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

msgspec/_core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4621,11 +4621,15 @@ typenode_origin_args_metadata(
46214621
* abstract -> concrete mapping. If present, this is an unparametrized
46224622
* collection of some form. This helps avoid compatibility issues in
46234623
* Python 3.8, where unparametrized collections still have __args__. */
4624-
origin = PyDict_GetItem(state->mod->concrete_types, t);
4624+
origin = PyDict_GetItemWithError(state->mod->concrete_types, t);
46254625
if (origin != NULL) {
46264626
Py_INCREF(origin);
46274627
break;
46284628
}
4629+
else {
4630+
/* Ignore all errors in this initial check */
4631+
PyErr_Clear();
4632+
}
46294633

46304634
/* If `t` is a type instance, no need to inspect further */
46314635
if (PyType_CheckExact(t)) {

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ omit =
1212
markers =
1313
mypy
1414
pyright
15+
filterwarnings =
16+
error
1517

1618
[versioneer]
1719
VCS = git

0 commit comments

Comments
 (0)