[issue43754] Eliminate bindings for partial pattern matches

2021-05-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 39494285e15dc2d291ec13de5045b930eaf0a3db by Pablo Galindo in 
branch 'master':
bpo-43754: Fix compiler warning in Python/compile.c (GH-25855)
https://github.com/python/cpython/commit/39494285e15dc2d291ec13de5045b930eaf0a3db


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43754] Eliminate bindings for partial pattern matches

2021-05-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +24539
pull_request: https://github.com/python/cpython/pull/25855

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43754] Eliminate bindings for partial pattern matches

2021-05-02 Thread Brandt Bucher


Change by Brandt Bucher :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43754] Eliminate bindings for partial pattern matches

2021-05-02 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 0ad1e0384c8afc5259a6d03363491d89500a5d03 by Brandt Bucher in 
branch 'master':
bpo-43754: Eliminate bindings for partial pattern matches (GH-25229)
https://github.com/python/cpython/commit/0ad1e0384c8afc5259a6d03363491d89500a5d03


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43754] Eliminate bindings for partial pattern matches

2021-04-24 Thread Brandt Bucher


Brandt Bucher  added the comment:

Since the feature freeze is coming up (and this changes the bytecode), I'd like 
to open this up for review now.

It probably shouldn't actually be merged before the AST changes in issue 43892, 
though. There will be quite a few conflicts that need resolving, but I'd rather 
integrate the AST changes into this PR than force Nick to integrate these 
deeper changes into his branch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43754] Eliminate bindings for partial pattern matches

2021-04-07 Thread Brandt Bucher


Brandt Bucher  added the comment:

Guido informed me that Mark is currently maintaining a PEP 653 implementation 
branch. I checked it out today, and it looks like it has *lots* of conflicts 
with this one.

For the time being, I'm going to experiment with other ways of accomplishing 
this that don't involve rewriting most of the pattern compiler. That way we can 
minimize potential merge conflicts.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43754] Eliminate bindings for partial pattern matches

2021-04-06 Thread Brandt Bucher


New submission from Brandt Bucher :

This draft PR contains a couple of pattern matching improvements I'm 
experimenting with. Most significantly, it implements behavior that several 
people requested during the PEP 634 feedback process: no more name bindings for 
partial matches.

(One caveat: all names are bound *before* evaluating the corresponding guard. 
If the guard fails, these bindings won't be rolled back before matching the 
next case.)

In short, this is accomplished by storing captured objects on the stack 
underneath the more immediately important stuff, popping them all on failure or 
storing them all only once the *entire* pattern for that case matches. The 
control flow needs to be greatly simplified in order to make this work 
correctly, so the patch replaces the current "push bools and jump if false a 
bunch of times" flow with something much more efficient: jumping straight into 
a run of POP_TOPs on failure. We already do something very similar to this in 
pattern_helper_sequence_unpack (the comments in the current code explain it 
well).

Parts of the new code are a bit more complex than before (especially 
or-patterns, which need to do a bit of juggling on the stack to reorder 
captured items and avoid popping important data on failure), and other parts 
can certainly still be improved... but I personally consider it a win to have 
more intuitive partial match behavior with no performance penalty.

I thought I'd loop a few of you in on it to hear your thoughts before 
progressing much further.

--
assignee: brandtbucher
components: Interpreter Core
messages: 390368
nosy: Mark.Shannon, brandtbucher, gvanrossum, pablogsal
priority: normal
severity: normal
status: open
title: Eliminate bindings for partial pattern matches
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43754] Eliminate bindings for partial pattern matches

2021-04-06 Thread Brandt Bucher


Change by Brandt Bucher :


--
keywords: +patch
pull_requests: +23966
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25229

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com