GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-157170: Restore use_env() after test_use_prescr_screen in test_curses by iamsharduld · Pull Request #157171 · python/cpython

Conversation

@iamsharduld

@iamsharduld iamsharduld commented Sep 8, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

test_use_prescr_screen turns use_env off to show that a new_prescr() screen can be used to affect state before initscr(), and never turns it back on. curses.use_env() calls ncurses' use_env(), which sets the process-wide default (_nc_prescreen.use_env) that every later screen copies, not a property of the screen that is current at the time. With it off, ncurses sizes a screen from the terminfo lines/cols capabilities alone, and the linux entry used by the CI runners has none, so every newterm() for the rest of the process returns NULL. That is the 138 errors test_curses reports in the parallel phase of every Ubuntu CI run (all 31 Ubuntu job runs in the last 8 successful runs on main); the sequential rerun passes only because it re-runs the failed tests by name and so never runs ScreenTests first. Details, including an ncurses trace of the failing newterm(), are in the issue.

This restores the setting with addCleanup(). Verified on Ubuntu 25.10 with ncurses 6.5 (the newterm-based setUp() needs ncurses 6.5 or newer):

  • TERM=linux ./python -m test test_curses -u curses: 138 errors before, passes after (three consecutive runs).
  • TERM=linux ./python -m test --fast-ci test_curses: no rerun needed after.
  • TERM=xterm still passes.

On macOS the ScreenTests are skipped (ncurses 6.0), which is why this was invisible on developer machines.

  • Issue: test_curses fails in every Ubuntu CI run's parallel phase: test_use_prescr_screen leaves use_env(False) set, so newterm() fails with TERM=linux #157170

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iamsharduld
pythongh-157170: Restore use_env() after test_use_prescr_screen in te…
c2ad600
…st_curses

curses.use_env() sets a process-wide ncurses default, not a property of
the screen it is called on. test_use_prescr_screen turned it off and
never turned it back on, so every newterm() in the rest of the process
took the screen size from terminfo alone. For a terminfo entry with no
size, such as "linux" on the CI runners, that makes newterm() return
NULL: test_curses failed with 138 errors in the parallel phase of every
Ubuntu CI run and only passed on the rerun, which skips ScreenTests.
@bedevere-app bedevere-app Bot mentioned this pull request Sep 8, 2026
test_curses fails in every Ubuntu CI run's parallel phase: test_use_prescr_screen leaves use_env(False) set, so newterm() fails with TERM=linux #157170
Closed
@bedevere-app bedevere-app Bot added tests Tests in the Lib/test dir awaiting review labels Sep 8, 2026
@iamsharduld iamsharduld mentioned this pull request Sep 8, 2026
gh-157184: Scale the join() alarm in the multiprocessing kill tests #157185
Closed
@serhiy-storchaka
serhiy-storchaka self-requested a review September 9, 2026 07:49
@serhiy-storchaka serhiy-storchaka added the skip news label Sep 9, 2026
serhiy-storchaka
serhiy-storchaka reviewed Sep 9, 2026
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

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.

Good catch, and thank you for the trace.

Please drop the NEWS entry. This is a fix to unreleased test. It does not need a NEWS entry.

Please simplify the comment, it is too verbose. One addition line would be enough.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iamsharduld
Address review: drop the NEWS entry and shorten the comment
a779f46
@iamsharduld

iamsharduld commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Thank you. Both done in a779f46:

  • NEWS entry dropped. bedevere/news will stay red until skip news is applied.
  • The comment is now a single line: # use_env() is process-wide, not a property of this screen.

The diff is two added lines. Re-ran test_curses with TERM=linux and with TERM=xterm-256color; both pass.

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting change review and removed awaiting review labels Sep 9, 2026
@bedevere-app

bedevere-app Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 9, 2026
gh-131178: Add tests for pstats command-line interface #157133
Open
gh-131178: Add tests for ensurepip command-line interface #157154
Open
gh-157161: Fix test_rollover_based_on_st_birthtime_only on slow machines #157162
Open
serhiy-storchaka
serhiy-storchaka approved these changes Sep 9, 2026
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

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.

LGTM. 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting change review labels Sep 9, 2026
@serhiy-storchaka
serhiy-storchaka merged commit 5f14441 into python:main Sep 9, 2026
53 of 56 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 9, 2026
@bedevere-bot

bedevere-bot commented Sep 9, 2026

Copy link
Copy Markdown

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

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

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/5200) and take a look at the build logs.
  4. Check if the failure is related to this commit (5f14441) 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/5200

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

Click to see traceback logs
remote: Enumerating objects: 5, done.        
remote: Counting objects:  25% (1/4)        
remote: Counting objects:  50% (2/4)        
remote: Counting objects:  75% (3/4)        
remote: Counting objects: 100% (4/4)        
remote: Counting objects: 100% (4/4), done.        
remote: Compressing objects:  25% (1/4)        
remote: Compressing objects:  50% (2/4)        
remote: Compressing objects:  75% (3/4)        
remote: Compressing objects: 100% (4/4)        
remote: Compressing objects: 100% (4/4), done.        
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 1 (from 1)        
From https://github.com/python/cpython
 * branch                    main       -> FETCH_HEAD
Note: switching to '5f14441114af4b8aadf45aa0dd764e43f5eedd5d'.

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 5f14441114a gh-157170: Restore use_env() after test_use_prescr_screen in test_curses (GH-157171)
Switched to and reset branch 'main'

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

../../Parser/lexer/string.c: In function ‘finish_ftstring_expr’:
../../Parser/lexer/string.c:81:20: warning: variable ‘previous_end’ set but not used [-Wunused-but-set-variable]
   81 |         _PyTok_Off previous_end = state->expr_span.start;
      |                    ^~~~~~~~~~~~
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:3118: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
curl: (22) The requested URL returned error: 500
Warning: Problem : HTTP error. Will retry in 1 seconds. 5 retries left.

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  157k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 500
Warning: Problem : HTTP error. Will retry in 2 seconds. 4 retries left.

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  157k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 500
Warning: Problem : HTTP error. Will retry in 4 seconds. 3 retries left.

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  157k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 500
Warning: Problem : HTTP error. Will retry in 8 seconds. 2 retries left.

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  157k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 500
Warning: Problem : HTTP error. Will retry in 16 seconds. 1 retries left.

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  157k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 500
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

maurycy added a commit to maurycy/cpython that referenced this pull request Sep 10, 2026
@maurycy
Merge branch 'main' into tachyon-native-callable
e028ff5
* main: (158 commits)
  pythongh-156924: Try reifying lazy imports in `ForwarRef.evaluate()` (python#156940)
  pythongh-156233: Fix typos and code snippet errors in the docs (python#156475)
  pythongh-156837: Refer to yield expressions in generator function definitions (pythonGH-156863)
  pythongh-155292: Skip updating unicodedata with mismatched interpreter (pythonGH-157066)
  pythongh-157170: Document the scope of global curses settings (pythonGH-157207)
  pythongh-155966: Correct handling of `math.tanpi` poles (python#155980)
  pythongh-157170: Restore use_env() after test_use_prescr_screen in test_curses (pythonGH-157171)
  pythongh-156910: fix deadlock in type_set_abstractmethods under free-threading (python#156948)
  pythongh-155648: Write the empty and placeholder IDLE tests (python#156260)
  pythongh-153569: centralize formatted-string state and source spans (python#156484)
  pythongh-157137: Mark the PEP 820 soft deprecations as 3.15, not `next` (python#157138)
  pythongh-152433: Use regular LoadLibrary in UWP for Windows system libs (pythonGH-156972)
  pythongh-121617: Fix Py_CLEAR() memcpy in C++: replace NULL with _Py_NULL (python#157188)
  pythongh-157135: Fix documentation errors in the `math.atan{2}pi` functions (python#157136)
  pythongh-121617: Fix Py_CLEAR() in C++: replace NULL with _Py_NULL (python#157067)
  pythongh-156774: Speed up pdb startup with asyncio guard (python#156775)
  pythongh-156109: Allow static, non-framework iOS builds (python#156110)
  pythongh-156780: Emscripten: add missing EM_JS_DEPS (python#156798)
  pythongh-152936: Make privileged functions available on Android (python#152977)
  pythongh-123018: Keep the libedit history file header when truncating (pythonGH-157165)
  ...
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Sep 12, 2026
@iamsharduld @clin1234
pythongh-157170: Restore use_env() after test_use_prescr_screen in te…
df09d29
…st_curses (pythonGH-157171)

curses.use_env() sets a process-wide ncurses setting, not a property of
the screen it is called on.
johnslavik pushed a commit to johnslavik/cpython that referenced this pull request Sep 14, 2026
@iamsharduld @johnslavik
pythongh-157170: Restore use_env() after test_use_prescr_screen in te…
c0b7248
…st_curses (pythonGH-157171)

curses.use_env() sets a process-wide ncurses setting, not a property of
the screen it is called on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@iamsharduld @bedevere-bot @serhiy-storchaka
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.