Skip to content

Commit e886f93

Browse files
gh-152275: Initialize the optional attr argument to zero
For methods where attr is an optional argument (addch(), addstr(), insch(), ...) the attr converter left the attr_t variable uninitialized when the argument was omitted, so a garbage value could be applied as character attributes. Give the converter c_ignored_default, as the builtin numeric converters have, so the option-group variable is initialized to zero. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7dd5e94 commit e886f93

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

Modules/_cursesmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,9 @@ attr_converter(PyObject *arg, void *ptr)
931931
class attr_converter(CConverter):
932932
type = 'attr_t'
933933
converter = 'attr_converter'
934+
c_ignored_default = '0'
934935
[python start generated code]*/
935-
/*[python end generated code: output=da39a3ee5e6b4b0d input=6132d3d99d3ec25a]*/
936+
/*[python end generated code: output=da39a3ee5e6b4b0d input=57b994c97cbd5e80]*/
936937

937938
#ifdef HAVE_NCURSESW
938939
/* -------------------------------------------------------*/

Modules/clinic/_cursesmodule.c.h

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)