libgit2 / libgit2/pygit2

Signature email requires ASCII on Python 2 but requires Unicode only "str" on Python 3

Open
#932 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

Signature_init in signature.c currently uses the s format string for parsing the email argument. This is inconsistent between Python 2 and 3. On Python 2, it accepts either text (unicode) or bytes (str) and implicitly encodes text using the default system encoding, which is ascii by default (and it seems like changing it is kind of weird and not really recommended by most people). Python 3, it only accepts text (str), and it's implicitly encodes it using UTF-8.

The name argument for Signature_init just uses O and accepts either text or bytes. It appears to implicitly encode text using UTF-8 and leaves bytes as-is. I would expect the email argument to work the same way.

So there's currently no way to pass in bytes on Python 3 and no way to pass in non-ASCII text on Python 2.

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

Start in signature.c at Signature_init and inspect how the email argument is parsed compared with the name argument. Verify behavior on Python 2 and Python 3; done means email accepts bytes on Python 3 and non-ASCII text on Python 2 consistently with name.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.