[Python-Dev] Re: Delayed evaluation of f-strings?

2021-06-24 Thread Martin (gzlist) via Python-Dev
On Thu, 24 Jun 2021 at 17:37, Martin (gzlist) wrote: > > >>> d = dict(a=1) > >>> f'{d["a"]}' > '1' > >>> str(DelayedFString('{d["a"]}')) > Traceback (most recent call last): >

[Python-Dev] Re: Delayed evaluation of f-strings?

2021-06-24 Thread Martin (gzlist) via Python-Dev
On Thu, 24 Jun 2021 at 17:25, Eric Nieuwland wrote: > > class DelayedFString(str): > def __str__(self): > vars = inspect.currentframe().f_back.f_globals.copy() > vars.update(inspect.currentframe().f_back.f_locals) > return self.format(**vars) This isn't quite right as

[Python-Dev] Re: On the migration from master to main

2021-05-10 Thread Martin (gzlist) via Python-Dev
On Tue, 23 Mar 2021 at 21:39, Python Steering Council wrote: > > This isn’t happening because GitHub/Microsoft made a political decision. It’s > happening because it is incredibly easy to make this move, many projects have > already done this, and it reflects badly on any project not making this

[Python-Dev] Re: Integer concatenation to byte string

2021-03-05 Thread Martin (gzlist) via Python-Dev
On Tue, 2 Mar 2021 at 21:44, Memz wrote: > > foo+= 255 # Works the same as > bytesvariable+=b"ÿ" foo = b"%b%d" % (foo, 255) > foo+= a"\x255\x00" # Concatenation with itself foo = b"%b%b" % (foo, foo) See PEP461: Adding % formatting to bytes an

[Python-Dev] Re: PEP 638: Syntactic macros

2020-10-19 Thread Martin (gzlist) via Python-Dev
On Fri, 16 Oct 2020 at 23:22, Guido van Rossum wrote: > > Dima, > > Do you have a link to "babel macros"? Searching for that brought up several > different things; not being a frequent JS user I don't know how to filter > these. These links should help: https://babeljs.io/blog/2017/09/11/zero-

[Python-Dev] Re: Something wrong with the bug tracker?

2019-12-22 Thread Martin (gzlist) via Python-Dev
Logging in with openid using launchpad just worked for me, so transient or related to google's openid support presumably. Martin On Sun, 22 Dec 2019 at 15:13, Mark Shannon wrote: > > Hi, > > For some reason I can't log into the bug tracker with Google. > I just get the error message: > > """ > A

Re: [Python-Dev] Replacement for array.array('u')?

2019-03-25 Thread Martin (gzlist) via Python-Dev
On Fri, 22 Mar 2019 at 16:12, Steve Dower wrote: > > On 22Mar2019 0433, Antoine Pitrou wrote: > > The question is: why would you use a array.array() with a Windows C API? > > I started replying to this with a whole lot of examples, and eventually > convinced myself that you wouldn't (or shouldn't)

Re: [Python-Dev] Evil reference cycles caused Exception.__traceback__

2017-09-18 Thread Martin (gzlist) via Python-Dev
Thanks for working on this and writing up the details Victor. For those confused about why this matters, routinely having every object in your application participating in one (or more) giant reference cycles makes reasoning about and fixing resource issues very difficult. For instance, a while b

Re: [Python-Dev] PEP 538 (review round 2): Coercing the legacy C locale to a UTF-8 based locale

2017-06-12 Thread Martin (gzlist) via Python-Dev
Thanks for replying to my points! On 12/06/2017, Nick Coghlan wrote: > > `PYTHONIOENCODING=:strict` remains the preferred way of forcing strict > encoding checks on the standard streams, regardless of locale. Then the user of my script has to care that it's written in Python and set that specifi

Re: [Python-Dev] Handle errors in cleanup code

2017-06-12 Thread Martin (gzlist) via Python-Dev
On 12/06/2017, Serhiy Storchaka wrote: > > But if an error is raised when execute undo_something(), it replaces the > original exception which become chaining as the __context__ attribute. > The problem is that this can change the type of the exception. If > do_something_other() raises SystemExit

Re: [Python-Dev] PEP 538 (review round 2): Coercing the legacy C locale to a UTF-8 based locale

2017-06-11 Thread Martin (gzlist) via Python-Dev
On 09/05/2017, Nick Coghlan wrote: > > Enough changes have accumulated in PEP 538 since the start of the > previous thread that it seems sensible to me to start a new thread > specifically covering the current design (which aims to address all > the concerns raised in the previous thread). > > I h

Re: [Python-Dev] Deprecate codecs.open() and StreamWriter/StreamReader

2011-05-24 Thread Martin (gzlist)
On 24/05/2011, Victor Stinner wrote: > > In Python 2, codecs.open() is the best way to read and/or write files > using Unicode. But in Python 3, open() is preferred with its fast io > module. I would like to deprecate codecs.open() because it can be > replaced by open() and io.TextIOWrapper. I wou

Re: [Python-Dev] Test cases not garbage collected after run

2011-04-15 Thread Martin (gzlist)
On 14/04/2011, Michael Foord wrote: > I'd be interested to know what is keeping the tests alive even when the > test suite isn't. As far as I know there is nothing else in unittest > that would do that. The main cause is some handy code for collecting and filtering tests by name, which unintentio

Re: [Python-Dev] Test cases not garbage collected after run

2011-04-13 Thread Martin (gzlist)
On 07/04/2011, Michael Foord wrote: > On 07/04/2011 20:18, Robert Collins wrote: >> >> Testtools did something to address this problem, but I forget what it >> was offhand. Some issues were worked around, but I don't remember any comprehensive solution. > The proposed "fix" is to make test suite

Re: [Python-Dev] Fault handler updated, now disabled by default

2010-12-23 Thread Martin (gzlist)
On 23/12/2010, Victor Stinner wrote: > > I tested my patch on Windows (XP), Ubuntu (10.4) and FreeBSD (8) and it > works correctly: all tests pass and the system fault handler (Windows > popup, Apport and core dump) is also called. Doesn't build for me without #ifdef HAVE_UNISTD_H in Python/fault

Re: [Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable

2010-12-20 Thread Martin (gzlist)
On 20/12/2010, Michael Foord wrote: > On 19/12/2010 23:02, Victor Stinner wrote: >> I don't think that kill() is available on Windows. Can just use raise instead. But, is any of this change valid on Windows? "The SIGILL, SIGSEGV, and SIGTERM signals

Re: [Python-Dev] (Not) delaying the 3.2 release

2010-09-16 Thread Martin (gzlist)
On 16/09/2010, Guido van Rossum wrote: > On Thu, Sep 16, 2010 at 11:16 AM, Toshio Kuratomi > wrote: >> You were talking about encodings that were supersets of 7-bit ASCII. >> I think Martin was demonstrating a byte string that was a superset of >> 7-bit >> ASCII being fed to a stdlib function whi

Re: [Python-Dev] (Not) delaying the 3.2 release

2010-09-16 Thread Martin (gzlist)
On 16/09/2010, Guido van Rossum wrote: > > In all cases I can imagine where such polymorphic functions make > sense, the necessary and sufficient assumption should be that the > encoding is a superset of 7-bit(*) ASCII. This includes UTF-8, all > Latin-N variant, and AFAIK also the popular CJK enc

Re: [Python-Dev] Issue #7978, unexpected EINTR-related exceptions

2010-04-12 Thread Martin (gzlist)
On 08/04/2010, Victor Stinner wrote: > Le jeudi 08 avril 2010 08:11:09, Yaniv Aknin a écrit : >> Issue #7978 (http://bugs.python.org/issue7978) describes a bug in >> SocketServer where a received signal in SocketServer's select() call >> will raise an uncaught exception due to EINTR. The proposed

Re: [Python-Dev] Question over splitting unittest into a package

2009-12-31 Thread Martin (gzlist)
Thanks for the quick response. On 30/12/2009, Benjamin Peterson wrote: > > When I made that change, I didn't know that the __unittest "hack" was > being used elsewhere outside of unittest, so I felt fine replacing it > with another. While I still consider it an implementation detail, I > would be

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-24 Thread Martin (gzlist)
On 24/10/2009, Nick Coghlan wrote: > Ben Finney wrote: >> Which then raises the question “what part of the set does it get?”, >> which the function signature does nothing to answer. I'm proposing that >> a no-parameters ‘set.get’ is needlessly confusing to think about. > > The fact that set.get()

Re: [Python-Dev] Mercurial migration: help needed

2009-09-05 Thread Martin (gzlist)
On 05/09/2009, "Martin v. Löwis" wrote: > > Creating the clone. ISTM that it leaves the http connection open while > doing stuff locally (or creates multiple of them, and one times out). > > It starts cloning, and then, after an hour or so, it reports ABORT, > and rolls back, for no apparent reaso

Re: [Python-Dev] Mercurial migration: help needed

2009-09-05 Thread Martin (gzlist)
On 05/09/2009, Antoine Pitrou wrote: > Terry Reedy udel.edu> writes: >> >> If essentially all text files need fixed line endings on Windows, then >> hg really needs this built in. Has it really not been used much on >> Windows? > > Mercurial is used by e.g. Mozilla, which is not really known for