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

Appearance settings

bpo-36127: Fix compiler warning in _PyArg_UnpackKeywords().#12353

Merged
serhiy-storchaka merged 1 commit into
python:masterpython/cpython:masterfrom
serhiy-storchaka:getargs_warn2serhiy-storchaka/cpython:getargs_warn2Copy head branch name to clipboard
Mar 16, 2019
Merged

bpo-36127: Fix compiler warning in _PyArg_UnpackKeywords().#12353
serhiy-storchaka merged 1 commit into
python:masterpython/cpython:masterfrom
serhiy-storchaka:getargs_warn2serhiy-storchaka/cpython:getargs_warn2Copy head branch name to clipboard

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Mar 15, 2019

Copy link
Copy Markdown
Member

Since nargs <= maxpos, nargs can be casted to int without lost.

https://bugs.python.org/issue36127

Comment thread Python/getargs.c

/* copy keyword args using kwtuple to drive process */
for (i = Py_MAX(nargs, posonly); i < maxargs; i++) {
for (i = Py_MAX((int)nargs, posonly); i < maxargs; i++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this code is safe is nargs > INT_MAX. (int)(INT_MAX+1) gives 0, no?

Maybe write something like:

i = (nargs < INT_MAX) ? (int)nargs : INT_MAX;
i = Py_MAX(i, posonly);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.