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

include code object id into extractors cache key #677

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elmjag
Copy link

@elmjag elmjag commented Jan 29, 2023

When caching function's extractors use more stable key into the extractors_cache.

The id() of function object is not nessesary unique, as CPython may re-use same memory in case function object is un-referenced. This situation happens when Database objects are dynamically created and destored in the same process.

If a new different function object function is instantiated at the old address, we'll get wrong entry from extractors_cache.

The function's code object id() is more stable. By including code object id() into the cache key this issue is solved.

Solves: #675

When caching function's extractors use more stable key into the extractors_cache.

The id() of function object is not nessesary unique, as CPython may re-use
same memory in case function object is un-referenced. This situation happens
when Database objects are dynamically created and destored in the same process.

If a new different function object function is instantiated at the old address,
we'll get wrong entry from extractors_cache.

The function's _code object_ id() is more stable. By including code object id() into
the cache key this issue is solved.

Solves: ponyorm#675
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