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

Re: [PATCH] git-p4: use raw string literals for regular expressions

From
James Touton <bekenn@gmail.com>
Date
Jan 20, 2024, 19:34 UTC
Message-ID
<CAA3pzWRRrwLN16RsNEJjdQg7vnSM_p_MtLqCU2ZXg5L=WPc-RA@mail.gmail.com>
In-Reply-To
<xmqqr0ibetap.fsf@gitster.g>
On Sat, Jan 20, 2024 at 10:47 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 45 quoted lines
>
> "James Touton via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: James Touton <bekenn@gmail.com>
> >
> > Fixes several Python diagnostics about invalid escape sequences.
>
> Thanks for noticing, but we want a bit more backstory explained here
> in the proposed commit log message, outlining:
>
> 1. With what version of Python the deprecation warning started.
>
> This will help us judge the urgency of the fix.  If I am reading the
> docs.python.org/$version/howto/regex.html right, we do not see this
>
>     In addition, special escape sequences that are valid in regular
>     expressions, but not valid as Python string literals, now result
>     in a DeprecationWarning and will eventually become a
>     SyntaxError, which means the sequences will be invalid if raw
>     string notation or escaping the backslashes isn’t used.
>
> in Python 3.5's document, but Python 3.6's document starts talking
> about the warning.  Python 3.6 was released at the end of 2016 so it
> is 7 years old---users have lived with the warning for this many
> years, so if the above reasoning is correct, this is not all that
> urgent to require a maintenance release.
>
> 2. How well the new construct, used by the code after applying this
>    patch, is supported by older version of Python.
>
> This will assure us that the change will not be robbing from users
> of older versions of Python to pay users of newer versions of
> Python.  Again, if I am reading the documentation right, feeding r''
> raw strings to regexp engine was supported even by Python 2.7, which
> is what git-p4.py already requires, so we should be OK.
>
> But we want the developers who propose a change to explain why it is
> a good idea, and why it is a safe change to make, in their proposed
> commit log message, instead of forcing the reviewers to do that for
> them.
>
> For other syntactic and linguistic hints on writing a proposed log
> message, please check Documentation/SubmittingPatches document.
>
> Thanks, again.
Thanks for the notes, I will update this when I have the opportunity.

Raw strings were already present in the file, just not in these particular locations. Given that, I wouldn't expect them to need any particular explanation; do you still want some mention of compatibility constraints, or is it enough to mention that they're already in use?

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “git-p4: use raw string literals for regular expressions”
  1. git-p4: use raw string literals for regular expressionsJames Touton via GitGitGadget, Jan 20, 2024
  2. Junio C HamanoJan 20, 2024
  3. James ToutonJan 20, 2024
  4. Junio C HamanoJan 20, 2024
  5. git-p4: use raw string literals for regular expressionsJames Touton via GitGitGadget, Jan 26, 2024
  6. Junio C HamanoJan 29, 2024

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.