Commit 9d61eada authored by Benjamin Peterson's avatar Benjamin Peterson Committed by Jie Luo

Import MutableSequence from collections.abc on Python 3. (#6272)

Fixes https://github.com/protocolbuffers/protobuf/issues/5335.
parent 9b0fa3e7
......@@ -2958,8 +2958,12 @@ bool InitProto2MessageModule(PyObject *m) {
reinterpret_cast<PyObject*>(
&RepeatedCompositeContainer_Type));
// Register them as collections.Sequence
// Register them as MutableSequence.
#if PY_MAJOR_VERSION >= 3
ScopedPyObjectPtr collections(PyImport_ImportModule("collections.abc"));
#else
ScopedPyObjectPtr collections(PyImport_ImportModule("collections"));
#endif
if (collections == NULL) {
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment