Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add an API for determining if an object is immortal #128509

Closed
Labels
extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement
@ZeroIntensity

Description

@ZeroIntensity

Feature or enhancement

Proposal:

Immortal objects might lead to some unexpected results for users that are (unfortunately) messing with reference count details, as seen in#127191; but currently, there's no way to determine what objects are actually immortal.

Immortality is an implementation detail, but it still does affect reference counting, and given that it's not very safe to rely on very specific reference counts, we don't want the only way to check for immortality to be viasys.getrefcount. So, given that we already havesys._is_interned, it seems fitting to add asys._is_immortal alongside it.

If we go with this, I think it's also a good idea to note it in some of the documentation. For example,sys.getrefcount says this:

some objects areimmortal and have a very high refcount that does not reflect the actual number of references.

Here, it might be a good idea to mention my proposedsys._is_immortal, so there's less ambiguity about the returned value.

cc@erlend-aasland

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp