Skip to content

Commit 2961717

Browse files
bpo-33182: Fix pointer types in _testembed (pythonGH-6310) (pythonGH-6311)
(cherry picked from commit 69f5c73) Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
1 parent faa6f5c commit 2961717

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The embedding tests can once again be built with clang 6.0

Programs/_testembed.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,18 @@ static int test_pre_initialization_api(void)
166166
/* bpo-33042: Ensure embedding apps can predefine sys module options */
167167
static int test_pre_initialization_sys_options(void)
168168
{
169-
/* We allocate a couple of the option dynamically, and then delete
169+
/* We allocate a couple of the options dynamically, and then delete
170170
* them before calling Py_Initialize. This ensures the interpreter isn't
171171
* relying on the caller to keep the passed in strings alive.
172172
*/
173-
wchar_t *static_warnoption = L"once";
174-
wchar_t *static_xoption = L"also_not_an_option=2";
173+
const wchar_t *static_warnoption = L"once";
174+
const wchar_t *static_xoption = L"also_not_an_option=2";
175175
size_t warnoption_len = wcslen(static_warnoption);
176176
size_t xoption_len = wcslen(static_xoption);
177-
wchar_t *dynamic_once_warnoption = calloc(warnoption_len+1, sizeof(wchar_t));
178-
wchar_t *dynamic_xoption = calloc(xoption_len+1, sizeof(wchar_t));
177+
wchar_t *dynamic_once_warnoption = \
178+
(wchar_t *) calloc(warnoption_len+1, sizeof(wchar_t));
179+
wchar_t *dynamic_xoption = \
180+
(wchar_t *) calloc(xoption_len+1, sizeof(wchar_t));
179181
wcsncpy(dynamic_once_warnoption, static_warnoption, warnoption_len+1);
180182
wcsncpy(dynamic_xoption, static_xoption, xoption_len+1);
181183

0 commit comments

Comments
 (0)