[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Guido van Rossum
On Wed, Feb 24, 2021 at 1:38 AM Irit Katriel wrote: > > > On Wed, Feb 24, 2021 at 4:39 AM Guido van Rossum wrote: > >> >> OTOH we might reconsider deriving ExceptionGroup from BaseException -- >> maybe it's better to inherit from Exception? I don't think the PEP >> currently has a clear reason

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Guido van Rossum
On Wed, Feb 24, 2021 at 7:09 PM Emily Bowman wrote: > After reading through the PEP and skimming the code (but I didn't build > it), something I didn't see: What happens to a currently conforming except > check? > > try: > async with trio.open_nursery() as nursery: > # Make two

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Guido van Rossum
On Wed, Feb 24, 2021 at 5:58 PM Jim J. Jewett wrote: > If it (compatible __new__ and __init__) needs to be checked at definition > time, just try create an instance passing the same arguments you would pass > to the base class. If the creation it doesn't raise an exception, that is > good

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Guido van Rossum
On Wed, Feb 24, 2021 at 5:51 PM Jim J. Jewett wrote: > Are you saying that > > except *ValueError as e: > > will catch > > ValueError > and > ExceptionGroup(ValueError) > but miss > ExceptionGroup(ExceptionGroup(ValueError)) > ? > No, it will catch it regardless of how many

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Guido van Rossum
[Subthread: handling individual errors] > Rather than iterator, I think we should add a visitor that calls a function for each leaf exception, I agree that we shouldn't add an `__iter__` method. But what if we added a separate method that returns an iterator? Then you could write ``` for e in

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Peter Wang
On Wed, Feb 24, 2021 at 8:50 PM Mike Miller wrote: > I never understood the fear around version conflicts. With binary extension modules, version conflicts lead to (at best) runtime segfault and (at worst) subtle *data* bugs that return incorrect results. There are also deeper concerns around

[Python-Dev] Re: Moving threadstate to thread-local storage.

2021-02-24 Thread 谢俊逸 via Python-Dev
On MacOS & iOS, __thread variable is 35% faster than using pthread_getspecific. getSpecific cost: 0.000649 getTLS cost: 0.000423 - (void)test { double t1 = CFAbsoluteTimeGetCurrent(); for (int i = 0; i < 10; i++) { [self getSpecific]; } double t2 =

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Emily Bowman
After reading through the PEP and skimming the code (but I didn't build it), something I didn't see: What happens to a currently conforming except check? try: async with trio.open_nursery() as nursery: # Make two concurrent calls to child() nursery.start_soon(child)

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Mike Miller
On 2021-02-24 02:52, Stéfane Fermigier wrote: I have currently 57 apps installed via pipx on my laptop, and the 57 environments take almost 1 GB already. I never understood the fear around version conflicts. Perhaps it has to do with the decline of sys-admin skills over the years? So, the

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Jim J. Jewett
Ideally, (at least) trivial subclasses could be declared, and the class itself would serve as the marker. I would prefer regular subclasses, so that they could offer methods as well. Alternatively, at least copy the instance __dict__ to the new ExceptionGroup instance. By compatible __init__

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Jim J. Jewett
If it (compatible __new__ and __init__) needs to be checked at definition time, just try create an instance passing the same arguments you would pass to the base class. If the creation it doesn't raise an exception, that is good enough. This isn't about theoretical type safety against malice;

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Jim J. Jewett
Are you saying that except *ValueError as e: will catch ValueError and ExceptionGroup(ValueError) but miss ExceptionGroup(ExceptionGroup(ValueError)) ? ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Jim J. Jewett
By the time a KeyboardInterrupt or SystemExit is being grouped into an ExceptionGroup, it already isn't being treated as an immediate interruption ... it has (presumably) already killed its own execution path, but it should not kill the program as a whole. Whether ExceptionGroup inherits from

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Wes Turner
Would it be better to have an (os, os_release, arch) to [site_packages_dirs] map within CPython or are the patches too varied to be replaced by a centralized map and a runtime conditional? For development convenience, having writeable site-packages dirs before unwriteable site-packages is easy;

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Guido van Rossum
Hi Ethan, See Irit's response to my about why ExceptionGroup doesn't subclass Exception -- I think this is still a little bit of an open issue. Another response (which I also read somewhere in one of Irit's messages) is that a library API shouldn't go from raising subclasses of Exception only to

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Guido van Rossum
Hi Jim, Let me echo Irit's response here -- what's your use case for subclassing ExceptionGroup? Requiring that subclasses have a compatible __init__ or __new__ sounds like a bug magnet, since this can't be checked when the subclass is being defined, and it goes against conventional rules for

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Irit Katriel via Python-Dev
Hi Jim, On Wed, Feb 24, 2021 at 2:16 PM Jim J. Jewett wrote: > Petr: What about except *(TypeError, ExceptionGroup):? > > Irit: Good question. We should block that as well. > > But https://www.python.org/dev/peps/pep-0654/#backwards-compatibility > seems to explicitly recommend the very

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Christian Heimes
On 24/02/2021 20.03, Christian Heimes wrote: > On 24/02/2021 19.17, Steve Dower wrote: >> On 2/24/2021 4:26 PM, Christian Heimes wrote: >>> On 24/02/2021 15.16, Random832 wrote: On Wed, Feb 24, 2021, at 06:27, Christian Heimes wrote: > Separate directories don't prevent clashes and system

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Christian Heimes
On 24/02/2021 19.17, Steve Dower wrote: > On 2/24/2021 4:26 PM, Christian Heimes wrote: >> On 24/02/2021 15.16, Random832 wrote: >>> On Wed, Feb 24, 2021, at 06:27, Christian Heimes wrote: Separate directories don't prevent clashes and system breakage. But they provide an easy way

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Paul Moore
On Wed, 24 Feb 2021 at 18:25, Steve Dower wrote: > I mean, this is _precisely_ what PEP 370 defines (including the "-s" > option and PYTHONNOUSERSITE env variable to provide that one-way isolation). > > Is the problem that pip doesn't use it by default? Note that these days, pip *does* use

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Steve Dower
On 2/24/2021 4:26 PM, Christian Heimes wrote: On 24/02/2021 15.16, Random832 wrote: On Wed, Feb 24, 2021, at 06:27, Christian Heimes wrote: Separate directories don't prevent clashes and system breakage. But they provide an easy way to *recover* from a broken system. I think it could be

[Python-Dev] Python Language Summit 2021 Signups Are Now Open

2021-02-24 Thread Łukasz Langa
I’m happy to announce that we’ve opened the sign-up forms for the 2021 Python Language Summit! TL;DR When: Tuesday, May 11, 2021 (4 hours) and Wednesday, May 12, 2021 (4 hours). Exact times TBD depending on attendee timezones. Where: Online via Zoom (link will be sent via email to attendees)

[Python-Dev] Re: Move support of legacy platforms/architectures outside Python

2021-02-24 Thread John Paul Adrian Glaubitz
Hello! On 2/22/21 12:30 PM, Victor Stinner wrote: >> The thing is you made assumptions about how downstream distributions use >> Python without doing some research first ("16-bit m68k-linux"). > > I'm talking about 16-bit memory alignment which causes SIGBUS if it's > not respected on m68k. For

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Irit Katriel via Python-Dev
On Wed, Feb 24, 2021 at 4:39 AM Guido van Rossum wrote: > > OTOH we might reconsider deriving ExceptionGroup from BaseException -- > maybe it's better to inherit from Exception? I don't think the PEP > currently has a clear reason why it must derive from BaseException. I > believe it has to do

[Python-Dev] Re: [Python-ideas] Re: Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Stéfane Fermigier
On Wed, Feb 24, 2021 at 12:42 PM Paul Moore wrote: > On Wed, 24 Feb 2021 at 10:55, Stéfane Fermigier wrote: > > There is probably a clever way to reuse common packages (probably via > clever symlinking) and reduce the footprint of these installations. > > Ultimately the problem is that a

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Stéfane Fermigier
On Wed, Feb 24, 2021 at 11:43 AM Henk-Jaap Wagenaar < wagenaarhenkj...@gmail.com> wrote: > >> > I've been using pyenv (on MacBooks to be fair, not Linux/Debian) and been > quite happy with that, and it basically does what Jonathan does manually: > clone the github repo and build python from

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Irit Katriel via Python-Dev
On Wed, Feb 24, 2021 at 4:55 AM Guido van Rossum wrote: However there may be an omission in the PEP -- what if we want to do > something special for each suberror? If we just iterate over `eg.errors` we > would have to do something recursive for exceptions wrapped inside multiple > nested

[Python-Dev] Re: [Python-ideas] Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Stéfane Fermigier
I love pipx and I'm glad it exists at this point because it make The main issue is that each virtualenv takes space, lots of space. I have currently 57 apps installed via pipx on my laptop, and the 57 environments take almost 1 GB already. ~  cd .local/pipx/venvs/ ~/.l/p/venvs  ls

[Python-Dev] Re: [Python-ideas] Re: Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Stéfane Fermigier
On Wed, Feb 24, 2021 at 1:47 PM Stéfane Fermigier wrote: > > So IMHO the best way to implement solution 3 would be by using some > variant of the approach popularized by Nix (repository of immutable > packages + links to each virtualenv). > Another benefit of this kind of approach, besides

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Christian Heimes
On 24/02/2021 15.16, Random832 wrote: > On Wed, Feb 24, 2021, at 06:27, Christian Heimes wrote: >> Separate directories don't prevent clashes and system breakage. But they >> provide an easy way to *recover* from a broken system. > > I think it could be turned into a way to prevent them by A)

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Jim J. Jewett
Please include an example for: except *ExceptionGroup: pass I *think* it swallows all exceptions, instead of re-raising. I *think* it also catches (and then swallows) bare exception that were not initially part of an ExceptionGroup. I *think* it catches anything that gets raised, not just

[Python-Dev] Re: [Python-ideas] Re: Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Random832
On Wed, Feb 24, 2021, at 09:08, Paul Moore wrote: > I don't use Linux much, and I'm definitely not familiar with Linux > distribution tools, but from what I can gather Linux distributions > have made the choices: > > 1. Write key operating system utilities in Python. > 2. Share the Python

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Jim J. Jewett
The "no subclasses" seems pretty severe, particularly if you can't even use marker attributes because it isn't clear when a different instance of container ExceptionGroup will be substituted. The justification for this restriction was that .split() had to be be able to instantiate ... wouldn't

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Random832
On Wed, Feb 24, 2021, at 06:27, Christian Heimes wrote: > Separate directories don't prevent clashes and system breakage. But they > provide an easy way to *recover* from a broken system. I think it could be turned into a way to prevent them by A) having site-packages always take precedence over

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Jim J. Jewett
Petr: What about except *(TypeError, ExceptionGroup):? Irit: Good question. We should block that as well. But https://www.python.org/dev/peps/pep-0654/#backwards-compatibility seems to explicitly recommend the very similar: except (Exception, ExceptionGroup):

[Python-Dev] Re: [Python-ideas] Re: Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Paul Moore
On Wed, 24 Feb 2021 at 13:12, Antoine Pitrou wrote: > > On Wed, 24 Feb 2021 13:47:40 +0100 > Stéfane Fermigier wrote: > > The 3rd solution is probably the best of the 3, but the sharing mechanism > > still needs to be specified (and, if needed, implemented) properly. > > I wouldn't want to

[Python-Dev] Re: [Python-ideas] Re: Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Paul Moore
On Wed, 24 Feb 2021 at 10:55, Stéfane Fermigier wrote: > There is probably a clever way to reuse common packages (probably via clever > symlinking) and reduce the footprint of these installations. Ultimately the problem is that a general tool can't deal with conflicts (except by raising an

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Christian Heimes
On 24/02/2021 11.52, Stéfane Fermigier wrote: > I love pipx and I'm glad it exists at this point because it make  > > The main issue is that each virtualenv takes space, lots of space. > > I have currently 57 apps installed via pipx on my laptop, and the 57 > environments take almost 1 GB

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Christian Heimes
On 24/02/2021 08.03, Michał Górny wrote: > On Tue, 2021-02-23 at 19:45 -0500, Random832 wrote: >> I was reading a discussion thread >> about >> various issues with the Debian packaged version of Python, and the following >>

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Henk-Jaap Wagenaar
On Wed, 24 Feb 2021 at 10:18, Antoine Pitrou wrote: > On Tue, 23 Feb 2021 20:29:52 -0500 > Jonathan Goble wrote: > > > > I can't speak for distributors or maintainers [1], but I can speak for > > myself as a user. I run Debian testing (currently bullseye as that is > > preparing for release) as

[Python-Dev] Re: Have virtual environments led to neglect of the actual environment?

2021-02-24 Thread Antoine Pitrou
On Tue, 23 Feb 2021 20:29:52 -0500 Jonathan Goble wrote: > > I can't speak for distributors or maintainers [1], but I can speak for > myself as a user. I run Debian testing (currently bullseye as that is > preparing for release) as my daily OS on my personal laptop, used for > personal matters

[Python-Dev] Re: [SPAM] Re: Move support of legacy platforms/architectures outside Python

2021-02-24 Thread Antoine Pitrou
On Tue, 23 Feb 2021 16:45:27 + Rob Boehne wrote: > On 2/22/21, 4:06 PM, "Antoine Pitrou" wrote: > > On Mon, 22 Feb 2021 19:50:43 + > Rob Boehne wrote: > > > > The other thing that crept into this thread was the mention of test > that intermittently fail. > >

[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021-02-24 Thread Stestagg
On Tue, Feb 23, 2021 at 11:00 PM Irit Katriel wrote: > > Hi Steve, > > Thank you for trying out the implementation. Please do let me know about > bugs you find. > > Thanks you for your response! It seems I had missed the (now) obvious naked exception wrapping logic. Apologies for adding noise