[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a6825197e9f2bd730d8da38f223608411e508695 by Miss Islington (bot) 
in branch '3.10':
bpo-44151: Various grammar, word order, and markup fixes (GH-26344) (GH-26345)
https://github.com/python/cpython/commit/a6825197e9f2bd730d8da38f223608411e508695


--

___
Python tracker 

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



[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24937
pull_request: https://github.com/python/cpython/pull/26345

___
Python tracker 

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



[issue39816] More descriptive error message than "too many values to unpack"

2021-05-24 Thread malcomvx


malcomvx  added the comment:

Python functions can return multiple variables . These variables can be stored 
in variables directly. This is a unique property of Python , other programming 
languages such as C++ or Java do not support this by default.

The valueerror: too many values to unpack occurs during a multiple-assignment 
where you either don't have enough objects to assign to the variables or you 
have more objects to assign than variables. If for example myfunction() 
returned an iterable with three items instead of the expected two then you 
would have more objects than variables necessary to assign to.

http://net-informations.com/python/err/value.htm

--
nosy: +malcomvx

___
Python tracker 

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



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Mallika Bachan


Mallika Bachan  added the comment:

Conceptually, yes, but the function does return an index, and values are
stored at these indices. The index it returns holds the leftmost occurrence
of the target (should the target exist)
>>> bisect.bisect_left([1,2,2,3],2)
1
If we insert at this index, it will push the current value right, so
conceptually, sure, it can help to think of the insertion point as being
just before the leftmost target value.

But while bisect_right does in fact return value i that "points just beyond
the rightmost x already there" ("just beyond" gets interpreted as "the next
one", because only whole indices are used), making the statement "i points
just before the leftmost x already there" for the return value of
bisect_left definitely appears incorrect.

On Mon, May 24, 2021 at 6:30 PM Raymond Hettinger 
wrote:

>
> Raymond Hettinger  added the comment:
>
> I there is a misunderstanding here.  The bisect functions never point *to*
> a value.  Instead, they are documented to return "insertion points".  Those
> always occur just before or after a specific value:
>
> values:  10   20   30   30   30   40   50
> insertion points:   |   |||||||
> 0   1234567
> bisect_left(30) -^
> bisect_right(30) ---^
>
> As you can see, bisect_left() does in fact point JUST BEFORE the 30.
>
> Note this is also how slicing works.  Here's an example:
>
> >>> from bisect import bisect_left, bisect_right
> >>> s = [10, 20, 30, 30, 30, 40, 50]
> >>> i = bisect_left(s, 30)
> >>> j = bisect_right(s, 30)
> >>> s[i : j]
> [30, 30, 30]
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40172] ZipInfo corrupts file names in some old zip archives

2021-05-24 Thread Daniel Hillier

Daniel Hillier  added the comment:

zipfile decodes filenames using cp437 or unicode and encodes using ascii or 
unicode. It seems like zipfile has a preference for writing filenames in 
unicode rather than cp437. Is zipfile's preference for writing filenames in 
unicode rather than cp437 intentional?

Is the bug you're seeing related to using zipfile to open and rewrite old zips 
and not being able to open the rewritten files in an old program that doesn't 
support the unicode flag?

We could address this two ways:
- Change ZipInfo._encodeFilenameFlags() to always encode to cp437 if possible
- Add a flag to write filenames in cp437 or unicode, otherwise the current 
situation of ascii or unicode

I guess the choice will depend on if preferring unicode rather than cp437 is 
intentional and if writing filenames in cp437 will break anything (it shouldn't 
break anything according to Appendix D of 
https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT)

Here's a test for your current patch (I'd probably put it alongside 
OtherTests.test_read_after_write_unicode_filenames as this test was adapted 
from that one)

class OtherTests(unittest.TestCase):
...

def test_read_after_write_cp437_filenames(self):
fname = 'test_cp437_é'
with zipfile.ZipFile(TESTFN2, 'w') as zipfp:
zipfp.writestr(fname, b'sample')

with zipfile.ZipFile(TESTFN2) as zipfp:
zinfo = zipfp.infolist()[0]
# Ensure general purpose bit 11 (Language encoding flag
# (EFS)) is unset to indicate the filename is not unicode
self.assertFalse(zinfo.flag_bits & 0x800)
self.assertEqual(zipfp.read(fname), b'sample')

--
nosy: +dhillier

___
Python tracker 

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



[issue43109] When using Apple Clang, --with-lto builds should not check for llvm-ar

2021-05-24 Thread Ned Deily


Ned Deily  added the comment:


New changeset 3af61a7176a68bfeb349eeed314b9c3d7ebc3ad5 by Miss Islington (bot) 
in branch '3.9':
bpo-43109: Fix --with-lto configure option on macOS (GH-26341) (GH-26343)
https://github.com/python/cpython/commit/3af61a7176a68bfeb349eeed314b9c3d7ebc3ad5


--

___
Python tracker 

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



[issue43109] When using Apple Clang, --with-lto builds should not check for llvm-ar

2021-05-24 Thread miss-islington


miss-islington  added the comment:


New changeset 25a9cf197ea0d77abd49992a7751efa0046bb1e6 by Miss Islington (bot) 
in branch '3.10':
bpo-43109: Fix --with-lto configure option on macOS (GH-26341)
https://github.com/python/cpython/commit/25a9cf197ea0d77abd49992a7751efa0046bb1e6


--

___
Python tracker 

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



[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +24936
pull_request: https://github.com/python/cpython/pull/26344

___
Python tracker 

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



[issue5758] fileinput.hook_compressed returning bytes from gz file

2021-05-24 Thread Inada Naoki


Inada Naoki  added the comment:

> I'm struggling with how to adapt the code to provide a uniform interface on 
> Python 3.6+.

It's easy. Just passing `mode="rb"`.

```
FileInput(filelist, mode="rb", openhook=fileinput.hook_compressed)
```

This is better than `backports.hook_compressed`, because it returns bytes 
always regardless file is compressed or uncompressed.

--

___
Python tracker 

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



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> not a bug
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



[issue42194] Docs for argparse.BooleanOptionalAction missing "New in version 3.9"

2021-05-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> How can we proceed with this doc fix?

Just make a new PR.  I'll check it in and close the old one.

--

___
Python tracker 

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



[issue42194] Docs for argparse.BooleanOptionalAction missing "New in version 3.9"

2021-05-24 Thread John Belmonte


John Belmonte  added the comment:

A PR was opened over a year ago, but the author never signed CLA.

How can we proceed with this doc fix?

--
nosy: +John Belmonte

___
Python tracker 

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



[issue43109] When using Apple Clang, --with-lto builds should not check for llvm-ar

2021-05-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24935
pull_request: https://github.com/python/cpython/pull/26343

___
Python tracker 

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



[issue43109] When using Apple Clang, --with-lto builds should not check for llvm-ar

2021-05-24 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue5758] fileinput.hook_compressed returning bytes from gz file

2021-05-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

A backport now exists (https://pypi.org/project/backports.hook_compressed) and 
addresses the issue (https://github.com/jaraco/cmdix/actions/runs/873404846).

--

___
Python tracker 

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



[issue5758] fileinput.hook_compressed returning bytes from gz file

2021-05-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

The patch for this change has broken code that relied on the old behavior. For 
example:

```
import fileinput
import bz2
import pathlib

target = pathlib.Path('data.bz2')
target.write_bytes(bz2.compress(b'Foo\nBar\nBiz'))

inp = fileinput.FileInput([str(target)], openhook=fileinput.hook_compressed)
for line in inp:
print(line.decode().strip())
```

That code passes on Python3.10a6 but on 3.10b1 fails with:

```
Traceback (most recent call last):
  File "/Users/jaraco/code/main/cmdix/text.py", line 10, in 
print(line.decode().strip())
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
```

I encountered this issue in [this function and its 
test](https://github.com/jaraco/cmdix/blob/dc5fac3817ff9815b2f8d9a1dfad4258c14b1693/cmdix/lib.py#L165-L193).

I'm struggling with how to adapt the code to provide a uniform interface on 
Python 3.6+. Perhaps a backport of hook_compressed is in order.

--
nosy: +jaraco

___
Python tracker 

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



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Mallika Bachan


Change by Mallika Bachan :


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

___
Python tracker 

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



[issue44093] compiler detection on macOS seems to be incorrect

2021-05-24 Thread Ned Deily


Change by Ned Deily :


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

___
Python tracker 

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



[issue43109] When using Apple Clang, --with-lto builds should not check for llvm-ar

2021-05-24 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +24931
pull_request: https://github.com/python/cpython/pull/26341

___
Python tracker 

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



[issue44120] logging.config.fileConfig/dictConfig can not import class

2021-05-24 Thread Hiroaki Mizuguchi


Hiroaki Mizuguchi  added the comment:

I understand. I am mistaken about class loading. I will withdraw this issue.

--

___
Python tracker 

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



[issue44228] [urllib] Error with handling of urllib.parse.quote. Terminates halfway

2021-05-24 Thread Swee Tat Lim


New submission from Swee Tat Lim :

Running this

python3 -c "import urllib.parse; print 
(urllib.parse.quote('ab$cd&efg#hij$klm'))"

Results:
ab%26efg%23hij

Expected Result:
ab%26efg%23hij%26klm

Not sure why it terminated midway

--
components: Library (Lib)
messages: 394284
nosy: sweetat
priority: normal
severity: normal
status: open
title: [urllib] Error with handling of urllib.parse.quote.  Terminates halfway
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



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I there is a misunderstanding here.  The bisect functions never point *to* a 
value.  Instead, they are documented to return "insertion points".  Those 
always occur just before or after a specific value:

values:  10   20   30   30   30   40   50
insertion points:   |   |||||||
0   1234567
bisect_left(30) -^
bisect_right(30) ---^

As you can see, bisect_left() does in fact point JUST BEFORE the 30.

Note this is also how slicing works.  Here's an example:

>>> from bisect import bisect_left, bisect_right
>>> s = [10, 20, 30, 30, 30, 40, 50]
>>> i = bisect_left(s, 30)
>>> j = bisect_right(s, 30)
>>> s[i : j]
[30, 30, 30]

--

___
Python tracker 

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



[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-05-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Here's my two cents worth on the subject.  

* I use hypothesis during development, but don't have a need for in the the 
standard library.  By the time code lands there, we normally have a specific 
idea of what edge cases needs to be in the tests.

* For the most part, hypothesis has not turned up anything useful for the 
standard library.  Most of the reports that we've gotten reflected a 
misunderstanding by the person running hypothesis rather than an actual bug.  
For example, in colorsys, an issue was reported about the color conversions not 
round-tripping, but that is an expected behavior for out of gamut conversions.  
Also, the matrices used are dictated by standards and do not give exact 
inverses even for in gamut conversions.

* For numeric code, hypothesis is difficult to use and requires many 
restrictions on the bounds of variables and error tolerances.  For example, 
when I have students with a function to evaluate the quadratic formula and test 
it with hypothesis, they struggle mightily (overflowing the discriminant, 
having 2*a close to zero, deciding whether the roots are sufficiently close, 
etc.)

* The main area where hypothesis seems easy to use and gives some comfort is in 
simple roundtrips:  assert zlib.decompress(zlib.compress(s)) == s.  However, 
that is only a small fraction of our test cases.

* Speed is another issue.  During development, it doesn't matter much if 
Hypothesis takes a lot of time exercising one function.  But in the standard 
library tests already run slow enough to impact development.  If hypothesis 
were to run everytime we run a test suite, it would make the situation worse.

* There is also a learning curve issue.  We're adding more and more things that 
newcomer's have to learn before they can contribute (how to run blurb, how to 
use the argument clinic, etc).  Using Hypothesis is a learned skill and takes 
time.

TL;DR  I really like Hypothesis but think it doesn't belong in standard library 
tests.

--
nosy: +rhettinger

___
Python tracker 

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



[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
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



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 86779878dfc0bcb74b4721aba7fd9a84e9cbd5c7 by Miss Islington (bot) 
in branch '3.10':
bpo-44151: linear_regression() minor API improvements (GH-26199) (GH-26338)
https://github.com/python/cpython/commit/86779878dfc0bcb74b4721aba7fd9a84e9cbd5c7


--

___
Python tracker 

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



[issue44227] help(bisect.bisect_left)

2021-05-24 Thread Mallika Bachan


New submission from Mallika Bachan :

Documentation issue.

help(bisect.bisect_left)
says: "... if x already appears in the list, i points just before the leftmost 
x already there."
but in fact, it actually points *to* the leftmost x already there

--
messages: 394280
nosy: mallika.bachan
priority: normal
severity: normal
status: open
title: help(bisect.bisect_left)
type: behavior
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



[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-05-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

I withdraw my objection against Hypothetlsis per se. Others should debate
whether the 3rd party dependency is okay. --
--Guido (mobile)

--

___
Python tracker 

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



[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-24 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +24930
pull_request: https://github.com/python/cpython/pull/26338

___
Python tracker 

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



[issue44206] Add a version number to dict keys.

2021-05-24 Thread STINNER Victor


STINNER Victor  added the comment:

Can't you please explain which kind of optimizations do you want to implement 
using such dict key version?

--

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread Ned Deily


Ned Deily  added the comment:

Petr's analysis and PR looked good and the PR is now merged to main and to 3.10 
for 3.10.0b2.  Thanks, Petr! Downgrading back to normal priority.

--
priority: release blocker -> normal

___
Python tracker 

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



[issue38908] Troubles with @runtime_checkable protocols

2021-05-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24929
pull_request: https://github.com/python/cpython/pull/26337

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

Ah, okay. So we're not on the hook to decide this today. :-)

--

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread miss-islington


miss-islington  added the comment:


New changeset 1c454eb2e4eb9e08ee94920c0e1ca7c8896371ec by Miss Islington (bot) 
in branch '3.10':
bpo-41282: Fix broken `make install` (GH-26329)
https://github.com/python/cpython/commit/1c454eb2e4eb9e08ee94920c0e1ca7c8896371ec


--

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Small note, as I mentioned in my correction email 
(https://mail.python.org/archives/list/python-...@python.org/message/GBD57CUUU4K5NMQDTEZXNCX76YISEIGQ/),
 this is a release blocker for 3.11 (it was not marked in the issue what Python 
version was associated, I am doing it with this message) so this doesn't block 
the 3.10 release.

--
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



[issue40222] "Zero cost" exception handling

2021-05-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> I think we're waiting here for the release manager to decide, right?

As Petr mentions, the release manager doesn't have authority to decide if the 
backwards compatibility policy can be ignored, only the Steering Council.

> Should we roll back the change to PyCode_NewWithPosOnlyArgs() or keep it?

I don't think is possible: code objects must be constructed with the new 
argument, otherwise they are broken. There is not an easy way to have a default 
for PyCode_New and PyCode_NewWithPosOnlyArgs that somehow creates the field 
from nothing. 

I *personally* think that this case is one good example of an exception to the 
backwards compact rule, but I myself cannot grant that exception as a release 
manager. I also think these APIs should be removed from the public C-API ASAP 
because they literally conflict everytime we change the code object for 
optimizations.

--

___
Python tracker 

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



[issue42392] [document removal of] the deprecated 'loop' parameter asyncio API in 3.10

2021-05-24 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
title: remove the deprecated 'loop' parameter asyncio API -> [document removal 
of] the deprecated 'loop' parameter asyncio API in 3.10

___
Python tracker 

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



[issue42392] remove the deprecated 'loop' parameter asyncio API

2021-05-24 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue40222] "Zero cost" exception handling

2021-05-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

I think we're waiting here for the release manager to decide, right? Should we 
roll back the change to PyCode_NewWithPosOnlyArgs() or keep it?

Presumably the requested docs aren't the (beta) release blocker?

--

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 21.0 -> 22.0
pull_requests: +24928
pull_request: https://github.com/python/cpython/pull/26336

___
Python tracker 

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



[issue44222] Improving _removeHandlerRef for a very long _handlerList

2021-05-24 Thread Yonatan Goldschmidt


Yonatan Goldschmidt  added the comment:

That system has many (>10k) objects of a certain type. Each of them has a 
separate Logger object + Handlers. That was done, among other reasons, to allow 
for easy consuming of the logs relating to a particular object in a file-based 
manner.

I agree that it's not common at all (other Python projects I've worked on don't 
exhibit this behavior) but since this change is harmless I thought we might as 
well make it.

--

___
Python tracker 

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



[issue42392] remove the deprecated 'loop' parameter asyncio API

2021-05-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

There appear to be no versionchanged:: 3.10 in the asyncio docs on the APIs 
that formerly accepted a loop= parameter linking people to information on when 
that went away (3.10) and why.  Specifically I'm talking about 
https://docs.python.org/3.10/library/asyncio-stream.html.

The asyncio stack traces people will face when porting code to 3.10 are 
mystifying (they may not even show use of a loop parameter) when this comes up, 
so we should really leave more bread crumbs than expecting people to find the 
What's New doc.

```
...
Eserver = event_loop.run_until_complete(coro)
E  File 
"/opt/hostedtoolcache/Python/3.10.0-beta.1/x64/lib/python3.10/asyncio/base_events.py",
 line 641, in run_until_complete
Ereturn future.result()
E  File 
"/opt/hostedtoolcache/Python/3.10.0-beta.1/x64/lib/python3.10/asyncio/streams.py",
 line 113, in start_unix_server
Ereturn await loop.create_unix_server(factory, path, **kwds)
E  TypeError: _UnixSelectorEventLoop.create_unix_server() got an unexpected 
keyword argument 'loop'
```

Arguably something similar to that whatsnew text should've been added to the 
docs in 3.8 with the loop deprecation.  Something like this?

```
.. versionchanged:: 3.7

   This function now implicitly gets the
   current thread's running event loop.

.. versionchanged:: 3.10
   That `loop` parameter has been removed.
```

including a ReST link to more info in the whats new doc on the last entry would 
be useful.

--
nosy: +gregory.p.smith
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue44079] [sqlite3] remove superfluous statement weak ref list from connection object

2021-05-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> I'm not fully sure that the both use cases can be combined.

I'm fully sure they can :) Did I miss anything in msg393942? AFAICS, there is 
no need for the weak ref list anymore.

--

___
Python tracker 

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



[issue44226] Threads shutting down in Py 2.7 but not in Py 3.69 while making SSH connection using Paramiko module

2021-05-24 Thread Eric V. Smith


Eric V. Smith  added the comment:

This was reported a few hours ago at 
https://github.com/paramiko/paramiko/issues/1856.

I'm closing this as a third party issue.

--
nosy: +eric.smith
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



[issue40092] Crash in _PyThreadState_DeleteExcept() at fork in the process child

2021-05-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue43853] [sqlite3] Improve sqlite3_value_text() error handling

2021-05-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

The affected branch is exercised by the following tests:
- test_aggr_check_param_blob
- test_aggr_check_param_float
- test_aggr_check_param_int
- test_aggr_check_param_none
- test_aggr_check_param_str
- test_aggr_check_params_int
- test_aggr_exception_in_finalize
- test_aggr_exception_in_step
- test_aggr_no_finalize
- test_param_string

I've expanded test_aggr_check_param_str and test_param_string to also check 
empty strings.

--

___
Python tracker 

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



[issue42654] Add folder for python customizations: __sitecustomize__

2021-05-24 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue40092] Crash in _PyThreadState_DeleteExcept() at fork in the process child

2021-05-24 Thread David Edelsohn


David Edelsohn  added the comment:

It seems that PyOS_AfterFork_Child() needs to do something like

PyThreadState *tstate = PyThreadState_Get();
PyObject *wr = _PyObject_CAST(tstate->on_delete_data);
PyObject *obj = PyWeakref_GET_OBJECT(wr);
lockobject *lock;
if (obj != Py_None) {
lock = (lockobject *) obj;
if (lock->locked) {
/* Leak memory on purpose. */
lock->locked = 0;
}
}

before the call to _PyEval_ReInitThreads.

Maybe encapsulate that as PyThread_ReInitThreads().

The locks in the threads in the child need to be cleared before 
_PyThreadState_DeleteExcept() so that Python does not try to release the locks 
in the child.

--

___
Python tracker 

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



[issue11486] Add option to not install into /Applications

2021-05-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Ronald, do you still wish to apply this? It should be easy to rebase this patch 
onto main.

If not, we should perhaps close this issue.

--
nosy: +erlendaasland
versions: +Python 3.11 -Python 3.4

___
Python tracker 

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



[issue43665] AIX: test_importlib regression (ENV change)

2021-05-24 Thread David Edelsohn


Change by David Edelsohn :


--
nosy: +David.Edelsohn

___
Python tracker 

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



[issue44226] Threads shutting down in Py 2.7 but not in Py 3.69 while making SSH connection using Paramiko module

2021-05-24 Thread Muralidhar BN


New submission from Muralidhar BN :

Threads shutting down in Py 2.7 but not in Py 3.69 while making SSH connection 
using Paramiko module

Executing code qa-test-execute.py in Py 2.7 (Ubuntu 14.04.6 LTS)

Command 1 :
sudo python ./qa-test-execute.py

Output 1 :
2021-05-24 23:35:59,889[BaseCommandLine __init__ 139916740505872][DEBUG]: 
Attempt to close ssh-session within 10.0 seconds.
Exception AssertionError: 'attempt to release recursive lock not owned by 
thread' in > ignored

Command 2 :

sudo python ./qa-test-execute.py 2>&1 | tee 24052021_py27_execute_1.log

Output 2 :
2021-05-24 23:50:16,303[BaseCommandLine __init__ 139863250567440][DEBUG]: 
Attempt to close ssh-session within 10.0 seconds.
Exception AssertionError: 'attempt to release recursive lock not owned by 
thread' in > ignored


Executing code qa-test-execute.py in Py 3.69 (Ubuntu 18.04.5 LTS)

Command 1 :
sudo python ./qa-test-execute.py

Output 1 :
2021-05-24 23:53:49,293[BaseCommandLine __init__ 139973197423840][DEBUG]: 
Attempt to close ssh-session within 10.0 seconds.
2021-05-24 23:53:49,293[BaseCommandLine __init__ 139973197423840][DEBUG]: 
Closing internal ssh-client.
Fatal Python error: could not acquire lock for <_io.BufferedWriter 
name=''> at interpreter shutdown, possibly due to daemon threads

Command 2 :
sudo python3 ./qa-test-execute.py 2>&1 | tee 
launcher_gt20907_24052021_execute_py369_1.log

Output 2 : Terminal hangs & CTRL C to return prompt

2021-05-24 23:56:31,646[BaseCommandLine __init__ 140516619855072][DEBUG]: 
Attempt to close ssh-session within 10.0 seconds.
2021-05-24 23:56:31,646[BaseCommandLine __init__ 140516619855072][DEBUG]: 
Closing internal ssh-client.
^C


Behaviour of same code is different when executed in Py 2.7 & Py 3.69. 

Threads not terminating normally conflicting with paramiko / logging module  


qa-test-execute.py
#!/usr/bin/env python3

import sys
import traceback
import logging
import logging.config
import time
import threading
import multiprocessing
import paramiko



def lock_acquire_with_timeout1(lock, timeout_seconds):
"""
Try to acquire lock without specified timeout
@param lock: threading lock to be acquired
@type lock: threading.Lock
@param timeout_seconds: maximal time to make lock acquire attempts
@type timeout_seconds: float
"""
begin_time = time.time()
while time.time() - begin_time < timeout_seconds:
if lambda: lock.acquire(False):
return True
else:
time.sleep(1.0)
return None


def call_with_timeout1(method_to_call, timeout_seconds):
"""
Good for potentially "freeze" methods calls. Executes passed method in
separate thread. Waits for control returns within timeout. If timeout
exceed - return control to callee thread. Separate execution thread will
still be active.

@param method_to_call: method te be called
@type method_to_call: function
@param timeout_seconds: maximal time to wait for method call finished
@type timeout_seconds: float
"""
stop_thread = threading.Barrier(2)
thread_name = threading._newname("{}-%d".format(__name__))
call_thread = threading.Thread(target=method_to_call, name=thread_name)
call_thread.daemon = True 
call_thread.start()
print ("threading.activeCount() : %s",threading.activeCount())
print ("threading.currentThread() : %s", threading.currentThread())
print ("threading.enumerate() : %s", threading.enumerate() )
call_thread.join(timeout=timeout_seconds)
if call_thread.is_alive():
stop_thread.abort()
return not call_thread.is_alive()


def format_all_threads_stacks1():
"""
@return: formatted stacks for all running threads.
"""
stacktraces = []
for thread_id, stack in 
list(dict(list(sys._current_frames().items())).items()):
for thread1 in threading.enumerate():
if thread1.ident == thread_id:
stacktraces.append('Thread %s (daemon=%r) stacktrace: \n%s' %
   (thread1.name, thread1.daemon, 
''.join(traceback.format_stack(stack
else:
thread = None
return '\n'.join(stacktraces)


class SSHClient_noauth1(paramiko.SSHClient):

def _auth(self, username, *args):
self._transport.auth_none(username)
return

class BaseCommandLine1(object):

def __init__(self, connection_timeout=None):
self._connection_timeout = connection_timeout
self._connection_lock = multiprocessing.RLock()

self._ssh_client = None
self.logger = logging.getLogger('BaseCommandLine __init__ 
{}'.format(id(self)))
self.reset_connection1()

def __del__(self):
self.close1() 

def _wait_for_connection1(self):
begin_time = time.time()
self.logger.debug("Will attempt to connect with device for %s seconds." 
% self._connection_timeout)
while time

[issue42112] ZipFIle.write remove slash at the beginning of member's path

2021-05-24 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue43066] Zipfile with leading slashes

2021-05-24 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue29468] zipfile should catch ValueError as well as OSError to detect bad seek calls

2021-05-24 Thread Filipe Laíns

Filipe Laíns  added the comment:

That would not stay true to its meaning. AFAIK there are no implied exceptions 
in file objects. Given the meaning of ValueError, I'd say it is appropriate 
here.

--
nosy: +FFY00

___
Python tracker 

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



[issue42043] zipfile.Path should support inheritance

2021-05-24 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
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



[issue42043] zipfile.Path should support inheritance

2021-05-24 Thread Filipe Laíns

Filipe Laíns  added the comment:

This can be closed now.

--
nosy: +FFY00

___
Python tracker 

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



[issue42654] Add folder for python customizations: __sitecustomize__

2021-05-24 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue44192] Annotations, Inheritance and Circular Reference

2021-05-24 Thread Filipe Laíns

Filipe Laíns  added the comment:

s/holder/older/

Sorry, my dyslexia is acting up.

--

___
Python tracker 

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



[issue44192] Annotations, Inheritance and Circular Reference

2021-05-24 Thread Filipe Laíns

Filipe Laíns  added the comment:

The annotations will effectively become strings, instead of object references, 
in Python 3.11, which solves this issue.

You can enable this behavior in holder Python version with `from __future__ 
import annotations`, see PEP 563[1].

>>> class Base:
... _sub: list[Sub]
...
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in Base
NameError: name 'Sub' is not defined


>>> from __future__ import annotations
>>> class Base:
... _sub: list[Sub]
...
>>> class Sub:
... _parent: Base
...
>>>

[1] https://www.python.org/dev/peps/pep-0563/

--
nosy: +FFY00

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-24 Thread miss-islington


miss-islington  added the comment:


New changeset ab4da079232356e781743b2782148bc7c03f1ee3 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-44195: Use 'TraversableResources' in the docs to match the 
implementation. (GH-26317) (GH-26335)
https://github.com/python/cpython/commit/ab4da079232356e781743b2782148bc7c03f1ee3


--

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-24 Thread miss-islington


miss-islington  added the comment:


New changeset d309bcc9e36adb2437a02550514df3efeb1b2343 by Miss Islington (bot) 
in branch '3.10':
bpo-44195: Use 'TraversableResources' in the docs to match the implementation. 
(GH-26317)
https://github.com/python/cpython/commit/d309bcc9e36adb2437a02550514df3efeb1b2343


--

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +24927
pull_request: https://github.com/python/cpython/pull/26335

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-24 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44195] importlib.abc.TraversableReader is not implemented

2021-05-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

> are people supposed to be implementing readers with just files(), or are they 
> always expected to inherit TraversableResources?

A resource provider could potentially implement only the `files()` method (what 
I think you're calling `TraversableReader`), but my expectation was that all 
providers would provide a Reader derived from `TraversableResources` in order 
to provide backward-compatibility for the `ResourceReader` interface. Long 
term, I'd expect to deprecate all but `files()` on `TraversableResources`.

If a provider only implemented `files()` today and did not inherit from 
`TraversableResources`, they would still satisfy the `files()` API, but not the 
ResourceReader API (i.e. violate the expectation that 
`Loader.get_resource_reader` returns a ResourceReader).

I decided not to present both `TraversableReader` and `TraversableResources` as 
separate classes because the latter was sufficient for all known cases.

> It seems to me that maybe that is an issue and we actually want 
> [DegenerateFiles] to inherit from TraversableResources.

Perhaps. What advantage would that have?

> Regardless of the usefulness in code, please also consider type hinting.

Agreed, there are some places where type hints would drastically improve 
readability.

> If people are expecting to be using this protocol, we should expose it.

My instinct is `TraversableResources` is the preferred protocol for now, 
although I think it's likely we'll want to separate out the TraversableReader 
when necessary. Let's plan to do that in importlib_resources first.

--

___
Python tracker 

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



[issue42937] 192.0.0.8 (IPv4 dummy address) considered globally reachable

2021-05-24 Thread Wayne Johnston


Wayne Johnston  added the comment:

I completely agree with comments about .is_global and special_use.  Private IPs 
are just a subset of special use.  For some part Private means the Private use 
networks reserved by IANA and specified in IETF RFC1918.  

For this PR "IPv4 dummy address" is for sure not global.  Technically, it is 
not a private use IP either.  Just following what others have done.  I really 
like the apporoach of removing the routable special IPs.  Let me know if I 
should create a PR to do this.  This would include adding specific special use 
constant plus a whole bunch of very specific constants.  A constant like 
is_dummy will be added.

I pretty much have the code ready to go for IPV4.

--
components: +Library (Lib)
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



[issue40280] Consider supporting emscripten/webassembly as a build target

2021-05-24 Thread Beuc


Change by Beuc :


--
nosy:  -Beuc

___
Python tracker 

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



[issue44207] Add a version number to Python functions

2021-05-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue44206] Add a version number to dict keys.

2021-05-24 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue44206] Add a version number to dict keys.

2021-05-24 Thread Mark Shannon


Mark Shannon  added the comment:

http://theses.gla.ac.uk/2975/1/2011shannonphd.pdf page 128.

It means we don't need to cache a pointer to the keys, just the version number.
The version number is half the size (for 64 bit machines) and using it means 
that we don't leak keys.

--

___
Python tracker 

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



[issue28806] Improve the netrc library

2021-05-24 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Hello everybody I've just make this PR 
https://github.com/python/cpython/pull/26330 to continue the work.

--

___
Python tracker 

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



[issue44207] Add a version number to Python functions

2021-05-24 Thread Ken Jin


Change by Ken Jin :


--
nosy: +kj

___
Python tracker 

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



[issue44206] Add a version number to dict keys.

2021-05-24 Thread STINNER Victor


STINNER Victor  added the comment:

I don't understand how such "key version" would be useful. Can you please 
elaborate?

--

___
Python tracker 

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



[issue44206] Add a version number to dict keys.

2021-05-24 Thread Mark Shannon


Change by Mark Shannon :


--
keywords: +patch
pull_requests: +24925
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26333

___
Python tracker 

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



[issue44206] Add a version number to dict keys.

2021-05-24 Thread Mark Shannon


Mark Shannon  added the comment:

The version is on the dict keys. It changes if the dict keys object changes in 
a meaningful way.

So, no it doesn't change if a value is changed.
Nor would it change if the keys were shared and a new key-value pair is added 
to a dict, but that key was already in the shared keys.

--

___
Python tracker 

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



[issue44155] Race condition when using multiprocessing BaseManager and Pool in Python3

2021-05-24 Thread Jun


Change by Jun :


--
keywords: +patch
nosy: +junnplus
nosy_count: 1.0 -> 2.0
pull_requests: +24924
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26332

___
Python tracker 

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



[issue44220] PyStructSequence_UnnamedField unavailable on Windows

2021-05-24 Thread Ken Jin


Change by Ken Jin :


--
keywords: +patch
nosy: +kj
nosy_count: 5.0 -> 6.0
pull_requests: +24923
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26331

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2021-05-24 Thread Fredrik Bengtsson


Fredrik Bengtsson  added the comment:

This also causes an issue when using stftime and strptime together on Linux 
(Ubuntu 20.04.1 LTS).
When encoding a datetime using strftime and decoding with strptime using the 
same pattern an error is raised if year < 1000.

Example:
>>> pattern = "%Y-%m-%d"
>>> datetime.strptime(
... datetime(1, 1, 1).strftime(pattern),
... pattern
... )
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.8/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '1-01-01' does not match format '%Y-%m-%d'

--
nosy: +Fronkan

___
Python tracker 

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



[issue44225] stop() on a stopped loop inhibits the next run_forever

2021-05-24 Thread Erik Carstensen


New submission from Erik Carstensen :

If you call stop() on an already stopped event loop, then the next call to 
run_forever will terminate after one loop iteration. I would expect the stop to 
either be a nop, or to be invalid in this state (and raise an exception).

Example:

import asyncio
async def coro(x):
print(x)
if x < 10:
asyncio.create_task(coro(x+1))
loop = asyncio.get_event_loop()
loop.create_task(coro(0))
loop.stop()
loop.run_forever()

--
components: asyncio
messages: 394250
nosy: asvetlov, mandolaerik, yselivanov
priority: normal
severity: normal
status: open
title: stop() on a stopped loop inhibits the next run_forever
type: behavior
versions: Python 3.10, Python 3.11, 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



[issue28806] Improve the netrc library

2021-05-24 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
pull_requests: +24922
pull_request: https://github.com/python/cpython/pull/26330

___
Python tracker 

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



[issue37658] In some cases asyncio.wait_for can lead to socket leak.

2021-05-24 Thread Denis S. Otkidach


Denis S. Otkidach  added the comment:

Re: msg393586
> See my comment in the PR for a suggestion about an alternative structure for 
> wait_for, which may avoid this gap and hence prevent the leak (but I have not 
> tested it!)

Unfortunately this didn't close the gap, so the leak persisted.

I did some research on the source of the error. There are circular references 
between instances of _SelectorSocketTransport and _SSLProtocolTransport (see 
attached image), therefore these objects are destroyed by garbage collector. 
The order might be arbitrary. When _SelectorSocketTransport is destroyed after 
_SSLProtocolTransport everything is ok, but with the opposite order we get the 
error printed. Here is description on how to reproduce this:
https://github.com/ods/bpo-37658#circular-references-when-using-ssltls

--
Added file: https://bugs.python.org/file50061/ssl_circular_refs.png

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +24921
pull_request: https://github.com/python/cpython/pull/26329

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread Petr Viktorin


Petr Viktorin  added the comment:

When building Python, we need two distinct "include" directories:
- source .h files
- install target for .h files

Note that this doesn't matter except when building Python from source.

Historically:
- source .h files were in the sysconfig scheme under 'include'
- the install directory was in the distutils.command.install scheme
under 'headers'

GH-24549 merged these, because sysconfig is now the single source of truth and 
distutils is derived from it.
It seems to me that we need to bring 'headers' back -- at least when building 
Python.

--

___
Python tracker 

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



[issue44217] Tkinter/IDLE: literal astral char discombobulates text editing

2021-05-24 Thread Tal Einat


Tal Einat  added the comment:

> It is partially an IDLE issue. The code expects that indices in Python string 
> correspond indices in Tcl string, but this is not true in case of astral 
> characters which are encoded as 2 (or maybe even 4) characters in Tcl.

It's not just that - Tk's Text widget is the indexing in the line itself wrong. 
In the string from Terry's example, which has 11 characters in a line including 
three smiley emojis, the can be fetch using t.get('1.1'), t.get('1.2') etc. 
through t.get('1.11'). t.get('1.12') returns '\n' since it is at or after the 
end of the line. So, as far as indexing is concerned, each of those emoji 
characters is treated as a single character.

--

___
Python tracker 

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



[issue44170] ShareableList cannot safely handle multibyte utf-8 characters

2021-05-24 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +24920
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26328

___
Python tracker 

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



[issue44222] Improving _removeHandlerRef for a very long _handlerList

2021-05-24 Thread Vinay Sajip


Vinay Sajip  added the comment:

Seems a bit of a pathological case - out of interest, why do you need to create 
tens of thousands of loggers and handlers? Each logger is supposed to represent 
an area of the application. If you want to track e.g. client IP requests or 
similar, there are better ways. Ditto, each handler is supposed to represent a 
different audience for logs. Does your application have tens of thousands of 
distinct modules and/or audiences for logs?

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue44120] logging.config.fileConfig/dictConfig can not import class

2021-05-24 Thread Vinay Sajip


Vinay Sajip  added the comment:

You can't expect things to work if you introduce ambiguities such as a 
attribute `bar` in module `foo` as well as a `foo.bar` module. If there were a 
clear delineation between where a module stops and where a set of attributes 
starts, e.g. package.subpackage:attr1.attr2.attr3, we could just import 
package.subpackage and be done. But for historical reasons, that isn't the case.

--

___
Python tracker 

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



[issue44224] urllib.parse.urljoin behaves differently in Python 3.9.5

2021-05-24 Thread rushter


rushter  added the comment:

Sorry, I found the commit that mentions this 
https://github.com/python/cpython/commit/0593ae84af9e0e8332644e7ed13d7fd8306c4e1a

It's not live on Python.org though.

--
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



[issue44224] urllib.parse.urljoin behaves differently in Python 3.9.5

2021-05-24 Thread rushter


New submission from rushter :

Since Python 3.9.5, `urllib.parse.urljoin` now strips newlines from the 
destination URL.

I think this should be at least mentioned in the `/Misc/NEWS.d`.

Python 3.8.10:

>>> urllib.parse.urljoin('http://a.ru', '\nsome/location')
'http://a.ru/\nsome/location'


Python 3.9.5:

>>> urllib.parse.urljoin('http://a.ru', '\nsome/location')
'http://a.ru/some/location'


We had an extra check for newlines in our Python codebase and our test started 
to fail.

--
messages: 394243
nosy: rushter
priority: normal
severity: normal
status: open
title: urllib.parse.urljoin behaves differently in Python 3.9.5
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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread Ned Deily


Ned Deily  added the comment:

Er, make that "GH-26327 attempts to fix the problem ... " but I see from the CI 
that it causes test_distutils to fail in the simpler case of running the test 
from the build directory (rather than from an installed location which does 
pass). I have run out of time right now but I will get back to it later today 
unless someone gets to it first.

--

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread Ned Deily


Ned Deily  added the comment:

It looks like 341e8a939aca6e9f59ffb0e6daee5888933694ed (GH-24549) incorrectly 
deleted an important check in sysconfig that is needed for building the cpython 
standard library on unix-y systems. The chain of events is somewhat complicated 
but the problem can be easily seen by carefully examining the output of a 
simple build and install, like:

./configure --prefix=/tmp/testbuild
make
make install

As of 3.10.0b1, this results in the standard library module being built twice, 
once by the make step and once by the make install step.

GH-26237 attempts to fix the problem with minimal changes to the approach taken 
in GH-24549 to consolidate Lib/sysconfig.py and Lib/distutils/sysconfig.py. 
Frankly, I am not confident it is the best approach so it should be carefully 
reviewed. There probably should also be a test added at some point for this 
case but I will let someone else deal with that and a test should not hold up 
3.10.0b2. But I think the build failure is serious enough that b2 should be 
held for a fix.

--
priority: normal -> release blocker
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



[issue44155] Race condition when using multiprocessing BaseManager and Pool in Python3

2021-05-24 Thread David Chen


David Chen  added the comment:

After some investigation, i almost finally identified the root cause - it was 
caused by the following line in `Server` class in `manager.py` file:
```
self.listener = Listener(address=address, backlog=16)
```
i'm not sure where the magic number `16` came from, but it turned out it was 
not big enough for some powerful CPU(48 cores in my case), where the socket 
server starts refusing to accepting new connections if there are more than `16` 
unaccepted connections, i think this is why the code stuck at `Client -> 
answer_challenge` where attempting to create new connection to the server. 
After i change the number to `32`, this issue is gone.
IMO, a magic number here is not very suitable, maybe we could make this number 
configurable or use `cpu_count` to set it to a better number based on the CPU 
count.

--

___
Python tracker 

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



[issue44217] Tkinter/IDLE: literal astral char discombobulates text editing

2021-05-24 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

The first and third behavior is only occurring for IDLE. I believe the third 
one is a cause of the first one. 

The second behavior of dancing is a Tcl/Tk problem.

--

___
Python tracker 

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



[issue41282] Deprecate and remove distutils

2021-05-24 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +24919
pull_request: https://github.com/python/cpython/pull/26327

___
Python tracker 

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



[issue44217] Tkinter/IDLE: literal astral char discombobulates text editing

2021-05-24 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

STM like the most reasonable thing to do is to enhance the docs, as Terry 
suggested.

--

___
Python tracker 

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



[issue44223] := in comprehensions does not work

2021-05-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Well, it works, but the priority of := is lower than priority of other 
operators. (x := item.upper() not in "ABC") is interpreted as (x := 
(item.upper() not in "ABC")).

--
resolution:  -> not a bug
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



[issue44217] Tkinter/IDLE: literal astral char discombobulates text editing

2021-05-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is partially an IDLE issue. The code expects that indices in Python string 
correspond indices in Tcl string, but this is not true in case of astral 
characters which are encoded as 2 (or maybe even 4) characters in Tcl.

To fix it we need to translate between Python and Tcl indices every time when 
we pass indices from one language to other. It is virtually impossible to do in 
general (in Tkinter code) because there are tons of methods which return or 
accept indices. It can be fixed in IDLE specifically, but it is still a lot of 
work. I'll try to fix at least some code (backspace and highlighting).

And every Tkinter application which works with string indices and lengths and 
can support astral characters should fix it separately. It can help if helper 
function for conversion between indices in IDLE be exposed as public API in 
Tkinter.

On other hand, the problem will gone in Tcl/Tk 8.7 or 9.0. So we can just wait 
several years.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44223] := in comprehensions does not work

2021-05-24 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

The parser rejects this ambiguity and requires parentheses:
[
xxx
for item in collection
if (xxx := mutator(item)) is not None
]

Example ambiguity:

>>> [x for item in "abcdefabc" if x := item.upper() not in "ABC"]
SyntaxError: invalid syntax
>>> [x for item in "abcdefabc" if (x := item.upper()) not in "ABC"]
['D', 'E', 'F']
>>> [x for item in "abcdefabc" if (x := item.upper() not in "ABC")]
[True, True, True]
>>>

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue44223] := in comprehensions does not work

2021-05-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

"Does not work" is not informative. What did you get and what did you expect to 
get? Please proved a complete reproducible example.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44223] := in comprehensions does not work

2021-05-24 Thread Марк Коренберг

New submission from Марк Коренберг :

[
xxx
for item in collection
if xxx := mutator(item) is not None
]

--
components: Interpreter Core, Parser
messages: 394233
nosy: lys.nikolaou, pablogsal, socketpair
priority: normal
severity: normal
status: open
title: := in comprehensions does not work
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



[issue44214] PyArg_Parse* for vectorcall?

2021-05-24 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +methane

___
Python tracker 

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



  1   2   >