mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-07 15:43:49 +02:00
python3-protobuf: fix build with Python 3.11
This commit is contained in:
parent
14957afa52
commit
0619b27e82
1 changed files with 46 additions and 0 deletions
46
srcpkgs/python3-protobuf/patches/python-3.11.patch
Normal file
46
srcpkgs/python3-protobuf/patches/python-3.11.patch
Normal file
|
@ -0,0 +1,46 @@
|
|||
--- a/google/protobuf/pyext/descriptor.cc
|
||||
+++ b/google/protobuf/pyext/descriptor.cc
|
||||
@@ -91,6 +91,12 @@ PyObject* PyString_FromCppString(const s
|
||||
//
|
||||
// TODO(amauryfa): Change the proto2 compiler to remove the assignments, and
|
||||
// remove this hack.
|
||||
+#if PY_VERSION_HEX < 0x03090000
|
||||
+#define PyFrame_GetCode(x) (x)->f_code
|
||||
+#define PyFrame_GetGlobals(x) (x)->f_globals
|
||||
+#define PyFrame_GetLocals(x) (x)->f_locals
|
||||
+#define PyFrame_GetBack(x) (x)->f_back
|
||||
+#endif
|
||||
bool _CalledFromGeneratedFile(int stacklevel) {
|
||||
#ifndef PYPY_VERSION
|
||||
// This check is not critical and is somewhat difficult to implement correctly
|
||||
@@ -100,18 +106,18 @@ bool _CalledFromGeneratedFile(int stackl
|
||||
return false;
|
||||
}
|
||||
while (stacklevel-- > 0) {
|
||||
- frame = frame->f_back;
|
||||
+ frame = PyFrame_GetBack(frame);
|
||||
if (frame == nullptr) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
- if (frame->f_code->co_filename == nullptr) {
|
||||
+ if (PyFrame_GetCode(frame)->co_filename == nullptr) {
|
||||
return false;
|
||||
}
|
||||
char* filename;
|
||||
Py_ssize_t filename_size;
|
||||
- if (PyString_AsStringAndSize(frame->f_code->co_filename,
|
||||
+ if (PyString_AsStringAndSize(PyFrame_GetCode(frame)->co_filename,
|
||||
&filename, &filename_size) < 0) {
|
||||
// filename is not a string.
|
||||
PyErr_Clear();
|
||||
@@ -132,7 +138,7 @@ bool _CalledFromGeneratedFile(int stackl
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (frame->f_globals != frame->f_locals) {
|
||||
+ if (PyFrame_GetGlobals(frame) != PyFrame_GetLocals(frame)) {
|
||||
// Not at global module scope
|
||||
return false;
|
||||
}
|
Loading…
Add table
Reference in a new issue