Skip to content

typing._Immutable is not used anymore #105430

Closed

Description

@sobolevn

class _Immutable

cpython/Lib/typing.py

Lines 422 to 431 in 27c68a6

class _Immutable:
"""Mixin to indicate that object should not be copied."""
__slots__ = ()
def __copy__(self):
return self
def __deepcopy__(self, memo):
return self
after https://github.com/python/cpython/pull/103764/files#diff-ddb987fca5f5df0c9a2f5521ed687919d70bb3d64eaeb8021f98833a2a716887L969 is not used.

» ag _Immutable
Lib/typing.py
419:class _Immutable:
                  

Shall I remove it? I think that we don't provide any promises about typing.py internals.

Linked PRs

Activity

  1. AlexWaygood commented on Jun 7, 2023

    @AlexWaygood
    Member

    Shall I remove it?

    Sounds good to me! This is undocumented, untested, not included in __all__, and has a name starting with a leading underscore. I don't think we can be any more explicit about the fact that it was an internal implementation detail 😆

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Jun 7, 2023
  3. self-assigned this
    on Jun 7, 2023
  4. hugovk commented on Jun 7, 2023

    @hugovk
    Member

    Nothing to worry about in the top 5k PyPI packages:

    ❯ python3 ~/github/misc/cpython/search_pypi_top.py -q . "\b_Immutable\b"
    ./pip-23.0.1.tar.gz: pip-23.0.1/src/pip/_vendor/typing_extensions.py: class _Immutable:
    ./pip-23.0.1.tar.gz: pip-23.0.1/src/pip/_vendor/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./pip-23.0.1.tar.gz: pip-23.0.1/src/pip/_vendor/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./setuptools-67.6.1.tar.gz: setuptools-67.6.1/pkg_resources/_vendor/typing_extensions.py: class _Immutable:
    ./setuptools-67.6.1.tar.gz: setuptools-67.6.1/pkg_resources/_vendor/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./setuptools-67.6.1.tar.gz: setuptools-67.6.1/pkg_resources/_vendor/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./setuptools-67.6.1.tar.gz: setuptools-67.6.1/setuptools/_vendor/typing_extensions.py: class _Immutable:
    ./setuptools-67.6.1.tar.gz: setuptools-67.6.1/setuptools/_vendor/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./setuptools-67.6.1.tar.gz: setuptools-67.6.1/setuptools/_vendor/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./poetry_core-1.5.2.tar.gz: poetry_core-1.5.2/src/poetry/core/_vendor/typing_extensions.py: class _Immutable:
    ./poetry_core-1.5.2.tar.gz: poetry_core-1.5.2/src/poetry/core/_vendor/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./poetry_core-1.5.2.tar.gz: poetry_core-1.5.2/src/poetry/core/_vendor/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./metaflow-2.8.2.tar.gz: metaflow-2.8.2/metaflow/_vendor/v3_6/typing_extensions.py: class _Immutable:
    ./metaflow-2.8.2.tar.gz: metaflow-2.8.2/metaflow/_vendor/v3_6/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./metaflow-2.8.2.tar.gz: metaflow-2.8.2/metaflow/_vendor/v3_6/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./pipenv-2023.3.20.tar.gz: pipenv-2023.3.20/pipenv/patched/pip/_vendor/typing_extensions.py: class _Immutable:
    ./pipenv-2023.3.20.tar.gz: pipenv-2023.3.20/pipenv/patched/pip/_vendor/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./pipenv-2023.3.20.tar.gz: pipenv-2023.3.20/pipenv/patched/pip/_vendor/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./pyLDAvis-3.4.0.tar.gz: pyLDAvis-3.4.0/pyLDAvis/lib/python3.11/site-packages/pip/_vendor/typing_extensions.py: class _Immutable:
    ./pyLDAvis-3.4.0.tar.gz: pyLDAvis-3.4.0/pyLDAvis/lib/python3.11/site-packages/pip/_vendor/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./pyLDAvis-3.4.0.tar.gz: pyLDAvis-3.4.0/pyLDAvis/lib/python3.11/site-packages/pip/_vendor/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./pyLDAvis-3.4.0.tar.gz: pyLDAvis-3.4.0/pyLDAvis/lib/python3.11/site-packages/setuptools/_vendor/typing_extensions.py: class _Immutable:
    ./pyLDAvis-3.4.0.tar.gz: pyLDAvis-3.4.0/pyLDAvis/lib/python3.11/site-packages/setuptools/_vendor/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./pyLDAvis-3.4.0.tar.gz: pyLDAvis-3.4.0/pyLDAvis/lib/python3.11/site-packages/setuptools/_vendor/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    ./dnspython-2.3.0.tar.gz: dnspython-2.3.0/dns/_immutable_ctx.py: class _Immutable:
    ./dnspython-2.3.0.tar.gz: dnspython-2.3.0/dns/_immutable_ctx.py: if _Immutable in cls.__mro__:
    ./dnspython-2.3.0.tar.gz: dnspython-2.3.0/dns/_immutable_ctx.py: class ncls(_Immutable, cls):
    ./pytablewriter-0.64.2.tar.gz: pytablewriter-0.64.2/pytablewriter/_typing.py: class _Immutable:
    ./pytablewriter-0.64.2.tar.gz: pytablewriter-0.64.2/pytablewriter/_typing.py: class ParamSpecArgs(_Immutable):
    ./pytablewriter-0.64.2.tar.gz: pytablewriter-0.64.2/pytablewriter/_typing.py: class ParamSpecKwargs(_Immutable):
    ./typing_extensions-4.5.0.tar.gz: typing_extensions-4.5.0/src/typing_extensions.py: class _Immutable:
    ./typing_extensions-4.5.0.tar.gz: typing_extensions-4.5.0/src/typing_extensions.py: class ParamSpecArgs(_Immutable):
    ./typing_extensions-4.5.0.tar.gz: typing_extensions-4.5.0/src/typing_extensions.py: class ParamSpecKwargs(_Immutable):
    
    Time: 0:00:23.512065
    Found 33 matching lines in 9 projects
  5. added a commit that references this issue on Jun 7, 2023
  6. added a commit that references this issue on Jun 7, 2023
  7. added a commit that references this issue on Jun 7, 2023
  8. added a commit that references this issue on Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions