Skip to content

Fixed parameter names in Image.eval() and ImageStat.Stat docstrings - #10342

Merged
radarhere merged 1 commit into
python-pillow:mainfrom
mmporong:docs-fix-param-names
Oct 27, 2026
Merged

radarhere merged 1 commit into
python-pillow:mainfrom
mmporong:docs-fix-param-names

Conversation

@mmporong

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request:

  • In the ImageStat.Stat docstring, rename :param image: to :param image_or_list:, the name __init__() takes.
  • In the Image.eval() docstring, rename :param function: to :param \*args:, since the function is passed positionally through *args. The docstring becomes a raw string for the backslash, as in ImageShow.show().

The rendered docs show a signature and a parameter list that disagree, for example __init__(image_or_list, mask=None) with a parameter called image. Passing the documented names as keywords fails:

>>> ImageStat.Stat(image=im)
TypeError: Stat.__init__() got an unexpected keyword argument 'image'
>>> Image.eval(im, function=lambda v: v * 2)
TypeError: eval() got an unexpected keyword argument 'function'

I found these two by comparing every :param name: in src/PIL/*.py with the parameters of its function; no other mismatches turned up. An autodoc build of the two objects with --fail-on-warning passes and lists image_or_list and *args, and ruff, black and the other pre-commit hooks pass on the changed files.

@radarhere
radarhere enabled auto-merge October 27, 2026 13:21
@radarhere
radarhere merged commit d504f63 into python-pillow:main Oct 27, 2026
74 of 78 checks passed
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.

2 participants