Skip to content

Commit

Permalink
Import MutableSequence from collections.abc on Python 3. (#6272)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminp authored and Imre Steiner committed Jan 27, 2021
1 parent e526d3d commit 1dcc76c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/google/protobuf/pyext/message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2957,8 +2957,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;
}
Expand Down

0 comments on commit 1dcc76c

Please sign in to comment.