git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/3] Cast byte strings to unicode strings in python3

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 16, 2019, 03:52 UTC
Message-ID
<xmqqimnk4gwb.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<xmqqeey85yt6.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
>>          cmd += [ key ]
>>          s = read_pipe(cmd, ignore_error=True)
>>          _gitConfig[key] = s.strip()
>> -    return _gitConfig[key]
>> +    return ustring(_gitConfig[key])
>
> Likewise.  I'd expect, if we were to declare that our internal
> strings are all unicode in Python 3, we'd be using a thin wrapper of
> read_pipe() that yields a unicode string, so 's' would not be a
> bytestring, and s.strip() would not be either.

Oops, I did not even realize read_pipe() is already our own. So there is no need to any wrapper around it, if we were to declare that all strings we use are unicode under Python 3---we just need to have the ustring() call (after giviing the helper a better name) directly inside read_pipe() function.

Previous: Junio C HamanoNext: Ben Keene via GitGitGadget
Message 11 of 17 in “Feature: New Variable git-p4.binary”
  1. 0/2 Feature: New Variable git-p4.binaryBen Keene via GitGitGadget, Nov 13, 2019
  2. 2/2 Added general variable git-p4.binary and added a default for windows of 'P4.EXE'Ben Keene via GitGitGadget, Nov 13, 2019
  3. 1/2 Cast byte strings to unicode strings in python3Ben Keene via GitGitGadget, Nov 13, 2019
  4. Junio C HamanoNov 14, 2019
  5. Luke DiamandNov 14, 2019
  6. Ben KeeneNov 14, 2019
  7. Luke DiamandNov 15, 2019
  8. 0/3 Feature: New Variable git-p4.p4programBen Keene via GitGitGadget, Nov 15, 2019
  9. 1/3 Cast byte strings to unicode strings in python3Ben Keene via GitGitGadget, Nov 15, 2019
  10. Junio C HamanoNov 16, 2019
  11. Junio C HamanoNov 16, 2019
  12. 3/3 Changed the name of the parameter from git-p4.binary to git-p4.p4programBen Keene via GitGitGadget, Nov 15, 2019
  13. 2/3 Added general variable git-p4.binary and added a default for windows of 'P4.EXE'Ben Keene via GitGitGadget, Nov 15, 2019
  14. Junio C HamanoNov 16, 2019
  15. Junio C HamanoNov 16, 2019
  16. Junio C HamanoNov 18, 2019
  17. Ben KeeneDec 3, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.