8000 get up to date by sumagnadas · Pull Request #22429 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

get up to date #22429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-41428: Fix compiler warning in unionobject.c (GH-22416)
Use Py_ssize_t type rather than int, to store lengths in
unionobject.c. Fix the warning:

Objects\unionobject.c(205,1): warning C4244: 'initializing':
conversion from 'Py_ssize_t' to 'int', possible loss of data
  • Loading branch information
vstinner authored and sumagnadas committed Sep 27, 2020
commit d6a7cf1a9d852feed8d723ebb06ae3655779845f
6 changes: 3 additions & 3 deletions Objects/unionobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ flatten_args(PyObject* args)
PyTypeObject* arg_type = Py_TYPE(arg);
if (arg_type == &_Py_UnionType) {
PyObject* nested_args = ((unionobject*)arg)->args;
int nested_arg_length = PyTuple_GET_SIZE(nested_args);
for (int j = 0; j < nested_arg_length; j++) {
Py_ssize_t nested_arg_length = PyTuple_GET_SIZE(nested_args);
for (Py_ssize_t j = 0; j < nested_arg_length; j++) {
PyObject* nested_arg = PyTuple_GET_ITEM(nested_args, j);
Py_INCREF(nested_arg);
PyTuple_SET_ITEM(flattened_args, pos, nested_arg);
Expand Down Expand Up @@ -231,7 +231,7 @@ dedup_and_flatten_args(PyObject* args)
return NULL;
}
// Add unique elements to an array.
int added_items = 0;
Py_ssize_t added_items = 0;
for (Py_ssize_t i = 0; i < arg_length; i++) {
int is_duplicate = 0;
PyObject* i_element = PyTuple_GET_ITEM(args, i);
Expand Down
0