Skip to content

Commit

Permalink
Fix for python < 3.10
Browse files Browse the repository at this point in the history
Summary: Structural pattern matching and `Py_TPFLAGS_MAPPING` added in 3.10+

Reviewed By: createdbysk

Differential Revision: D67044512

fbshipit-source-id: ac668360b161806ff49051e380b890fc84a47dad
  • Loading branch information
yoney authored and facebook-github-bot committed Dec 10, 2024
1 parent 96290d0 commit a05cd62
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions third-party/thrift/src/thrift/lib/python/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1705,11 +1705,15 @@ PyObject* getStandardMutableDefaultValuePtrForType(

void tag_object_as_sequence(PyTypeObject* type_object) {
DCHECK(PyType_Check(type_object));
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 10
type_object->tp_flags |= Py_TPFLAGS_SEQUENCE;
#endif
}
void tag_object_as_mapping(PyTypeObject* type_object) {
DCHECK(PyType_Check(type_object));
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 10
type_object->tp_flags |= Py_TPFLAGS_MAPPING;
#endif
}
} // namespace apache::thrift::python

Expand Down

0 comments on commit a05cd62

Please sign in to comment.