[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Inada Naoki
On Tue, Oct 27, 2020 at 5:23 AM Victor Stinner wrote: > > os.get_exec_path() must modify temporarily warnings filters to ignore > BytesWarning when it looks for 'PATH' (unicode) or b'PATH' (bytes) in > the 'env' dictionary which may contain unicode or bytes strings. > Modifying warnings filters

[Python-Dev] Re: os.scandir bug in Windows?

2020-10-26 Thread Gregory P. Smith
On Mon, Oct 26, 2020, 4:06 PM Chris Angelico wrote: > On Tue, Oct 27, 2020 at 10:00 AM Greg Ewing > wrote: > > > > On 27/10/20 8:24 am, Victor Stinner wrote: > > > I would > > > rather want to kill the whole concept of "access" time in operating > > > systems (or just configure the OS to not

[Python-Dev] Re: Pattern matching reborn: PEP 622 is dead, long live PEP 634, 635, 636

2020-10-26 Thread Tin Tvrtković
Hello, Go channels are indeed very similar to asyncio Queues, with some added features like channels being closable. (There is also special syntax in the select statement, `val, ok <- chan`, that will set the `ok` variable to false if the channel has been closed.) A larger difference, I think, is

[Python-Dev] Re: os.scandir bug in Windows?

2020-10-26 Thread Chris Angelico
On Tue, Oct 27, 2020 at 10:00 AM Greg Ewing wrote: > > On 27/10/20 8:24 am, Victor Stinner wrote: > > I would > > rather want to kill the whole concept of "access" time in operating > > systems (or just configure the OS to not update it anymore). I guess > > that it's really hard to make it

[Python-Dev] Re: os.scandir bug in Windows?

2020-10-26 Thread Greg Ewing
On 27/10/20 8:24 am, Victor Stinner wrote: I would rather want to kill the whole concept of "access" time in operating systems (or just configure the OS to not update it anymore). I guess that it's really hard to make it efficient and accurate at the same time... Also it's kind of weird that

[Python-Dev] Re: os.scandir bug in Windows?

2020-10-26 Thread Eryk Sun
On 10/26/20, Victor Stinner wrote: > Le lun. 19 oct. 2020 à 13:50, Steve Dower a écrit > : >> Feel free to file a bug, but we'll likely only add a vague note to the >> docs about how Windows works here rather than changing anything. > > I agree that this surprising behavior can be documented.

[Python-Dev] Re: fail keyword like there is pass keyword

2020-10-26 Thread Evpok Padding
`raise NotImplementedError` https://docs.python.org/3/library/exceptions.html#NotImplementedError I think would be the canonical solution. E On Mon, 26 Oct 2020 at 20:34, Victor Stinner wrote: > If you use the unittest module, I suggest you to use self.fail() instead: > it is standard.

[Python-Dev] Re: Macro for logging

2020-10-26 Thread Victor Stinner
Hi, There is the __debug__ builtin variable which is equal to True by default, but is equal to False when Python is run with the -O command line option. The compiler removes dead code when -O is used. Example: $ cat x.py def func(): if __debug__: print("debug") import dis dis.dis(func) #

[Python-Dev] Re: fail keyword like there is pass keyword

2020-10-26 Thread Victor Stinner
If you use the unittest module, I suggest you to use self.fail() instead: it is standard. Moreover, you can specify a message. https://docs.python.org/dev/library/unittest.html#unittest.TestCase.fail Victor Le ven. 23 oct. 2020 à 21:36, Umair Ashraf a écrit : > Hello > > Can I suggest a

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Victor Stinner
Le sam. 24 oct. 2020 à 15:13, Christian Heimes a écrit : > In my experience it would be useful to keep the bytes warning for > implicit representation of bytes in string formatting. It's still a > common source of issues in code. IMO it's not a big deal to investigate such bugs without the -b /

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Victor Stinner
Hi, Which operations are impacted by -b and -bb? str == bytes, bytes == str, dict lookup using str or bytes keys? 'unicode' < b'bytes' always raises a TypeError. Le sam. 24 oct. 2020 à 05:20, Inada Naoki a écrit : > To avoid BytesWarning, the compiler needs to do some hack when they > need to

[Python-Dev] Re: PyPy performance stats (was Re: Speeding up CPython)

2020-10-26 Thread Terry Reedy
On 10/26/2020 11:42 AM, Matti Picus wrote: On 10/21/20 2:38 PM, Matti Picus wrote: [0] https://speed.pypy.org/comparison/ Just as a follow up: the front page of speed.pypy.org now shows the latest pypy 3.6 vs cpython 3.6.7. I just clicked the link and there is 3.7.6, not 3.6.7. But why

[Python-Dev] Re: os.scandir bug in Windows?

2020-10-26 Thread Victor Stinner
Le lun. 19 oct. 2020 à 13:50, Steve Dower a écrit : > Feel free to file a bug, but we'll likely only add a vague note to the > docs about how Windows works here rather than changing anything. I agree that this surprising behavior can be documented. Attempting to provide accurate access time in

[Python-Dev] Re: _PyBytesWriter/_PyUnicodeWriter could be faster

2020-10-26 Thread Victor Stinner
Hi, Le dim. 25 oct. 2020 à 15:36, Ma Lin a écrit : > Some code needs to maintain an output buffer that has an unpredictable size. > Such as bz2/lzma/zlib modules, _PyBytesWriter/_PyUnicodeWriter. > > In current code, when the output buffer grows, resizing will cause > unnecessary memcpy(). > >

[Python-Dev] Re: PyPy performance stats (was Re: Speeding up CPython)

2020-10-26 Thread Chris Angelico
On Tue, Oct 27, 2020 at 2:42 AM Matti Picus wrote: > > > On 10/21/20 2:38 PM, Matti Picus wrote: > > On 10/21/20 20:42:02 +1100 Chris Angelico wrote: > > > >> When I go looking for PyPy performance stats, everything seems to be > >> Python 2.7. Is there anywhere that compares PyPy3 to CPython 3.6

[Python-Dev] Re: PyPy performance stats (was Re: Speeding up CPython)

2020-10-26 Thread Matti Picus
On 10/21/20 2:38 PM, Matti Picus wrote: On 10/21/20 20:42:02 +1100 Chris Angelico wrote: When I go looking for PyPy performance stats, everything seems to be Python 2.7. Is there anywhere that compares PyPy3 to CPython 3.6 (or whichever specific version)? Or maybe it's right there on

[Python-Dev] Re: Pattern matching reborn: PEP 622 is dead, long live PEP 634, 635, 636

2020-10-26 Thread Gustavo Carneiro
It's true that asyncio.wait provides the tools that you need, but it's a bit clunky to use correctly. Maybe would be something along the lines of: -- queue1 = asyncio.Queue() queue2 = asyncio.Queue() ... get1 = asyncio.create_task(queue1.get()) get2 = asyncio.create_task(queue2.get()) await

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Serhiy Storchaka
24.10.20 06:19, Inada Naoki пише: > To avoid BytesWarning, the compiler needs to do some hack when they > need to store bytes and str constants in one dict or set. > BytesWarning has maintenance costs. It is not huge, but significant. > > When can we remove it? My idea is: > > 3.10: Deprecate

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Serhiy Storchaka
26.10.20 10:10, Inada Naoki пише: > Of course, there are some runtime costs too. > > https://github.com/python/cpython/blob/fb5db7ec58624cab0797b4050735be865d380823/Modules/_functoolsmodule.c#L802 >

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Inada Naoki
On Mon, Oct 26, 2020 at 4:35 PM Senthil Kumaran wrote: > > On Sat, Oct 24, 2020 at 6:18 AM Christian Heimes wrote: >> >> In my experience it would be useful to keep the bytes warning for >> implicit representation of bytes in string formatting. It's still a >> common source of issues in code. >

[Python-Dev] Re: When to remove BytesWarning?

2020-10-26 Thread Senthil Kumaran
On Sat, Oct 24, 2020 at 6:18 AM Christian Heimes wrote: > > > In my experience it would be useful to keep the bytes warning for > implicit representation of bytes in string formatting. It's still a > common source of issues in code. > I am with Christian here. Still notice a possibility of