Skip to content

Add platform.invalidate_caches for invalidating cached results #122549

Description

@picnixz

Feature or enhancement

Proposal:

In #122525, it was observed that many functions of the platform module use cached results. This is, in practice, preferrable, but it should also be possible, if needed, to invalidate cached results. One use case is when the host name changes (i.e., one of the uname() components change).

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    type-featureA feature request or enhancement
    stdlibStandard Library Python modules in the Lib/ directory
    on Aug 1, 2024
  2. changed the title [-]Add `platform.invalidate_caches` for invalidating cached results (follow-up of #122525)[/-] [+]Add `platform.invalidate_caches` for invalidating cached results[/+] on Aug 1, 2024
  3. kashav commented on Aug 1, 2024

    @kashav

    One use case is when the host name changes (i.e., one of the uname() components change).

    Mostly out of curiosity - is there any way to watch for host name change?

  4. picnixz commented on Aug 1, 2024

    @picnixz
    MemberAuthor

    Well.. you could have a task that runs every second and checks whether the host name changed or not. socket.gethostname gives you the runtime one, so you'll need to query it every second.

  5. added a commit that references this issue on Nov 15, 2024
  6. picnixz commented on Nov 15, 2024

    @picnixz
    MemberAuthor

    Completed in 612ac28.

  7. added a commit that references this issue on Dec 8, 2024
  8. added a commit that references this issue on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions