New submission from Raymond Hettinger <[email protected]>:
help(dict.pop) was correct in 3.7:
pop(...)
D.pop(k[,d]) -> v
and incorrect for 3.8:
pop(self, key, default=None, /)
This happened in:
https://github.com/python/cpython/commit/9e4f2f3a6b8ee995c365e86d976937c141d867f8
https://github.com/python/cpython/pull/12792
We've long known that the Argument Clinic was not applicable to all functions
and methods, including this one in particular. The issue is that the one
argument form does not set the default to None; rather, it triggers a KeyError
when the key is missing. In other words, there is an important and
long-standing semantic difference between d.pop(k) and d.pop(k,None).
When reverting this change, please add a note about why the ArgumentClinic is
not being applied to this function until its capabilities have been built-out
to handle functions that have different behaviors depending on the number of
arguments.
Also, we should review other recent applications of the ArgumentClinic to make
sure they didn't make the same mistake.
----------
components: Argument Clinic
keywords: 3.8regression
messages: 345062
nosy: larry, rhettinger
priority: high
severity: normal
status: open
title: Incorrect application of Argument Clinic to dict.pop()
versions: Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37206>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com