[Python-Dev] The curious case of 255 function arguments

Serhiy Storchaka storchaka at gmail.com
Mon Aug 6 05:17:52 EDT 2018

06.08.18 08:13, Stephen McDowell пише:
> I've looked at the C code for a while and it is entirely non-obvious 
> what would lead to python *2* /allowing/ >255 arguments.  Anybody happen 
> to know how / why the python *2* versions *succeed*?

The error message is misleading. It should be "more than 255 
parameters". This limitation is due to the optimization used in Python 3 
for call variables (see https://bugs.python.org/issue12399 for details).

In all versions <3.7 there is a limitation on the number of explicit 
function arguments because of the limitation of the CALL_FUNCTION opcode.

> Thank you for reading, this is not a problem, just a burning desire for 
> closure (even if anecdotal) as to how this can be.  I deeply love 
> python, and am not complaining!  I stumbled across this and found it 
> truly confounding, and thought the gurus here may happen to recall what 
> changed in 3.x that lead the the error condition actually being asserted :)

Read the history of the code. Commit messages usually contain 
explanations or references to issues.

More information about the Python-Dev mailing list