classification
Title: Deprecate passing some conflicting arguments by keyword
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, xtreak
Priority: normal Keywords: patch

Created on 2019-03-31 07:17 by serhiy.storchaka, last changed 2019-04-01 08:00 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12637 merged serhiy.storchaka, 2019-03-31 07:36
PR 12645 merged serhiy.storchaka, 2019-04-01 07:20
Messages (4)
msg339249 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-31 07:17
As Steve mentioned in the discussion about PEP 570 [1], some changes of parameters to positional-only are breaking (although there is no breaks in the stdlib code). Before making parameters positional-only we should add a deprecation warning for passing them as keyword arguments. Similarly to the code used in the UserDict constructor (see issue22609).

The following PR adds deprecation warnings for other parameters which should be positional-only. It also fixes bugs about nonavailability to pass special keyword names like "self" or "func". Just one example:

>>> import functools
>>> def f(self, func): pass
... 
>>> functools.partialmethod(f, func=chr)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got multiple values for argument 'func'


[1] https://discuss.python.org/t/pep-570-python-positional-only-parameters/1078/53
msg339280 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-04-01 06:16
New changeset 42a139ed88c487f325a241c6ee8b308b3c045975 by Serhiy Storchaka in branch 'master':
bpo-36492: Deprecate passing some arguments as keyword arguments. (GH-12637)
https://github.com/python/cpython/commit/42a139ed88c487f325a241c6ee8b308b3c045975
msg339283 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-04-01 07:59
New changeset a37f356de19828241bf19129f804369794c72ed3 by Serhiy Storchaka in branch '3.7':
[3.7] bpo-36492: Fix passing special keyword arguments to some functions. (GH-12637) (GH-12645)
https://github.com/python/cpython/commit/a37f356de19828241bf19129f804369794c72ed3
msg339284 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-04-01 08:00
Fixes (but not deprecations) were backported to 3.7.
History
Date User Action Args
2019-04-01 08:00:55serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg339284

stage: patch review -> resolved
2019-04-01 07:59:29serhiy.storchakasetmessages: + msg339283
2019-04-01 07:20:36serhiy.storchakasetpull_requests: + pull_request12577
2019-04-01 06:16:49serhiy.storchakasetmessages: + msg339280
2019-03-31 07:36:06serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request12569
2019-03-31 07:34:13xtreaksetnosy: + xtreak
2019-03-31 07:17:26serhiy.storchakacreate