classification
Title: uuid.getnode() has unused argument
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: hauntsaninja, serhiy.storchaka, srittau, taleinat
Priority: normal Keywords: patch

Created on 2020-02-05 12:02 by srittau, last changed 2020-02-05 20:45 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18369 merged hauntsaninja, 2020-02-05 18:26
Messages (7)
msg361423 - (view) Author: Sebastian Rittau (srittau) * Date: 2020-02-05 12:02
uuid.getnode() has an undocumented, keyword-only "getters" argument that gets discarded immediately. This is confusing when using code inspection tools and can give the wrong impression that you can somehow override the node getters when you can't. I recommend removing this argument.
msg361424 - (view) Author: Sebastian Rittau (srittau) * Date: 2020-02-05 12:05
Shantanu points out in https://github.com/python/typeshed/pull/3715 that the argument was made useless due to bpo-28009.
msg361447 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2020-02-05 18:31
Simply removing the argument would be backwards-incompatible.

Unless someone can show via a code search that this is never used in practice, we may want to consider deprecating this argument before removing it.
msg361448 - (view) Author: Shantanu (hauntsaninja) * Date: 2020-02-05 19:07
Github code search isn't great, but I was unable to find any usage of `uuid.getnode(getters=`, whereas I was able to find usage of `uuid.uuid1(node=` (even though `node` is optional and can be passed positionally). I'd be surprised if it was used in practice, given that it's undocumented and only present on 3.7+ (I discovered it while running `inspect.signature` on large parts of stdlib). I think that, and the fact that this never did anything (even before bpo-28009 it looks like `getters` gets immediately overwritten), mitigate the risk here.

Let me know what you think should be done; happy to submit a PR that issues a deprecation warning.
msg361449 - (view) Author: Sebastian Rittau (srittau) * Date: 2020-02-05 20:00
Code using this argument is in all likelihood already subtly broken, because it depends on non-existing functionality. I believe that a "hard" break would be better (for Python 3.9).
msg361452 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-05 20:43
New changeset 8b6f6526f857bb7523b0fcff09b45bc6471289e9 by Shantanu in branch 'master':
bpo-39559: Remove unused, undocumented argument from uuid.getnode (GH-18369)
https://github.com/python/cpython/commit/8b6f6526f857bb7523b0fcff09b45bc6471289e9
msg361453 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-05 20:45
I agree. It was added in issue32502, but was never documented and used.

Thank you Sebastian and Shantanu.
History
Date User Action Args
2020-02-05 20:45:34serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg361453

stage: patch review -> resolved
2020-02-05 20:43:18serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg361452
2020-02-05 20:00:11srittausetmessages: + msg361449
2020-02-05 19:07:35hauntsaninjasetnosy: + hauntsaninja
messages: + msg361448
2020-02-05 18:31:43taleinatsetnosy: + taleinat

messages: + msg361447
versions: + Python 3.9, - Python 3.6, Python 3.7
2020-02-05 18:26:40hauntsaninjasetkeywords: + patch
stage: patch review
pull_requests: + pull_request17743
2020-02-05 12:05:35srittausetmessages: + msg361424
2020-02-05 12:02:55srittaucreate