-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
uuid.py
has several protected deprecated functions which are no longer in use:
Lines 591 to 594 in 4afa7be
def _load_system_functions(): | |
"""[DEPRECATED] Platform-specific functions loaded at import time""" | |
Lines 567 to 575 in 4afa7be
def _ipconfig_getnode(): | |
"""[DEPRECATED] Get the hardware address on Windows.""" | |
# bpo-40501: UuidCreateSequential() is now the only supported approach | |
return _windll_getnode() | |
def _netbios_getnode(): | |
"""[DEPRECATED] Get the hardware address on Windows.""" | |
# bpo-40501: UuidCreateSequential() is now the only supported approach | |
return _windll_getnode() |
And one unused module-level var:
Line 583 in 4afa7be
_has_uuid_generate_time_safe = _uuid.has_uuid_generate_time_safe |
The problem is that they were not deprecated with a warning. Only with docs.
But, right now they are deprecated since 2020.
This has a big history:
- Fix uuid.uuid1() core logic of uuid.getnode() needs refresh #72196
- Deprecate and remove ctypes usage in uuid #84681 and bpo-40501: Replace ctypes code in uuid with native module #19948
- bpo-11063, bpo-20519: avoid ctypes and improve import time for uuid #3796
Some projects in the wild use _load_system_functions
, despite the fact it is deprecated and was never documented and always was protected.
Examples:
- https://github.com/spulec/freezegun/blob/5e06dff53244992204706adf6907e7138ac96d39/freezegun/api.py#L71
- https://github.com/pganssle/time-machine/blob/ccc59927b4c51e35895c34578cba7aca69f28055/src/time_machine/__init__.py#L211
- https://github.com/adamchainz/time-machine/blob/39e327e18d52ebc76d3973b465ff42e139fd651d/src/time_machine/__init__.py#L223
So, what should we do?
- Add a proper warning, schedule it for removal in two versions
- Just remove them
I think that 1.
is safer.
I would like to work on it after the decision is made.
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtype-featureA feature request or enhancementA feature request or enhancement