소스 검색

Fixed Python C++ extension for Python 3.8.

Python 3.8 changed the meaning and type of the tp_print slot.
Joshua Haberman 4 년 전
부모
커밋
c2c13a558a
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      python/google/protobuf/pyext/repeated_composite_container.cc
  2. 1 1
      python/google/protobuf/pyext/repeated_scalar_container.cc

+ 1 - 1
python/google/protobuf/pyext/repeated_composite_container.cc

@@ -567,7 +567,7 @@ PyTypeObject RepeatedCompositeContainer_Type = {
     sizeof(RepeatedCompositeContainer),         // tp_basicsize
     0,                                          //  tp_itemsize
     repeated_composite_container::Dealloc,      //  tp_dealloc
-    nullptr,                                    //  tp_print
+    0,                                          //  tp_print, in Python >=3.8: Py_ssize_t tp_vectorcall_offset
     nullptr,                                    //  tp_getattr
     nullptr,                                    //  tp_setattr
     nullptr,                                    //  tp_compare

+ 1 - 1
python/google/protobuf/pyext/repeated_scalar_container.cc

@@ -753,7 +753,7 @@ PyTypeObject RepeatedScalarContainer_Type = {
     sizeof(RepeatedScalarContainer),         // tp_basicsize
     0,                                       //  tp_itemsize
     repeated_scalar_container::Dealloc,      //  tp_dealloc
-    nullptr,                                 //  tp_print
+    0,                                       //  tp_print, in Python >=3.8: Py_ssize_t tp_vectorcall_offset
     nullptr,                                 //  tp_getattr
     nullptr,                                 //  tp_setattr
     nullptr,                                 //  tp_compare