Skip to content

gh-154788: Make curses window.getparent() unconditional - #154789

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
fedonman:curses-getparent-unconditional
Jul 29, 2026
Merged

gh-154788: Make curses window.getparent() unconditional#154789
serhiy-storchaka merged 2 commits into
python:mainfrom
fedonman:curses-getparent-unconditional

Conversation

@fedonman

@fedonman fedonman commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

window.getparent() calls no curses function: it returns the window's stored parent. It was
compiled only when the ncurses extension functions were present, so it was missing on
backends without them, although the documentation lists no availability requirement for it.
The guard now closes after getscrreg(), which does need it.

The test moves out of test_state_getters, which is gated on is_scrollok(), so that
getparent() is covered on backends without the extensions.

Compiling the extensions-absent configuration is not possible here, since the ncurses header
defines NCURSES_EXT_FUNCS, so that side rests on reading the code. getparent() is new in
3.16, so there is no NEWS entry.

getparent() calls no curses function, it returns the window's stored parent,
but it was compiled only when the ncurses extension functions were present.
Close the guard after getscrreg(), which does need it.

The test moves out of test_state_getters, which is gated on is_scrollok(), so
that getparent() is covered on backends without the extensions.
Comment thread Lib/test/test_curses.py Outdated

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@serhiy-storchaka
serhiy-storchaka merged commit 6af6165 into python:main Jul 29, 2026
54 checks passed
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Android 3.x (tier-3) has failed when building commit 6af6165.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1591/builds/5111) and take a look at the build logs.
  4. Check if the failure is related to this commit (6af6165) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1591/builds/5111

Summary of the results of the build (if available):

Click to see traceback logs
remote: Enumerating objects: 7, done.        
remote: Counting objects:  14% (1/7)        
remote: Counting objects:  28% (2/7)        
remote: Counting objects:  42% (3/7)        
remote: Counting objects:  57% (4/7)        
remote: Counting objects:  71% (5/7)        
remote: Counting objects:  85% (6/7)        
remote: Counting objects: 100% (7/7)        
remote: Counting objects: 100% (7/7), done.        
remote: Compressing objects:  14% (1/7)        
remote: Compressing objects:  28% (2/7)        
remote: Compressing objects:  42% (3/7)        
remote: Compressing objects:  57% (4/7)        
remote: Compressing objects:  71% (5/7)        
remote: Compressing objects:  85% (6/7)        
remote: Compressing objects: 100% (7/7)        
remote: Compressing objects: 100% (7/7), done.        
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)        
From https://github.com/python/cpython
 * branch                    main       -> FETCH_HEAD
Note: switching to '6af6165c21ddc6adc6208d69606dbdcdbdb06418'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 6af6165c21d gh-154788: Make curses window.getparent() unconditional (GH-154789)
Switched to and reset branch 'main'

configure: WARNING: no system libmpdec found; falling back to pure-Python version for the decimal module

In file included from ../../Include/internal/pycore_dict.h:11,
                 from ../../Objects/typeobject.c:8:
In function ‘Py_DECREF_MORTAL’,
    inlined from ‘PyStackRef_CLOSE’ at ../../Include/internal/pycore_stackref.h:703:9,
    inlined from ‘_PyThreadState_PopCStackRef’ at ../../Include/internal/pycore_stackref.h:811:5,
    inlined from ‘vectorcall_maybe’ at ../../Objects/typeobject.c:3079:9:
../../Include/internal/pycore_object.h:448:8: warning: array subscript 0 is outside array bounds of ‘PyObject[0]’ {aka ‘struct _object[]’} [-Warray-bounds]
  448 |     if (--op->ob_refcnt == 0) {
      |        ^

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  201k  100  201k    0     0   438k      0 --:--:-- --:--:-- --:--:--  438k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100 43710  100 43710    0     0  95899      0 --:--:-- --:--:-- --:--:-- 95899
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100 6254k  100 6254k    0     0  12.3M      0 --:--:-- --:--:-- --:--:-- 12.3M
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100 1436k  100 1436k    0     0  3221k      0 --:--:-- --:--:-- --:--:-- 3221k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  5  629k    5 38271    0     0  78659      0  0:00:08 --:--:--  0:00:08 78659
100  629k  100  629k    0     0  1282k      0 --:--:-- --:--:-- --:--:--  192M
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  511k  100  511k    0     0  1112k      0 --:--:-- --:--:-- --:--:-- 1112k
configure: WARNING: no system libmpdec found; falling back to pure-Python version for the decimal module

../../Python/fileutils.c:458:1: warning: unused function 'decode_current_locale' [-Wunused-function]
  458 | decode_current_locale(const char* arg, wchar_t **wstr, size_t *wlen,
      | ^~~~~~~~~~~~~~~~~~~~~
../../Python/fileutils.c:677:1: warning: unused function 'encode_current_locale' [-Wunused-function]
  677 | encode_current_locale(const wchar_t *text, char **str,
      | ^~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
../../Modules/_localemodule.c:195:1: warning: unused function 'is_all_ascii' [-Wunused-function]
  195 | is_all_ascii(const char *str)
      | ^~~~~~~~~~~~
1 warning generated.
../../Modules/pwdmodule.c:69:16: warning: unused variable 'pwd_db_mutex' [-Wunused-variable]
   69 | static PyMutex pwd_db_mutex = {0};
      |                ^~~~~~~~~~~~
1 warning generated.
../../Modules/_hacl/Lib_Memzero0.c:66:6: warning: "Your platform does not support any safe implementation of memzero -- consider a pull request!" [-W#warnings]
   66 |     #warning "Your platform does not support any safe implementation of memzero -- consider a pull request!"
      |      ^
1 warning generated.
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:283:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  283 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:290:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  290 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:436:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  436 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:443:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  443 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:549:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  549 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:558:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  558 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:580:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  580 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:591:9: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  591 |         CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |         ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:688:11: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  688 |           CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |           ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:733:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  733 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:759:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  759 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:770:9: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  770 |         CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |         ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:783:11: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  783 |           CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |           ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:928:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  928 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:941:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  941 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:958:5: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  958 |     CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
      |     ^
../../Modules/expat/xmltok_impl.c:116:5: note: expanded from macro 'CHECK_NMSTRT_CASES'
  116 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:965:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
  965 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:1200:7: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
 1200 |       CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |       ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
In file included from ../../Modules/expat/xmltok.c:309:
../../Modules/expat/xmltok_impl.c:1220:11: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
 1220 |           CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
      |           ^
../../Modules/expat/xmltok_impl.c:87:5: note: expanded from macro 'CHECK_NAME_CASES'
   87 |     EXPAT_FALLTHROUGH;                                                         \
      |     ^
../../Modules/expat/fallthrough.h:45:33: note: expanded from macro 'EXPAT_FALLTHROUGH'
   45 | #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
      |                                 ^
19 warnings generated.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  8784  100  8784    0     0  29688      0 --:--:-- --:--:-- --:--:-- 31038
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2894  100  2894    0     0  10471      0 --:--:-- --:--:-- --:--:-- 10447
100  2894  100  2894    0     0  10264      0 --:--:-- --:--:-- --:--:-- 10262
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 43504  100 43504    0     0   150k      0 --:--:-- --:--:-- --:--:--  151k

@fedonman
fedonman deleted the curses-getparent-unconditional branch July 29, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants