Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commented Mar 15, 2019

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

https://bugs.python.org/issue36127


/* 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
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@serhiy-storchaka@vstinner@the-knights-who-say-ni@bedevere-bot