mirror of
https://github.com/void-linux/void-packages.git
synced 2025-09-09 13:32:55 +02:00
46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
--- 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;
|
|
}
|