Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests checking recount on immortal objects #20

Closed
wants to merge 2 commits into from

Conversation

ajakubek
Copy link
Owner

Starting with Python 3.12 singleton objects like None are considered to be immortal. Their reference count is always set to a high value (currently -1U).

In effect, some of the loops in unit tests which verified refcounts of the None object attempted to run for ~4.3B iterations.

The test caes have been rewritten to validate reference counts with a constant number of iterations.

Starting with Python 3.12 singleton objects like `None` are considered
to be immortal. Their reference count is always set to a high value
(currently -1U).

In effect, some of the unit tests which verify ref counting of the None
object attempted to execute loops with ~43B iterations.

The test cases have been rewritten to validate the reference count with
a constant number of iterations.
The new implementation requires that `gc.collect` releases all reachable
references. This appears to be the case in all tested CPython versions.

Closes #18.
@ajakubek ajakubek closed this Aug 30, 2024
@ajakubek ajakubek deleted the test_loop_fixes branch August 30, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant