We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a58e68 commit 7c0876cCopy full SHA for 7c0876c
Python/sysmodule.c
@@ -1776,10 +1776,15 @@ sys__getframe_impl(PyObject *module, int depth)
1776
return NULL;
1777
}
1778
1779
- while (depth > 0 && frame != NULL) {
1780
- frame = frame->previous;
1781
- if (!frame->is_artificial) {
1782
- --depth;
+ if (frame != NULL) {
+ while (depth > 0) {
+ frame = frame->previous;
+ if (frame == NULL) {
1783
+ break;
1784
+ }
1785
+ if (!frame->is_artificial) {
1786
+ --depth;
1787
1788
1789
1790
if (frame == NULL) {
0 commit comments