[issue44618] inspect.signature does not work for datetime classes

2021-07-13 Thread Mauricio Villegas


New submission from Mauricio Villegas :

Classes in the datetime module are implemented using __new__ with some named 
parameters. I want to be able to inspect their signature to know which are the 
names of the parameters it accepts like it works for most classes. However, 
this does not work for classes in the datetime module. I already mentioned this 
in https://bugs.python.org/issue40897 but now I am thinking this should be a 
separate issue so I am creating this one.

An example is the class timedelta. It has as parameters days, seconds, 
microseconds, milliseconds, minutes, hours and weeks. If I run the following 
script trying different python versions

for py in 36 37 38 39; do
  source py${py}/bin/activate
  echo "=== $(python3 --version) ==="
  python3 -c "
from datetime import timedelta
import inspect
print(inspect.signature(timedelta.__new__))
print(inspect.signature(timedelta.__init__))
inspect.signature(timedelta)
"
  deactivate
done

What I get is

=== Python 3.6.9 ===
(*args, **kwargs)
(self, /, *args, **kwargs)
Traceback (most recent call last):
...
ValueError: no signature found for builtin type 
=== Python 3.7.11 ===
(*args, **kwargs)
(self, /, *args, **kwargs)
Traceback (most recent call last):
...
ValueError: no signature found for builtin type 
=== Python 3.8.11 ===
(*args, **kwargs)
(self, /, *args, **kwargs)
Traceback (most recent call last):
...
ValueError: no signature found for builtin type 
=== Python 3.9.6 ===
(*args, **kwargs)
(self, /, *args, **kwargs)
Traceback (most recent call last):
...
ValueError: no signature found for builtin type 

--
messages: 397387
nosy: mauvilsa
priority: normal
severity: normal
status: open
title: inspect.signature does not work for datetime classes
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue44618] inspect.signature does not work for datetime classes

2021-07-13 Thread Mauricio Villegas


Change by Mauricio Villegas :


--
components: +Library (Lib)
type:  -> behavior

___
Python tracker 

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



[issue44472] ltrace functionality doesn't work if there is an exception set

2021-07-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 4a0f1df9527f7d67064d33f5366476b3c93dc86c by Miss Islington (bot) 
in branch '3.10':
bpo-44472: Fix ltrace functionality when exceptions are raised (GH-26822) 
(GH-26830)
https://github.com/python/cpython/commit/4a0f1df9527f7d67064d33f5366476b3c93dc86c


--

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Ken Jin


Ken Jin  added the comment:

@Serhiy
> 2. Different handling of virtual subclasses:

This looks like a bug. I think the union form of isinstance/issubclass should 
have the same behavior as the tuple form. We promise checking of virtual 
classes in the docs for union types:
https://docs.python.org/3.10/library/functions.html#issubclass

The fix seems to be changing one line of code in Objects/unionobject.c from 
PyType_IsSubtype to PyObject_IsSubclass. Since it isn't a large change and it's 
a bug, I think we can backport it to 3.10 too.

@Serhiy and Guido,
> 1. Different handling of None:

> Ken Jin, should we treat type(None) as a subclass of int|None?

I think we can avoid this special case altogether by converting all None to 
type(None) when creating _Py_Union. This is what the typing.Union counterpart 
does, and it is also what PEP 484 says about None 
https://www.python.org/dev/peps/pep-0484/#using-none:

>>> Union[None, str].__args__
(, )

Though I know some people are opinionated about None -> type(None).

This would require adding one more check at 
https://github.com/python/cpython/blob/3.10/Objects/unionobject.c#L266 .
Maybe this?

if(Py_IsNone(i_element))
i_element = &_PyNone_Type

--

___
Python tracker 

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



[issue44619] Bug in Python 3.7.10

2021-07-13 Thread Prakash


New submission from Prakash :

Hello -

I wish to bring to your kind notice a bug in Python.

Given any matrix X. While trying to compute the CoVariance matrix of that 
matrix X, Python does NOT compute the CoVarianceof the given matrix X.

Instead, Python comptes the CoVariance of the Transpose of the given matrix X.

This appears to be a bug in Python.

Please refer to the below website for a given matrix and what the result should 
be after the computation of it's CoVariance. And I have provided a screenshot 
of what Python is returning.

https://www.itl.nist.gov/div898/handbook/pmc/section5/pmc541.htm


Please let me know if you have any questions.



Regards,
Prakash

--
files: Bug in Python.pdf
messages: 397390
nosy: prakashvm
priority: normal
severity: normal
status: open
title: Bug in Python 3.7.10
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file50146/Bug in Python.pdf

___
Python tracker 

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



[issue44619] Bug in Python 3.7.10

2021-07-13 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

numpy is a third-party library, you will have to report it to them, we can't do 
anything about it.

--
nosy: +steven.daprano
resolution:  -> third party
stage:  -> 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



[issue44620] UUIDv1 is not RFC 4122 compliant

2021-07-13 Thread László Görög

New submission from László Görög :

Section 4.1.5 of RFC 4122 says the following about Clock Sequence:

   If the clock is set backwards, or might have been set backwards
   (e.g., while the system was powered off), and the UUID generator can
   not be sure that no UUIDs were generated with timestamps larger than
   the value to which the clock was set, then the clock sequence has to
   be changed.  If the previous value of the clock sequence is known, it
   can just be incremented; otherwise it should be set to a random or
   high-quality pseudo-random value.

However, the current implementation increments the timestamp and not the clock 
sequence. Ref: 
https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/uuid.py#L689-L690

--
components: Library (Lib)
messages: 397392
nosy: contact2
priority: normal
severity: normal
status: open
title: UUIDv1 is not RFC 4122 compliant
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue44621] Python 3.9 traces async for/else incorrectly

2021-07-13 Thread Ned Batchelder


New submission from Ned Batchelder :

Python 3.9 traces this code incorrectly.  Note: 3.8 and 3.10 are correct, only 
3.9 gets it wrong.

---
import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, 
lineno).rstrip()))
return trace

import asyncio

async def async_gen():
yield 13

async def async_test():
global a
a = 17
async for i in async_gen():
print(i + 19)
else:
a = 21

print(sys.version)
sys.settrace(trace)

asyncio.run(async_test())
assert a == 21
--

The starred line shows a trace of a statement that is not executed:

  3.9.6 (default, Jul 13 2021, 07:21:14)
  [Clang 12.0.0 (clang-1200.0.32.29)]
  call 15: async def async_test():
  line 17: a = 17
  line 18: async for i in async_gen():
  call 12: async def async_gen():
  line 13: yield 13
  retu 13: yield 13
  exce 18: async for i in async_gen():
  line 19: print(i + 19)
  32
  line 18: async for i in async_gen():
  call 13: yield 13
  retu 13: yield 13
  exce 18: async for i in async_gen():
* line 19: print(i + 19)
  line 21: a = 21
  retu 21: a = 21

--
components: Interpreter Core
keywords: 3.9regression
messages: 397393
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: Python 3.9 traces async for/else incorrectly
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue44621] Python 3.9 traces async for/else incorrectly

2021-07-13 Thread Ned Batchelder


Ned Batchelder  added the comment:

The corresponding coverage.py issue: 
https://github.com/nedbat/coveragepy/issues/1158

--

___
Python tracker 

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



[issue44602] Issue with get_build_version in msvc9compiler.py in distutils

2021-07-13 Thread Steve Dower


Steve Dower  added the comment:

msvc9compiler.py has been deprecated ever since _msvccompiler.py was 
introduced, so no code should be using it (it was always internal anyway).

And now all of distutils is also deprecated, so you probably need to report 
this to the setuptools project at https://github.com/pypa/setuptools so they 
can fix it in their embedded copy of distutils.

--
resolution:  -> out of date
stage:  -> 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



[issue44622] async-for loops are traced incorrectly in Python 3.10

2021-07-13 Thread Ned Batchelder


New submission from Ned Batchelder :

In Python 3.10, the traces at the end of an async-for loop are incorrect and 
different than at the end of a for-loop.

--
import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, 
lineno).rstrip()))
return trace

import asyncio

class AsyncIter:
def __init__(self, items): self.items = items

async def __aiter__(self):
for i in self.items: yield i

async def test1():
async for i in AsyncIter([1]):
print(f"test1 {i}")

def test2():
for i in [1]:
print(f"test2 {i}")

print(sys.version)
sys.settrace(trace)

asyncio.run(test1())
test2()


In 3.7, 3.8 and 3.9, the two for loops behave the same: the loop jumps back to 
the "for" statement, and then returns (the arrowed lines):

  3.9.5 (default, May  5 2021, 06:50:43)
  [Clang 12.0.0 (clang-1200.0.32.29)]
  call 18: async def test1():
  line 19: async for i in AsyncIter([1]):
  call 13: def __init__(self, items): self.items = items
  line 13: def __init__(self, items): self.items = items
  retu 13: def __init__(self, items): self.items = items
  call 15: async def __aiter__(self):
  line 16: for i in self.items: yield i
  retu 16: for i in self.items: yield i
  exce 19: async for i in AsyncIter([1]):
  line 20: print(f"test1 {i}")
  test1 1
  line 19: async for i in AsyncIter([1]):
  call 16: for i in self.items: yield i
  line 16: for i in self.items: yield i
  retu 16: for i in self.items: yield i
  exce 19: async for i in AsyncIter([1]):
> retu 19: async for i in AsyncIter([1]):
  call 22: def test2():
  line 23: for i in [1]:
  line 24: print(f"test2 {i}")
  test2 1
  line 23: for i in [1]:
> retu 23: for i in [1]:


In 3.10, the for loop behaves the same, but now the async-for traces the body 
once more when it doesn't execute, and returns from the body of the loop (the 
starred line):

  3.10.0b4 (default, Jul 11 2021, 13:51:53) [Clang 12.0.0 (clang-1200.0.32.29)]
  call 18: async def test1():
  line 19: async for i in AsyncIter([1]):
  call 13: def __init__(self, items): self.items = items
  line 13: def __init__(self, items): self.items = items
  retu 13: def __init__(self, items): self.items = items
  call 15: async def __aiter__(self):
  line 16: for i in self.items: yield i
  retu 16: for i in self.items: yield i
  exce 19: async for i in AsyncIter([1]):
  line 20: print(f"test1 {i}")
  test1 1
  line 19: async for i in AsyncIter([1]):
  call 16: for i in self.items: yield i
  line 16: for i in self.items: yield i
  retu 16: for i in self.items: yield i
  exce 19: async for i in AsyncIter([1]):
* line 20: print(f"test1 {i}")
  retu 20: print(f"test1 {i}")
  call 22: def test2():
  line 23: for i in [1]:
  line 24: print(f"test2 {i}")
  test2 1
  line 23: for i in [1]:
> retu 23: for i in [1]:

--
components: Interpreter Core
keywords: 3.10regression
messages: 397396
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: async-for loops are traced incorrectly in Python 3.10
type: behavior
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



[issue43948] sysconfig's osx_framework_user puts headers in different locations from distutils

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:

The current behavior has been there since 2012 at least. Kind of suspicious we 
haven't tripped over it before.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44616] Incorrect tracing for "except" with variable

2021-07-13 Thread Mark Shannon


Mark Shannon  added the comment:

Thanks Ned, you're doing a fantastic job of finding these issues.
Sorry for keeping you so busy with this.

This one was a latent bug, exposed by fixing https://bugs.python.org/issue44570.

--

___
Python tracker 

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



[issue44570] 3.10.0b3 doesn't trace line events for return in some cases

2021-07-13 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +25653
pull_request: https://github.com/python/cpython/pull/27109

___
Python tracker 

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



[issue44614] Broken Pipe in Server of Manager in multiprocessing when finalizing, sometimes

2021-07-13 Thread Mark Shannon


Change by Mark Shannon :


--
keywords: +patch
nosy: +Mark.Shannon
nosy_count: 1.0 -> 2.0
pull_requests: +25654
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27109

___
Python tracker 

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



[issue44616] Incorrect tracing for "except" with variable

2021-07-13 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue44614] Broken Pipe in Server of Manager in multiprocessing when finalizing, sometimes

2021-07-13 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests:  -25654

___
Python tracker 

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



[issue44570] 3.10.0b3 doesn't trace line events for return in some cases

2021-07-13 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests:  -25653

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2021-07-13 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +andrei.avk
nosy_count: 6.0 -> 7.0
pull_requests: +25656
pull_request: https://github.com/python/cpython/pull/27073

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset d4a5f0b659a2b8f206cfbdfd37fc36aedf77a71f by andrei kulakov in 
branch 'main':
bpo-35113: clean up duplicate import and comment (#27073)
https://github.com/python/cpython/commit/d4a5f0b659a2b8f206cfbdfd37fc36aedf77a71f


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue38741] Definition of multiple ']' in header configparser

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 2924bb1a566977efd45f335d6a94cd84d8047edf by jsnklln in branch 
'main':
bpo-38741: Definition of multiple ']' in header configparser (GH-17129)
https://github.com/python/cpython/commit/2924bb1a566977efd45f335d6a94cd84d8047edf


--

___
Python tracker 

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



[issue38741] Definition of multiple ']' in header configparser

2021-07-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +25657
pull_request: https://github.com/python/cpython/pull/27110

___
Python tracker 

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



[issue44514] configparser.rst & bz2.rst leave temp files after 'make doctest'

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 48a5aa7f128caf5a46e4326c1fd285cd5fc8e59d by Kevin Follstad in 
branch 'main':
bpo-44514: Add doctest testcleanup for configparser and bz2 (#26909)
https://github.com/python/cpython/commit/48a5aa7f128caf5a46e4326c1fd285cd5fc8e59d


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44514] configparser.rst & bz2.rst leave temp files after 'make doctest'

2021-07-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25659
pull_request: https://github.com/python/cpython/pull/27112

___
Python tracker 

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



[issue44514] configparser.rst & bz2.rst leave temp files after 'make doctest'

2021-07-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25658
pull_request: https://github.com/python/cpython/pull/27111

___
Python tracker 

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



[issue43126] IOBase.readlines(0) behaviour is inconsistent with documentation

2021-07-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25660
pull_request: https://github.com/python/cpython/pull/27113

___
Python tracker 

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



[issue43126] IOBase.readlines(0) behaviour is inconsistent with documentation

2021-07-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25661
pull_request: https://github.com/python/cpython/pull/27114

___
Python tracker 

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



[issue43126] IOBase.readlines(0) behaviour is inconsistent with documentation

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 3b5b99da4b256a31933112f4a2385386149c19e1 by andrei kulakov in 
branch 'main':
bpo-43126: Expand docs on io.IOBase.readlines() method (#27061)
https://github.com/python/cpython/commit/3b5b99da4b256a31933112f4a2385386149c19e1


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-13 Thread Paul Ganssle

Paul Ganssle  added the comment:

> In fact, you're proposing to use exit as a keyword, but lying about it to the 
> users. If it were really so important, then it _should_ be a keyword, and at 
> least I'd know that I can't use it for my variables anymore. (It's not the 
> first time such a thing would happen. The same thing happened with `async` a 
> few years ago.) But please don't introduce those "keywords just in a 
> particular context", they are horrible from the perspective of usability.

We already have so-called "soft keywords", e.g. `match`, so the horse is out of 
the barn at this point.

I'm not sure why this is closed as rejected — I don't see any decision one way 
or the other in this thread or on the PR, did I miss it?

I am struggling to understand how this is a user-hostile change; it is not 
unreasonable for a REPL to have some commands for interacting with the REPL 
which are not Python functions. I have accidentally typed `exit` instead of 
`exit()` many times, and one of the reasons I and many others like IPython is 
that `exit` exits the REPL. It has never once caused a problem for me, as far 
as I can tell. I cannot imagine that it is a common scenario for someone to 
type "exit" in order to inspect the "exit" object — it doesn't even have a 
useful repr!

The only reason you'd do this would be if you knew what it does and were 
demonstrating it, or if you were exploring what the various builtins are (which 
I think is very rare, and you'd probably only have to learn that lesson once).

Vedran's point, however, that you could do `exit = some_func()` and then type 
`exit` to try and inspect the `exit` object is a solid one. That said, I think 
we can get around this fairly easily (albeit with the cost of some additional 
complexity in the "handle the exit keyword" function) — if there's a single AST 
node that is a name and the name is "exit" or "quit", the REPL inspects locals 
and globals to see if the object referred to is a Quitter, and if so it exits, 
otherwise pass through the command as normal (possibly raising a warning like, 
"Did you mean to exit? You have shadowed the `exit` builtin, so use 
Ctrl-Z/Ctrl-D to exit or delete your `exit` object and try again").

I understand the arguments for purity and explicability and I'm often one of 
the first people to argue for keeping things consistent and understandable, but 
this is one of those things where we could significantly improve user 
experience for no practical cost. We can identify with very high certainty the 
situations in which a user intended to exit the REPL, we should go ahead and do 
it to provide a more intuitive REPL experience.

--

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-13 Thread Paul Ganssle


Paul Ganssle  added the comment:

At this point I think we should probably start a thread on python-dev to see 
how people feel about it. I'd be happy to author or co-author a PEP for this if 
need be.

--

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Guido van Rossum


Guido van Rossum  added the comment:

Converting None to type(None) is fine, as long as the str() /repr()
converts it back, e.g. repr(int | None) should print just that, not
NoneType.--
--Guido (mobile)

--

___
Python tracker 

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



[issue44514] configparser.rst & bz2.rst leave temp files after 'make doctest'

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 105e6cd67cc793c971b3e83daa87d36516fcba28 by Miss Islington (bot) 
in branch '3.9':
bpo-44514: Add doctest testcleanup for configparser and bz2 (GH-26909) (#27111)
https://github.com/python/cpython/commit/105e6cd67cc793c971b3e83daa87d36516fcba28


--

___
Python tracker 

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



[issue44514] configparser.rst & bz2.rst leave temp files after 'make doctest'

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset f514addfbc637a42549ddc422b35b6caad2a4363 by Miss Islington (bot) 
in branch '3.10':
bpo-44514: Add doctest testcleanup for configparser and bz2 (GH-26909) 
(GH-27112)
https://github.com/python/cpython/commit/f514addfbc637a42549ddc422b35b6caad2a4363


--

___
Python tracker 

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



[issue44514] configparser.rst & bz2.rst leave temp files after 'make doctest'

2021-07-13 Thread Łukasz Langa

Change by Łukasz Langa :


--
resolution:  -> fixed
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



[issue38741] Definition of multiple ']' in header configparser

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 1cc6769e4146951d47528a97e56ba1e8e9ee7fc1 by Miss Islington (bot) 
in branch '3.10':
bpo-38741: Definition of multiple ']' in header configparser (GH-17129) (#27110)
https://github.com/python/cpython/commit/1cc6769e4146951d47528a97e56ba1e8e9ee7fc1


--

___
Python tracker 

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



[issue44514] configparser.rst & bz2.rst leave temp files after 'make doctest'

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Kevin! ✨ 🍰 ✨

--

___
Python tracker 

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



[issue38741] Definition of multiple ']' in header configparser

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:

Since I got to this only now, we can include the fix in main (3.11) and 3.10. 
It's too late in the cycle for 3.9.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11 -Python 3.9

___
Python tracker 

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



[issue43126] IOBase.readlines(0) behaviour is inconsistent with documentation

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 9b369c952cbefb064dda6cb781e66cc1b793fffa by Miss Islington (bot) 
in branch '3.10':
bpo-43126: Expand docs on io.IOBase.readlines() method (GH-27061) (GH-27113)
https://github.com/python/cpython/commit/9b369c952cbefb064dda6cb781e66cc1b793fffa


--

___
Python tracker 

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



[issue43126] IOBase.readlines(0) behaviour is inconsistent with documentation

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset a3d20bfee38c71df88d69064d47fe98a1d59e624 by Miss Islington (bot) 
in branch '3.9':
bpo-43126: Expand docs on io.IOBase.readlines() method (GH-27061) (#27114)
https://github.com/python/cpython/commit/a3d20bfee38c71df88d69064d47fe98a1d59e624


--

___
Python tracker 

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



[issue43126] IOBase.readlines(0) behaviour is inconsistent with documentation

2021-07-13 Thread Łukasz Langa

Change by Łukasz Langa :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue43126] IOBase.readlines(0) behaviour is inconsistent with documentation

2021-07-13 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Andrei! ✨ 🍰 ✨

--

___
Python tracker 

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



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Jonathan Fine


New submission from Jonathan Fine :

On Linux
>>> help(open('/dev/zero').writelines)
gives


However
https://docs.python.org/3/library/io.html#io.IOBase.writelines
gives

Write a list of lines to the stream. Line separators are not added, so it is 
usual for each of the lines provided to have a line separator at the end.

See also request that writelines support a line separator.
https://mail.python.org/archives/list/python-id...@python.org/thread/A5FT7SVZBYAJJTIWQFTFUGNSKMVQNPVF/#A5FT7SVZBYAJJTIWQFTFUGNSKMVQNPVF

--
assignee: docs@python
components: Documentation
messages: 397414
nosy: docs@python, jfine2358
priority: normal
severity: normal
status: open
title: help(open('/dev/zero').writelines) gives no help
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Paul Moore


Paul Moore  added the comment:

It does for me:

>>> help(open("nul").writelines)
Help on built-in function writelines:

writelines(lines, /) method of _io.TextIOWrapper instance
Write a list of lines to stream.

Line separators are not added, so it is usual for each of the
lines provided to have a line separator at the end.

This is Windows, Python 3.9. What version did you get the problem with? If it's 
older, I'd say the problem has likely since been fixed.

--
nosy: +paul.moore

___
Python tracker 

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



[issue44624] Script name for venv PowerShell activate

2021-07-13 Thread Paul Watson


New submission from Paul Watson :

In the venv .\Scripts directory. the name 'Activate.ps1' does not conform to 
the PowerShell prescribed Verb-Noun format.

How about using 'Initialize-Python.ps1' as the script name? Or, something else 
that does conform to PowerShell standard naming.

--
components: Installation
messages: 397416
nosy: Paul Watson
priority: normal
severity: normal
status: open
title: Script name for venv PowerShell activate
type: enhancement

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Ken Jin


Ken Jin  added the comment:

@Serhiy, can I work on converting None to type(None) please?

--

___
Python tracker 

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



[issue44355] Allow spaces in format strings

2021-07-13 Thread Jean Abou Samra


Jean Abou Samra  added the comment:

Maybe leave the current state, keeping backwards compatibility, but improve the 
error message by adding "perhaps you wanted no spaces in the format field?" 
when the_field.replace(" ", "") would be valid?

--
nosy: +Jean_Abou_Samra

___
Python tracker 

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



[issue42073] classmethod does not pass "type/owner" when invoking wrapped __get__

2021-07-13 Thread Łukasz Langa

Change by Łukasz Langa :


--
nosy: +lukasz.langa
nosy_count: 4.0 -> 5.0
pull_requests: +25662
pull_request: https://github.com/python/cpython/pull/27115

___
Python tracker 

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



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2021-07-13 Thread Łukasz Langa

Change by Łukasz Langa :


--
nosy: +lukasz.langa
nosy_count: 11.0 -> 12.0
pull_requests: +25663
pull_request: https://github.com/python/cpython/pull/27115

___
Python tracker 

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



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Zachary Ware


Zachary Ware  added the comment:

I also can't reproduce this with a fresh build of 3b5b99da4b on Linux.

--
nosy: +zach.ware
resolution:  -> works for me
status: open -> pending

___
Python tracker 

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



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Jonathan Fine


Jonathan Fine  added the comment:

I used my default Python, which is Python 3.6. However, with 3.7 and 3.8 I get 
the same as Paul.

So I'm closing this as 'not a bug' (as there's not an already-fixed option for 
closing).

--
resolution: works for me -> not a bug
status: pending -> open

___
Python tracker 

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



[issue43124] [security] smtplib multiple CRLF injection

2021-07-13 Thread R. David Murray


R. David Murray  added the comment:

This bug report starts with "a malicious user with direct access to 
`smtplib.SMTP(..., local_hostname, ..)", which is a senseless supposition.  
Anyone with "access to" the SMTP object could just as well be talking directly 
to the SMTP server and do anything they want that SMTP itself allows.

The concern here is that data a program might obtain *from unsanitized user 
input* could be used to do header injection.  The "proof of concept" does not 
address this at all.  We'd need to see a scenario under which data that could 
reasonably be derived from user input ends up being passed as arguments to an 
smtplib method that calls putcmd with arguments.

So, I would rate this as *very* low impact issue, unless someone has an *actual 
example* of code using smtplib that passes user input through to smtplib 
commands in an exploitable way.

That said, it is perfectly reasonable to be proactive here and prevent 
scenarios we haven't yet thought of, by doing as recommended (and a bit more) 
by raising a ValueError if 'args' in the putcmd call contain either \n or \r 
characters.  I don't think we need to check 'cmd', because I can't see any 
scenario in which the SMTP command would be derived from user input.  If you 
want to be *really* paranoid you could check cmd too, and since it will always 
be a short string the additional performance impact will be minor.

--
type: performance -> security
versions: +Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

Related 2005 python-dev discussion: 
https://mail.python.org/archives/list/python-...@python.org/thread/VNGY2DLML4QJUXE73JLVBIH5WFBZNIKG/

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43124] [security] smtplib multiple CRLF injection

2021-07-13 Thread R. David Murray


R. David Murray  added the comment:

s/header injection/command injection/

--

___
Python tracker 

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



[issue44624] Script name for venv PowerShell activate

2021-07-13 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue44625] Python C API version of `fractions` module

2021-07-13 Thread Azat Ibrakov


New submission from Azat Ibrakov :

Are there any plans for implementing `fractions` module in C (like  for 
`decimal` there is a 
https://github.com/python/cpython/blob/main/Modules/_decimal/_decimal.c module)?
I've implemented one myself (https://github.com/lycantropos/cfractions) and 
from benchmarks (available at https://stackoverflow.com/a/67821911/5997596) we 
can see that it can be faster that current pure Python implementation.

--
messages: 397424
nosy: lycantropos
priority: normal
severity: normal
status: open
title: Python C API version of `fractions` module

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

and the related issue: https://bugs.python.org/issue1446372

--

___
Python tracker 

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



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Zachary Ware


Zachary Ware  added the comment:

Even with 3.6 I get a different result:

```
Python 3.6.13 (tags/v3.6.13:aa73e1722e, Mar 23 2021, 15:45:49) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help(open('/dev/zero').writelines)
Help on built-in function writelines:

writelines(lines, /) method of _io.TextIOWrapper instance

```

This appears to be because TextIOWrapper.writelines just didn't have a 
docstring in 3.6.  I can't explain why `help` just gave you the repr of the 
method, though.

--
resolution: not a bug -> works for me
stage:  -> 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



[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Zachary Ware


Change by Zachary Ware :


--
versions: +Python 3.6 -Python 3.11

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-13 Thread Paul Ganssle


Paul Ganssle  added the comment:

Re-opening this because I think the discussion is not done and I don't see any 
reason why this was rejected.

> Related 2005 python-dev discussion: 
> https://mail.python.org/archives/list/python-...@python.org/thread/VNGY2DLML4QJUXE73JLVBIH5WFBZNIKG/

@Mark Thanks for digging these up! From what I can tell, that discussion ended 
up with a combination of there not being quite enough enthusiasm for the idea 
to drive it forward and no one coming up with a good way to localize the effect 
to just the case where we know the person was trying to type "exit" in a REPL.

I think Pablo's patch shows that a very limited addition to the "REPL layer" is 
actually plausible, and we *could* implement this without taking on an enormous 
amount of additional complexity or affecting non-interactive use cases.

Fernando's point about it being dangerous to generalize this additional layer 
of "interactive-use only" keywords is a good one (see: 
https://mail.python.org/archives/list/python-...@python.org/message/L37RD7SG26IOBETPI7TETKFGHPAPC75Q/),
 though it seems that it was this thread that prompted him to add exit/quit as 
auto-call magic keywords to IPython, and I think that has worked out in the 
intervening 16 years. I don't think there's much danger of us wanting to 
generalize this concept, since the only really compelling argument for doing it 
this way for exit/quit is that almost everyone seems to think it *should* work 
this way (despite it never having worked this way, and there not being any 
equivalents), and gets tripped up when it doesn't.

> and the related issue: https://bugs.python.org/issue1446372

Looks to me like that is an issue for adding the message when you type "exit". 
There's no additional discussion disqualifying the use of "exit" as an 
interactive-only keyword.

--
resolution: rejected -> 
status: closed -> open

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-13 Thread Paul Ganssle


Change by Paul Ganssle :


--
stage: resolved -> 

___
Python tracker 

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



[issue44604] [Enhancement] Asyncio task decorator to provide interface to define async DAGs (similar to dask's delayed interface)

2021-07-13 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I'm not convinced why @task decorator should be a part of asyncio.

You can provide the implementation as a part of some third-party library on 
pypy.org. Looks like it doesn't require any change of asyncio itself.

--

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-13 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +25664
pull_request: https://github.com/python/cpython/pull/27117

___
Python tracker 

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



[issue44625] Python C API version of `fractions` module

2021-07-13 Thread Mark Dickinson


Mark Dickinson  added the comment:

No, no plans. There are tradeoffs here - the extra speed comes at the expense 
of increased maintenance burden. (It's certainly much harder to make minor 
changes and fixes to the decimal module now that it's written in C.)

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

3. There is also a crash in isinstance():

>>> class BadMeta(type):
... def __instancecheck__(cls, inst):
... 1/0
... 
>>> x = int | BadMeta('A', (), {})
>>> isinstance([], x)
Fatal Python error: _Py_CheckFunctionResult: a function returned a result with 
an exception set
Python runtime state: initialized
Traceback (most recent call last):
  File "", line 3, in __instancecheck__
ZeroDivisionError: division by zero

The above exception was the direct cause of the following exception:

SystemError:  returned a result with an exception set

Current thread 0x7f024beb1280 (most recent call first):
  File "", line 1 in 
Aborted (core dumped)

--

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
type: behavior -> crash

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 27120 fixes __instancecheck__ and __subclasscheck__. Converting None to 
type(None) will be done in other PR.

--

___
Python tracker 

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



[issue44606] Discrepancy between isinstance() and issubclass() for union types

2021-07-13 Thread Ken Jin


Ken Jin  added the comment:

> 3. There is also a crash in isinstance():

That's unfortunate :(.

Serhiy, thanks for catching all these bugs in union. I recently realized you 
probably made 50% of all bug reports for union and they're very much 
appreciated :).

> Converting None to type(None) will be done in other PR.

Alright. Do tell me if you're too busy and want me to take it up instead. I'll 
be glad to help.

--

___
Python tracker 

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



[issue43124] [security] smtplib multiple CRLF injection

2021-07-13 Thread Martin Ortner


Martin Ortner  added the comment:

> This bug report starts with "a malicious user with direct access to 
> `smtplib.SMTP(..., local_hostname, ..)", which is a senseless supposition.  
> Anyone with "access to" the SMTP object could just as well be talking 
> directly to the SMTP server and do anything they want that SMTP itself allows.

Let's not argue about the phrasing and settle on the fact that I am not a 
native English speaker which might be the root cause of the confusion. The core 
of the issue is that this *unexpected side-effect* may be security-relevant. 
Fixing it probably takes less time than arguing about phrasing, severity, or 
spending time describing exploitation scenarios for a general-purpose library 
that should protect the underlying protocol from injections. 


Be kind, I come in peace.

--

___
Python tracker 

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



[issue44626] Incorrect tracing of nested if/if/for/yield

2021-07-13 Thread Ned Batchelder


New submission from Ned Batchelder :

In Python 3.10, this code is traced incorrectly. I don't know if there's a 
simpler format that would show the problem. This code is already simplified 
from https://github.com/nedbat/coveragepy/issues/1188.

--
import linecache, sys

def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, 
lineno).rstrip()))
return trace

print(sys.version)
sys.settrace(trace)

def f(a, p, z):
if p:
print(f"{a=}")
if a:
if z:
for x in [1,2]:
yield x
else:
for x in [1,2]:
yield x
else:
print("nope")

import itertools

for a, p, z in itertools.product([0, 1], repeat=3):
list(f(a, p, z))


Running this with 3.10.0b4 produces this output. The starred lines show a is 
false, but tracing then indicates a line which is not executed:

  3.10.0b4 (default, Jul 11 2021, 13:51:53) [Clang 12.0.0 (clang-1200.0.32.29)]
  call 13: def f(a, p, z):
  line 14: if p:
  line 24: print("nope")
  nope
  retu 24: print("nope")
  call 13: def f(a, p, z):
  line 14: if p:
  line 24: print("nope")
  nope
  retu 24: print("nope")
  call 13: def f(a, p, z):
  line 14: if p:
  line 15: print(f"{a=}")
  a=0
* line 16: if a:
  line 22: yield x
  retu 22: yield x
  call 13: def f(a, p, z):
  line 14: if p:
  line 15: print(f"{a=}")
  a=0
* line 16: if a:
  line 22: yield x
  retu 22: yield x
  call 13: def f(a, p, z):
  line 14: if p:
  line 24: print("nope")
  nope
  retu 24: print("nope")
  call 13: def f(a, p, z):
  line 14: if p:
  line 24: print("nope")
  nope
  retu 24: print("nope")
  call 13: def f(a, p, z):
  line 14: if p:
  line 15: print(f"{a=}")
  a=1
  line 16: if a:
  line 17: if z:
  line 21: for x in [1,2]:
  line 22: yield x
  retu 22: yield x
  call 22: yield x
  line 21: for x in [1,2]:
  line 22: yield x
  retu 22: yield x
  call 22: yield x
  line 21: for x in [1,2]:
  line 22: yield x
  retu 22: yield x
  call 13: def f(a, p, z):
  line 14: if p:
  line 15: print(f"{a=}")
  a=1
  line 16: if a:
  line 17: if z:
  line 18: for x in [1,2]:
  line 19: yield x
  retu 19: yield x
  call 19: yield x
  line 18: for x in [1,2]:
  line 19: yield x
  retu 19: yield x
  call 19: yield x
  line 18: for x in [1,2]:
  retu 18: for x in [1,2]:

--
components: Interpreter Core
keywords: 3.10regression
messages: 397434
nosy: Mark.Shannon, nedbat
priority: normal
severity: normal
status: open
title: Incorrect tracing of nested if/if/for/yield
type: behavior
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



[issue44627] Python terminal cmd line recall

2021-07-13 Thread jg


New submission from jg :

Command line recall in python terminal treats strings case insensitively.

Example:
Define a 'dummy' function that takes a string as input. If you run dummy twice 
with the same input string, but different cases, it only saves one.
>>> dummy("This is a test") # run this
>>> dummy("THIS IS A TEST") # run again w/ different string
Now if you try cmd recall, it only recalls the first.
I believe it should recall both.
Maybe it's treating one as a duplicate - erroneously?

--
components: Windows
messages: 397435
nosy: jggammon, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python terminal cmd line recall
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue44628] Remove the broken link for issue #445902 in unixcompiler.py (distutils)

2021-07-13 Thread Leonardo Freua


New submission from Leonardo Freua :

There is a broken link in the docstring of the runtime_library_dir_option() 
method of the UnixCCompiler class.

See the broken link below:
http://sourceforge.net/tracker/index.php?func=detail&aid=445902&group_id=5470&atid=105470

And the link that is working for this same issue:
https://bugs.python.org/issue445902

I will send a PR removing the link, leaving without it, as there is already 
exists the issue ID in the docstring.

--
components: Library (Lib)
messages: 397436
nosy: Leonardofreua
priority: normal
severity: normal
status: open
title: Remove the broken link for issue #445902 in unixcompiler.py (distutils)
versions: Python 3.11

___
Python tracker 

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



[issue44604] [Enhancement] Asyncio task decorator to provide interface to define async DAGs (similar to dask's delayed interface)

2021-07-13 Thread Art


Art  added the comment:

I understand the hesitation to add this to the library, however I'd like to 
make a case for why I believe that it fits. To start this is my understanding 
of the scope of asyncio (or at least part of the scope, taken from the asyncio 
docs):

asyncio provides a set of high-level APIs to:
- run Python coroutines concurrently and have full control over their execution;
- perform network IO and IPC;
- control subprocesses;
- distribute tasks via queues;
- synchronize concurrent code;

I believe this decorator would be another high-level api that would be 
considered a valid, useful, simple, and if it was more well-known, popular, 
method of exerting "full control over their execution".

Here's an example of a few places from around the internet where people are 
asking how to do something that would directly benefit from this API, and where 
I believe frankly that this API would provide a much cleaner/better solution 
than those proposed.

https://old.reddit.com/r/learnpython/comments/oi3ueo/how_do_you_use_asyncio_to_do_this/
(inspiration for demo solution provided above)
https://stackoverflow.com/questions/58581270/what-is-the-cleanest-way-to-write-and-run-a-dag-of-tasks
(user specifies their tasks are IO bound and that they tried to use 
asyncio, but to no avail, or it was too complicated)

In both these cases above, it is explicitly implied that the user tried to use 
asyncio to solve their problem, but could not find a satisfactory way to do so.

Here's a few more examples of asyncio code, that aren't as directly related to 
the issue at hand, but would greatly benefit from this isolated "task" 
structure.

https://stackoverflow.com/questions/58905515/how-to-ensure-python-s-asyncio-library-executes-tasks-in-depth-first-search-orde
(user trying to build/execute a DAG of async tasks)
https://stackoverflow.com/questions/67481509/how-should-i-design-a-concurrency-pipeline-with-asyncio
(user could/should consider their task pipeline as a DAG which would 
conceptually simplify what they are trying to achieve)

To directly address the concern of "why add this to asyncio, and not a 
third-party library".
1) I believe this falls into the scope of the library as demonstrated in the 
first paragraph of this comment
2) Users look to and trust asyncio to provide good high level apis to build 
better code/systems (As you can see from some of the examples I posted above)
3) This is a very simple high-level api, that will not interfere with anything 
else in the library. Will introduce no compatibility issues
4) This point is conjecture, but I believe that this api will keep users from 
unnecessarily moving their workflows to other libraries like dask (which I love 
and contribute too) or airflow as you can see from some of the examples where 
users claim to try other libraries for something that asyncio could easily 
handle.
5) Inclusion in asyncio (over a third-party library) would provide faster, more 
reputable exposure to users of a great method of thinking about/solving their 
problems.

I hope you'll re-consider your position, but completely understand if not, in 
which case I'll close this issue.

--

___
Python tracker 

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



[issue44628] Remove the broken link for issue #445902 in unixcompiler.py (distutils)

2021-07-13 Thread Leonardo Freua


Change by Leonardo Freua :


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

___
Python tracker 

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



[issue44604] [Enhancement] Asyncio task decorator to provide interface to define async DAGs (similar to dask's delayed interface)

2021-07-13 Thread Art


Art  added the comment:

Note: regarding my inclusion of "airflow" in point #4 above. I in no way 
believe that airflow is a viable alternative to this proposal. I included it 
because one of those posts I linked explicitly mentioned that they looked into 
it as an alternative.

--

___
Python tracker 

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



[issue44626] Incorrect tracing of nested if/if/for/yield

2021-07-13 Thread Sergey B Kirpichev


Change by Sergey B Kirpichev :


--
nosy: +Sergey.Kirpichev

___
Python tracker 

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



[issue44572] Calls to platform._syscmd_ver() dependent functions consume STDIN

2021-07-13 Thread Steve Dower


Steve Dower  added the comment:


New changeset 0ee0a740e12ec8568aafa033aa6bb08b265afe26 by Konstantin-Glukhov in 
branch 'main':
bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent 
erroneous STDIN consumption (GH-27092)
https://github.com/python/cpython/commit/0ee0a740e12ec8568aafa033aa6bb08b265afe26


--

___
Python tracker 

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



[issue12178] csv writer doesn't escape escapechar

2021-07-13 Thread Sebastian Bank


Sebastian Bank  added the comment:

Thanks Tal.

AFAICT there was an undocumented change in behaviour related to this fix.

Python 3.9 quotes values with escapechar:

```
import csv
import io

kwargs = {'escapechar': '\\'}

value = 'spam\\eggs'

print(value)

with io.StringIO() as buf:
writer = csv.writer(buf, **kwargs)
writer.writerow([value])
line = buf.getvalue()

print(line.strip())

with io.StringIO(line) as buf:
reader = csv.reader(buf, **kwargs)
(new_value,), = reader

print(new_value)
spam\eggs
"spam\eggs"
spameggs
```

- quotes escapechar
- fails to double the escapechar (this bug)

Btw, from
https://docs.python.org/3/library/csv.html#csv.QUOTE_MINIMAL

> only quote those fields which contain special characters
> such as delimiter, quotechar or any of the characters in lineterminator.

this seems incorrect because escapechar is not mentioned (but at the same time 
it says 'such as') and maybe better matching the name 'minimal' (or one might 
expect 'more' quoting as a better default).

Python 3.10:

https://github.com/python/cpython/blob/5c0eed7375fdd791cc5e19ceabfab4170ad44062/Lib/test/test_csv.py#L207-L208

See also https://github.com/xflr6/csv23/actions/runs/1027687524

--

___
Python tracker 

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



[issue44572] Calls to platform._syscmd_ver() dependent functions consume STDIN

2021-07-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +25667
pull_request: https://github.com/python/cpython/pull/27124

___
Python tracker 

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



[issue44572] Calls to platform._syscmd_ver() dependent functions consume STDIN

2021-07-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25668
pull_request: https://github.com/python/cpython/pull/27125

___
Python tracker 

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



[issue44629] Some files from distutils module are importing all exceptions unnecessarily

2021-07-13 Thread Leonardo Freua


New submission from Leonardo Freua :

Some files from the distutils module are importing all the exceptions from the 
errors.py file unnecessarily, when in fact only a few of the Exception classes 
are used.

Could I open a PR by fixing the files that are making these unnecessary 
imports? Or is this problem in the same category as f-String refactorings?

--
components: Library (Lib)
messages: 397441
nosy: Leonardofreua
priority: normal
severity: normal
status: open
title: Some files from distutils module are importing all exceptions 
unnecessarily
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue43948] sysconfig's osx_framework_user puts headers in different locations from distutils

2021-07-13 Thread Tzu-ping Chung


Tzu-ping Chung  added the comment:

Personally I am not very surprised. The scenario (installing a package to the 
user scheme of a macOS Framework build) is quite obscure on its own, and AFAIK 
no third-party package installers is currently using sysconfig. Both pip and 
setuptools use distutils, and everything else uses one of them to perform the 
installation indirectly.

--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2021-07-13 Thread Jay Swanson


Jay Swanson  added the comment:

I know this is closed, but is it possible that the ARM64EC support coming in 
Windows 11 that allows mixed native/emulated code is something that would help 
this along? That along with the sunsetting of 32-bit systems.

--
nosy: +jay.swanson

___
Python tracker 

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



[issue44572] Calls to platform._syscmd_ver() dependent functions consume STDIN

2021-07-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 425756abdc03263ab3a52b068befd1ddb16c2dd2 by Miss Islington (bot) 
in branch '3.10':
bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent 
erroneous STDIN consumption (GH-27092) (GH-27124)
https://github.com/python/cpython/commit/425756abdc03263ab3a52b068befd1ddb16c2dd2


--
nosy: +pablogsal

___
Python tracker 

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



[issue34292] test_compile hangs in AMD Ubuntu buildbots

2021-07-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> out of date
stage:  -> 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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2021-07-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> out of date
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



[issue38842] test_multiprocessing_spawn altered the execution environment in AMD64 FreeBSD Non-Debug 3.x

2021-07-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> out of date
stage:  -> 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



[issue34388] collect_gdb fails for test.pythoninfo in several AMD64 FreeBSD buildbots

2021-07-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> out of date
stage:  -> 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



[issue43950] Include column offsets for bytecode instructions

2021-07-13 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests: +25669
pull_request: https://github.com/python/cpython/pull/27126

___
Python tracker 

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



[issue33346] Syntax error with async generator inside dictionary comprehension

2021-07-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 054e9c84ac7c394941bba3ea1829d14dce1243fc by Serhiy Storchaka in 
branch 'main':
bpo-33346: Allow async comprehensions inside implicit async comprehensions 
(GH-6766)
https://github.com/python/cpython/commit/054e9c84ac7c394941bba3ea1829d14dce1243fc


--
resolution:  -> fixed
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



[issue44630] Assertion failure in csv module

2021-07-13 Thread Thomas Wouters


New submission from Thomas Wouters :

The csv module has some incorrect exception handling when dealing with dialect 
objects that are not csv.Dialect subclasses (or that otherwise raise errors 
when accessing the dialect attributes):

>>> csv.reader([], dialect=None)
python: ../../cpython/Objects/typeobject.c:3820: _PyType_Lookup: Assertion 
`!PyErr_Occurred()' failed.
Aborted

The problem is Modules/_csv.c tries to cater to dialects that lack the 
attributes it wants to access, but does so by leaving exceptions set between 
calls to PyObject_SetAttrString(). Since 3.7, that causes assertion failures. 
(I have a PR with a fix.)

--
assignee: twouters
components: Extension Modules
messages: 397446
nosy: gregory.p.smith, twouters
priority: normal
severity: normal
status: open
title: Assertion failure in csv module
type: crash
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue44627] Python terminal cmd line recall

2021-07-13 Thread Eryk Sun


Eryk Sun  added the comment:

By default, reading input from the console uses the console's built-in 
command-line editor. You can clear the console input history with Alt+F7; 
display the history list with F7; navigate in the history list with the up and 
down arrow keys, even when the list isn't displayed; recall the first and last 
entries of the list with page up and page down; and cycle through matching 
command completions with F8.

Having said that, the new implementation of the console in Windows 10 has a bug 
in the "Discard Old Duplicates" history option [1]. Try disabling this option 
in the console's "Properties" dialog, which can be accessed from the Alt+Space 
control menu.

---
[1] https://github.com/microsoft/terminal/issues/4186

--
nosy: +eryksun

___
Python tracker 

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



[issue44630] Assertion failure in csv module

2021-07-13 Thread Thomas Wouters


Change by Thomas Wouters :


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

___
Python tracker 

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



[issue44631] Refactoring the repr() of the _Environ class (os module)

2021-07-13 Thread Leonardo Freua


New submission from Leonardo Freua :

Currently, the repr() code of the _Environ class does many things in a bunched 
way, making it difficult to read and difficult to determine the result returned 
by the method.

Therefore, I propose an adjustment in the code to make it more readable, as 
well as your test.

--
components: Library (Lib)
messages: 397448
nosy: Leonardofreua
priority: normal
severity: normal
status: open
title: Refactoring the repr() of the _Environ class (os module)
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue44631] Refactoring the repr() of the _Environ class (os module)

2021-07-13 Thread Leonardo Freua


Change by Leonardo Freua :


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

___
Python tracker 

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



[issue44604] [Enhancement] Asyncio task decorator to provide interface to define async DAGs (similar to dask's delayed interface)

2021-07-13 Thread Yury Selivanov


Yury Selivanov  added the comment:

Yeah, I'm also not convinced this has to be part of asyncio, especially since 
we'll likely have task groups in 3.11.

--

___
Python tracker 

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



[issue44630] Assertion failure in csv module

2021-07-13 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 0093876328afa330224c9d887c18dee0b3117852 by T. Wouters in branch 
'main':
bpo-44630: Fix assertion errors in csv module (GH-27127)
https://github.com/python/cpython/commit/0093876328afa330224c9d887c18dee0b3117852


--

___
Python tracker 

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



[issue38278] Need a more efficient way to perform dict.get(key, default)

2021-07-13 Thread Irit Katriel


Irit Katriel  added the comment:

> Was LOAD_METHOD optimized for builtin methods?


Maybe this can be done with specialization.

--
nosy: +Mark.Shannon, gvanrossum, iritkatriel

___
Python tracker 

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



[issue44630] Assertion failure in csv module

2021-07-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +25672
pull_request: https://github.com/python/cpython/pull/27129

___
Python tracker 

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



[issue44630] Assertion failure in csv module

2021-07-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25673
pull_request: https://github.com/python/cpython/pull/27130

___
Python tracker 

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



  1   2   >