-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build with Python 3.11 #10403
Fix build with Python 3.11 #10403
Conversation
if (frame == nullptr) { | ||
return false; | ||
} | ||
} | ||
|
||
if (frame->f_code->co_filename == nullptr) { | ||
if (PyFrame_GetCode(frame)->co_filename == nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every use of frame->f_code
is used to access co_filename
. Perhaps we should make the helper do that instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The helper added above is only to provide backwards compatibility. The PyFrame_GetCode
that was added is meant to match the same behavior as the new function in Python 3.11
@@ -132,7 +169,7 @@ bool _CalledFromGeneratedFile(int stacklevel) { | |||
return false; | |||
} | |||
|
|||
if (frame->f_globals != frame->f_locals) { | |||
if (PyFrame_GetGlobals(frame) != PyFrame_GetLocals(frame)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this appears to be purely testing for at global scope. How about the helper does that directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this falls in the same category, the helpers are for backwards compatibility so we need to keep them consistent with the new API in Python 3.11
Py_INCREF(frame); | ||
while (stacklevel-- > 0) { | ||
frame = frame->f_back; | ||
PyFrameObject* next_frame = PyFrame_GetBack(frame); | ||
Py_DECREF(frame); | ||
frame = next_frame; | ||
if (frame == nullptr) { | ||
return false; | ||
} | ||
Py_INCREF(frame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyEval_GetFrame
returns a borrowed reference but PyFrame_GetBack
returns a strong reference. As a result I think you don't want this last Py_INCREF(frame)
because PyFrame_GetBack
will return a strong reference with it's refcount already incremented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid remark, thanks
Is there anything else I can help with? Or are we waiting for the review to be completed? |
gentle ping) |
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.5.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.5-1.spec mv ../*protobuf*3.21.5*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.5/ rm -rf ../*protobuf*.{deb,ddeb,build,buildinfo,changes} See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
@shadchin Just to verify, you are not waiting on me for anything else, correct? |
I am waiting for a variety of comments that I made on the code to be addressed |
I kind of fixed all the comments. Or is there still something left?
Yes |
@fowles I added a few comments above. I didn't make the changes, so feel free to ignore, but wanted to try to help keep things moving. |
return false; | ||
} | ||
Py_DECREF(frame_globals); | ||
Py_XDECREF(frame_locals); | ||
Py_DECREF(frame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than an ever increasing number of decrefs, please add an error exist that you jump to with a goto that handles all the decrefs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add exit handler
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.5.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.5-1.spec mv ../*protobuf*3.21.5*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.5/ rm -rf ../*protobuf*.{deb,ddeb,build,buildinfo,changes} See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.5.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.5-1.spec mv ../*protobuf*3.21.5*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.5/ rm -rf ../*proto*.{deb,ddeb,build,buildinfo,changes} See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.5.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.5-1.spec mv ../*protobuf*3.21.5*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.5/ rm -rf ../*proto*3.21.5*.* ../python*-protobuf*4.21.5*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.5.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.5-1.spec mv ../*protobuf*3.21.5*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.5/ rm -rf ../*proto*3.21.5*.* ../python*-protobuf*4.21.5*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.6-1.spec mv ../*protobuf*3.21.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.6/ rm -rf ../*proto*3.21.6*.* ../python*-protobuf*4.21.6*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.7.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.7-1.spec mv ../*protobuf*3.21.7*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.7/ rm -rf ../*proto*3.21.7*.* ../python*-protobuf*4.21.7*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.7.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.7-1.spec mv ../*protobuf*3.21.7*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.7/ rm -rf ../*proto*3.21.7*.* ../python*-protobuf*4.21.7*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.5.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.5-1.spec mv ../*protobuf*3.21.5*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.5/ rm -rf ../*proto*3.21.5*.* ../python*-protobuf*4.21.5*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.6-1.spec mv ../*protobuf*3.21.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.6/ rm -rf ../*proto*3.21.6*.* ../python*-protobuf*4.21.6*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.8.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.8-1.spec mv ../*protobuf*3.21.8*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.8/ rm -rf ../*proto*3.21.8*.* ../python*-protobuf*4.21.7*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
I believe we're still seeing the issue that this PR supposedly fixed in: Any patches or recommendations would be appreciated so we don't hold up the python 3.11 roll-out! |
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.9.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.9-1.spec mv ../*protobuf*3.21.9*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.9/ rm -rf ../*proto*3.21.9*.* ../python*-protobuf*4.21.9*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.10.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.10-1.spec mv ../*protobuf*3.21.10*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.10/ rm -rf ../*proto*3.21.10*.* ../python*-protobuf*4.21.10*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.11.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.11-1.spec mv ../*protobuf*3.21.11*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.11/ rm -rf ../*proto*3.21.11*.* ../python*-protobuf*4.21.11*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
Just curious, which release is gonna to release this change? |
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.12.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.12-1.spec mv ../*protobuf*3.21.12*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.12/ rm -rf ../*proto*3.21.12*.* ../python*-protobuf*4.21.12*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.10.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.10-1.spec mv ../*protobuf*3.21.10*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.10/ rm -rf ../*proto*3.21.10*.* ../python*-protobuf*4.21.10*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.11.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.11-1.spec mv ../*protobuf*3.21.11*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.11/ rm -rf ../*proto*3.21.11*.* ../python*-protobuf*4.21.11*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive tar zcvf ../protobuf_3.21.12.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.21.12-1.spec mv ../*protobuf*3.21.12*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.21.12/ rm -rf ../*proto*3.21.12*.* ../python*-protobuf*4.21.12*.* See protocolbuffers#5144 (comment) See https://build.opensuse.org/package/view_file/openSUSE:Factory/protobuf/10355.patch See protocolbuffers#10403 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.4.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.4-1.spec cp ../*protobuf*3.19.4*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.4/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.4/ rm -rf ../*proto*3.19.4*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.4.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.4-1.spec cp ../*protobuf*3.19.4*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.4/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.4/ rm -rf ../*proto*3.19.4*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
git clean -xdf git submodule sync --recursive git submodule update --init --recursive git submodule foreach git checkout -- . tar zcvf ../protobuf_3.19.6.orig.tar.gz --exclude=.git . debuild -uc -us cp protobuf.spec ../protobuf_3.19.6-1.spec cp ../*protobuf*3.19.6*.{gz,xz,spec,dsc} /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ cp _constraints /osc/home\:alvistack/protocolbuffers-protobuf-3.19.6/ rm -rf ../*proto*3.19.6*.* See protocolbuffers#10403 See protocolbuffers#12331 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
The PyFrameObject structure members have been removed from the public C API.