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 namedtuple cache #928

merged 2 commits into from Jun 7, 2019


None yet
2 participants
Copy link

commented Jun 4, 2019

I've finally gotten around to testing @dvarrazzo's solution to #838. Unfortunately it doesn't fully work.

The problem is that the lru_cache function was used to wrap a non-static method, so it receives self as first argument instead of only receiving key as intended, and since self (the cursor) isn't always the same object, the cache misses.

The fix is a little akward because the lru_cache decorator doesn't play well with classmethod and staticmethod (it took me a while to find a way that works).


This comment has been minimized.

Copy link

commented Jun 4, 2019

Thank you for playing with it even if don't agree with this approach: I really appreciate it.

I'll look into this correction and merge it. In the need to make a release, so it should be available in a few days

@dvarrazzo dvarrazzo merged commit 842e383 into psycopg:master Jun 7, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

dvarrazzo added a commit that referenced this pull request Jun 7, 2019

@Changaco Changaco deleted the Changaco:fix-namedtuple-cache branch Jun 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.