Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee36db5

Browse files
authored
gh-125843: indicate which C function caused acurses.error (#125844)
- Rename error helpers with a `curses_set_error_*` prefix instead of `PyCurses*`.- Cleanly report both NULL and ERR cases.- Raise `curses.error` in `is_linetouched` instead of a `TypeError`.
1 parentc31547a commitee36db5

File tree

4 files changed

+367
-180
lines changed

4 files changed

+367
-180
lines changed

‎Include/py_curses.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ static void **PyCurses_API;
109109
staticconstcharcatchall_ERR[]="curses function returned ERR";
110110
staticconstcharcatchall_NULL[]="curses function returned NULL";
111111

112+
#if defined(CURSES_MODULE)|| defined(CURSES_PANEL_MODULE)
113+
/* Error messages shared by the curses package */
114+
# defineCURSES_ERROR_FORMAT "%s() returned %s"
115+
# defineCURSES_ERROR_VERBOSE_FORMAT "%s() (called by %s()) returned %s"
116+
# defineCURSES_ERROR_MUST_CALL_FORMAT "must call %s() first"
117+
#endif
118+
112119
#ifdef__cplusplus
113120
}
114121
#endif

‎Lib/test/test_curses.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ def test_use_env(self):
130130
curses.use_env(False)
131131
curses.use_env(True)
132132

133+
deftest_error(self):
134+
self.assertIsSubclass(curses.error,Exception)
135+
133136
deftest_create_windows(self):
134137
win=curses.newwin(5,10)
135138
self.assertEqual(win.getbegyx(), (0,0))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
If possible, indicate which:mod:`curses` C function or macro is responsible
2+
for raising a:exc:`curses.error` exception. Patch by Bénédikt Tran.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp