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

Re: [PATCH] git-p4: remove obsolete version check

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 4, 2017, 18:45 UTC
Message-ID
<20170604184533.ztsmvbinfytrhl4x@genre.crustytoothpaste.net>
In-Reply-To
<CACBZZX7Sz6VPLQgzyQ1Dk+-899y0NzqMjVYL5ry0n-0axmR35w@mail.gmail.com>
On Sat, Jun 03, 2017 at 06:55:22PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 16 quoted lines
> On Sat, Jun 3, 2017 at 3:31 PM, Jakub Wilk <jwilk@jwilk.net> wrote:
> > The file is syntactically correct only in Python >= 2.6, so the
> > version check never does anything.
> 
> [CC-ing Eric who added that check]
> 
> Your commit message doesn't give an example of this, but with e.g.
> python 2.0 you get:
> 
>       File "git-p4.py", line 469
>         yield pattern
>                 ^
>     SyntaxError: invalid syntax
> 
> I checked the various other python files that had similar warnings,
> they all work correctly with python 2.0.

The yield syntax was in Python 2.3, so this isn't indicative of the problem. You'd actually need to test with 2.5 itself in order to know what that version complains about.

Show 6 quoted lines
> One workaround to keep this would be to make git-p4.py import some
> library to do all its work, and use some subset of python syntax to
> just load and defer to that library. That works for me when I change
> it like that locally. Alternatively, does Python have something like
> Perl's BEGIN {} blocks where you can execute code right there before
> the file has finished parsing?
TTBOMK, Python doesn't have such functionality.
> Or we could just remove this, just wanted to note the above since I
> dug into it, and the commit message light on details.

As a note, Python 2.6 has been around since at least 2009, so I think it's fine to drop support for earlier versions at this point. But I agree an explanation in the commit message of what exactly makes it syntactically invalid would be beneficial.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
Previous: Ævar Arnfjörð Bjarmason
Message 3 of 3 in “git-p4: remove obsolete version check”
  1. git-p4: remove obsolete version checkJakub Wilk, Jun 3, 2017
  2. Ævar Arnfjörð BjarmasonJun 3, 2017
  3. brian m. carlsonJun 4, 2017

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.