[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Greg Ewing
On 24/03/20 3:43 pm, Dennis Sweeney wrote: This was an attempt to ensure no one can do funny business with tuple or str subclassing. I was trying to emulate the ``PyTuple_Check`` followed by ``PyTuple_GET_SIZE`` and ``PyTuple_GET_ITEM`` that are done by the C implementation of

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Dennis Sweeney
Steven D'Aprano wrote: > Having confirmed that prefix is a tuple, you call tuple() to > make a copy of it in order to iterate over it. Why? > > Having confirmed that option is a string, you call str() on > it to (potentially) make a copy. Why? This was an attempt to ensure no one can do funny

[Python-Dev] Re: MacOS pkg bundles openssl, but doesn't include a cert bundle?

2020-03-23 Thread Matt Billenstein via Python-Dev
Thanks Ned - confirmed that works in 2.7.17 - maybe it was there in 2.7.16 and I just overlooked that messaging in the last step. m On Mon, Mar 23, 2020 at 09:11:09PM -0400, Ned Deily wrote: > On Mar 23, 2020, at 20:30, Matt Billenstein via Python-Dev > wrote: > > Hi, installing the latest

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Dennis Sweeney
This should be fixed now. ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Steven D'Aprano
On Sun, Mar 22, 2020 at 10:25:28PM -, Dennis Sweeney wrote: > Changes: > - More complete Python implementation to match what the type checking in > the C implementation would be > - Clarified that returning ``self`` is an optimization > - Added links to past discussions on

[Python-Dev] Re: MacOS pkg bundles openssl, but doesn't include a cert bundle?

2020-03-23 Thread Ned Deily
On Mar 23, 2020, at 20:30, Matt Billenstein via Python-Dev wrote: > Hi, installing the latest 2.7.16 MacOS installer, functions in urllib > will attempt to load trusted certs from: > > /Library/Frameworks/Python.framework/Versions/2.7/etc/openssl/cert.pem > > But this file is not shipped with

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Stephen J. Turnbull
Cameron Simpson writes: > As a diversion, _are_ there use cases where an empty affix is useful or > reasonable or likely? In the "raise on failure" design, "aba".cutsuffix('.doc') raises, "aba".cutsuffix('.doc', '') returns "aba". BTW, since I'm here, thanks for your discussion of

[Python-Dev] MacOS pkg bundles openssl, but doesn't include a cert bundle?

2020-03-23 Thread Matt Billenstein via Python-Dev
Hi, installing the latest 2.7.16 MacOS installer, functions in urllib will attempt to load trusted certs from: /Library/Frameworks/Python.framework/Versions/2.7/etc/openssl/cert.pem But this file is not shipped with the installer package - this makes urlretrieve and friends fail on https hosts -

[Python-Dev] [RELEASE] Python 3.9.0a5 is now available for testing

2020-03-23 Thread Łukasz Langa
On behalf of the entire Python development community, and the currently serving Python release team in particular, I’m pleased to announce the release of Python 3.9.0a5. Get it here: https://www.python.org/downloads/release/python-390a5/

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Cameron Simpson
On 22Mar2020 23:33, Rob Cliffe wrote: Sorry, another niggle re handling an empty affix:  With your Python implementation, 'aba'.cutprefix(('', 'a')) == 'aba' 'aba'.cutsuffix(('', 'a')) == 'ab' This seems surprising. That surprises me too. I expect the first matching affix to be used. It is

[Python-Dev] Re: Jump on C by PyEval_SetTrace Python 3.7.7 - SOLUTION

2020-03-23 Thread Leandro Müller
Hello Victor Stinner. Thanks. Your tip helped me a lot. I understood that I need to get position on bycode of the line. So I create the funcion to get position inside of the bycode. Now I can to jump the correct position on trace. frame->f_lasti = checkBycodePosition(frame->f_code, 11); int

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Rob Cliffe via Python-Dev
Sorry, another niggle re handling an empty affix:  With your Python implementation, 'aba'.cutprefix(('', 'a')) == 'aba' 'aba'.cutsuffix(('', 'a')) == 'ab' This seems surprising. Rob Gadfly Cliffe On 22/03/2020 23:23, Dennis Sweeney wrote: Much appreciated! I will add that single quote and

[Python-Dev] Re: Accepting PEP 573 (Module State Access from C Extension Methods)

2020-03-23 Thread Hai Shi
Wow, congratulations:) Looking forword to Marcel' PRs: https://github.com/python/cpython/compare/master...Dormouse759:pep-c-rebase_newer ps: two days ago, I asked what blocked pep-0573 privately ;) ___ Python-Dev mailing list -- python-dev@python.org

[Python-Dev] Re: Accepting PEP 573 (Module State Access from C Extension Methods)

2020-03-23 Thread Hai Shi
Wow, congratulations! ps: two days ago, I asked petr what blocked PEP-573 privately(mch extension module need this pep ;)) ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org

[Python-Dev] Re: Jump on C by PyEval_SetTrace Python 3.7.7

2020-03-23 Thread Leandro Müller
Hi. When I changed frame->f_lasti change de code to back, it's work but the line in front code occurs dump, the runtime over. Example: I jump to 8 line and after I jump to line 10, it occurs dump. On python trace pdb the jump works good by the frame-f_lineno. Att. Leandro Müller

[Python-Dev] Accepting PEP 573 (Module State Access from C Extension Methods)

2020-03-23 Thread Stefan Behnel
As (first-time) BDFL delegate, I accept PEP 573 for Python 3.9, "Module State Access from C Extension Methods" https://www.python.org/dev/peps/pep-0573/ Petr, Nick, Eric and Marcel, thank you for your work and intensive discussions on this PEP, and also to everyone else who got involved on

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Eric V. Smith
On 3/23/2020 12:02 PM, Rhodri James wrote: On 23/03/2020 14:50, Dan Stromberg wrote: I tend to be mistrustful of code that tries to guess the best thing to do, when something expected isn't found. How about: def cutprefix(self: str, pre: str, raise_on_no_match: bool=False, /) -> str:

[Python-Dev] Re: Jump on C by PyEval_SetTrace Python 3.7.7

2020-03-23 Thread Victor Stinner
Hi, It seems like you should be to modify frame->f_lasti in a trace function FYI in a frame object, the line number is computed using frame->f_lasti and f->f_code->co_lnotab: PyFrame_GetLineNumber(). See: https://github.com/python/cpython/blob/master/Objects/lnotab_notes.txt Good luck ;-)

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Rhodri James
On 23/03/2020 14:50, Dan Stromberg wrote: On Fri, Mar 20, 2020 at 3:28 PM Victor Stinner wrote: The builtin ``str`` class will gain two new methods with roughly the following behavior:: def cutprefix(self: str, pre: str, /) -> str: if self.startswith(pre): return

[Python-Dev] Re: PEP 616 -- String methods to remove prefixes and suffixes

2020-03-23 Thread Dan Stromberg
On Fri, Mar 20, 2020 at 3:28 PM Victor Stinner wrote: > > The builtin ``str`` class will gain two new methods with roughly the > > following behavior:: > > > > def cutprefix(self: str, pre: str, /) -> str: > > if self.startswith(pre): > > return self[len(pre):] > >