[Python-Dev] Re: Using the Python C API in C++

2022-04-27 Thread h . vetinari
> In terms of C++ version, it was proposed to target C++11. GCC 5 has full C++14 support (one library functionality missing), and so does VS2015 onwards as well as Clang 3.4, see https://en.cppreference.com/w/cpp/compiler_support I doubt that any older compilers are in use _anywhere_ in reasonab

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Barry Scott
> On 27 Apr 2022, at 20:21, Miro Hrončok wrote: > > On 27. 04. 22 20:45, Barry wrote: >>> On 27 Apr 2022, at 17:22, Victor Stinner wrote: >>> >>> Ok, you changed my mind and I added PYTHONDONTADDPATH0=1 env var. Example: >> Maybe the env var say what it is not adding rather then where it adds

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Miro Hrončok
On 27. 04. 22 21:34, Steve Holden wrote: So would PYTHONDONTADDSCRIPTDIR=1 be a better choice? No because for other invocations, it prevents PWD being added, not the scriptdir. Both names are bad becasue they only describe half of what's it doing (or maybe the option should not do both, if it

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Miro Hrončok
On 27. 04. 22 20:45, Barry wrote: On 27 Apr 2022, at 17:22, Victor Stinner wrote: Ok, you changed my mind and I added PYTHONDONTADDPATH0=1 env var. Example: Maybe the env var say what it is not adding rather then where it adds it. PYTHONDONTADDPWD=1 But it is not "just" the PWD. In the c

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Barry
> On 27 Apr 2022, at 17:22, Victor Stinner wrote: > > Ok, you changed my mind and I added PYTHONDONTADDPATH0=1 env var. Example: Maybe the env var say what it is not adding rather then where it adds it. PYTHONDONTADDPWD=1 Barry ___ Python-Dev maili

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Paul Moore
On Wed, 27 Apr 2022 at 16:50, Victor Stinner wrote: > > Since I didn't get any serious review on my pull request since > February, I created this thread on python-dev to get more people > looking into this issue. Pull requests don't get much visibility from the wider community - I know I can't ke

[Python-Dev] Using the Python C API in C++

2022-04-27 Thread Victor Stinner
Hi, If you got issues with using the Python C API in C++, please speak up! I'm looking for feedback :-) Extending Python by writing C++ code is now easy with the pybind11 project: https://pybind11.readthedocs.io/ It seems like over the last years, building C++ extensions with the Python C API s

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Victor Stinner
On Wed, Apr 27, 2022 at 5:56 PM Antoine Pitrou wrote: > An environment variable is an easy to influence a program or system > whose inner workings you don't control (for example a system that > spawns child Python processes). And it sounds like a good idea to allow > that given that it improves se

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Victor Stinner
The use case for -P still uses environment variables like PYTHONWARNINGS or PYTHONUTF8. That's why -I (isolated) cannot be used. If there is an use case for a ._pth file importing the site module, maybe a different option can be added, no? Adding -P doesn't prevent that. But it seems like use case

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Victor Stinner
Since I didn't get any serious review on my pull request since February, I created this thread on python-dev to get more people looking into this issue. On Wed, Apr 27, 2022 at 5:30 PM Paul Moore wrote: > > On Wed, 27 Apr 2022 at 15:32, Victor Stinner wrote: > > > > On Tue, Apr 26, 2022 at 11:46

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Antoine Pitrou
On Wed, 27 Apr 2022 17:37:20 +0200 Victor Stinner wrote: > Oh sorry, I mean that I prefer to *not* add an environment variable, > but I'm not strongly against it. > > How would the environment varaible be used? A command line option is not > enough? An environment variable is an easy to influen

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Victor Stinner
Oh sorry, I mean that I prefer to *not* add an environment variable, but I'm not strongly against it. How would the environment varaible be used? A command line option is not enough? Victor On Wed, Apr 27, 2022 at 4:44 PM Antoine Pitrou wrote: > > On Tue, 26 Apr 2022 11:46:41 +0200 > Victor Sti

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Paul Moore
On Wed, 27 Apr 2022 at 15:32, Victor Stinner wrote: > > On Tue, Apr 26, 2022 at 11:46 AM Victor Stinner wrote: > > I propose adding a -P option to Python command line interface to "not > > add sys.path[0]": > > https://github.com/python/cpython/pull/31542 > > My plan is to merge this change at 20

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Antoine Pitrou
On Tue, 26 Apr 2022 11:46:41 +0200 Victor Stinner wrote: > I prefer to add an environment variable, only pass the option > explicitly on the command line. I don't really understand this sentence, can you rephrase? ___ Python-Dev mailing list -- pytho

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Victor Stinner
On Tue, Apr 26, 2022 at 11:46 AM Victor Stinner wrote: > I propose adding a -P option to Python command line interface to "not > add sys.path[0]": > https://github.com/python/cpython/pull/31542 My plan is to merge this change at 2022-05-05, the day before the Python 3.11 feature freeze, unless so

[Python-Dev] Re: Add -P command line option to not add sys.path[0]

2022-04-27 Thread Victor Stinner
On Tue, Apr 26, 2022 at 8:37 PM Steve Dower wrote: > The biggest issue I see is that the obvious command line options for > "import site" are already used to imply "do not import site". But then, > -P isn't obvious either. Maybe an -X option would suffice? I propose the short option "-P" rather t

[Python-Dev] PEP 689 – Semi-stable C API tier

2022-04-27 Thread Petr Viktorin
Hello, Victor and others are organizing the C-API to make it clearer what's public and what's private (see Victor's file-based stats: https://pythoncapi.readthedocs.io/stats.html) It became clear that we need a tier between public and private C-API. PEP 689 proposes such API, with an opt-in m