sqlalchemy / sqlalchemy/dogpile.cache

unicode support in function_key_generator on Python2

Open
#94 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug easy
Dominant language
Python
Stars
299
Forks
50
PR merge metrics
No merged PRs in 30d

Description

Migrated issue, originally created by Wolfgang Schnerring (wosc)

function_key_generator defines to_str=compat.string_type by default, which is str on Python2 (so breaks when the function gets non-ascii arguments).

The tests don't catch this, because they explicitly pass to_str=compat.text_type, which does the right thing.

Are the backwards-compatibility concerns, or could the default be changed to text_type, which would certainly be less... surprising, out-of-the-box.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate function_key_generator and the tests that currently pass to_str=compat.text_type. First inspect how compat.string_type and compat.text_type differ on Python 2, then reproduce the non-ASCII argument case using the default. Done means the default behavior is verified by a regression test while the stated backwards-compatibility concern is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.