[issue43082] descriptor howto: typo in "Definition and introduction"

2021-01-30 Thread diegoe


New submission from diegoe :

In
  https://docs.python.org/3.10/howto/descriptor.html#definition-and-introduction

The paragraph reads:
"""
Definition and introduction

In general, a descriptor is an attribute value that has one of the methods in 
the descriptor protocol. Those methods are __get__(), __set__(), and 
__delete__(). If any of those methods are defined for an the attribute, it is 
said to be a descriptor.
"""

I believe it should be either "an attribute" or "the attribute" in the last 
sentence. Probably missed it because both options would read fine.

--
assignee: docs@python
components: Documentation
messages: 386011
nosy: diegoe, docs@python
priority: normal
severity: normal
status: open
title: descriptor howto: typo in "Definition and introduction"
type: enhancement
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



[issue43059] sqlite3: Externally developed?

2021-01-30 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

mock also broke similar package on removing __version__. See also 
https://bugs.python.org/issue31826

--
nosy: +xtreak

___
Python tracker 

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



[issue43075] ReDoS in request

2021-01-30 Thread yeting li


yeting li  added the comment:

Thank you for your quick reply!

I agree. Catastrophic backtracking is typically regarded as a regex with 
exponential worst-case matching time. Besides regexes with exponential 
worst-case time complexity, ReDoS also includes ones with  other super-linear 
(e.g., quadratic) worst-case time complexity.


Thanks again for your reply, I'm trying to create a pull request for it.

--

___
Python tracker 

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



[issue43081] Recursive call crash module multiprocessing

2021-01-30 Thread Xinmeng Xia


New submission from Xinmeng Xia :

The following code recursively calls function test_forkserver(). However, the 
output is not expected RecursionError(recursively calling) or OSError(too many 
open files). An unexpected EOFError ( inside module multiprocessing, not this 
code itself) is reported. According to the error message, Python interpreter 
seems to behavior abnormal on line 1, "import multiprocessing". I try other 
cases in my machine, multiprocessing module can work well. Only this case will 
crash module multiprocessing.

test.py
==
import multiprocessing
import os

def do(i):
  print(test_forkserver(), os.getpid())

def test_forkserver():
  mp = multiprocessing.get_context('forkserver')
  mp.Pool(2).map(do(mp), range(3))
if __name__ == '__main__':
  test_forkserver()
==

Attached output:
--
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/python3.10/lib/python3.10/multiprocessing/forkserver.py", 
line 258, in main
fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1)
  File "/usr/local/python3.10/lib/python3.10/multiprocessing/reduction.py", 
line 159, in recvfds
raise EOFError
EOFError
...
--

System Info:
>>uname -a
Linux xxm 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 
x86_64 x86_64 GNU/Linux

>>python -V
Python 3.10.0a4

--
components: Library (Lib)
messages: 386008
nosy: xxm
priority: normal
severity: normal
status: open
title: Recursive call crash module multiprocessing
type: crash
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



[issue43059] sqlite3: Externally developed?

2021-01-30 Thread Berker Peksag


Berker Peksag  added the comment:

Yes, version attributes should be deprecated and properly documented in 
Doc/whatsnew/3.10.rst before removal. I remember we broke Mailman when we 
removed a dunder attribute from the mail package.

Thank you for the PR!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +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



[issue43059] sqlite3: Externally developed?

2021-01-30 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset de76ce540ed013a31d4c80bca2587a2dd7c23652 by Miss Islington (bot) 
in branch '3.8':
bpo-43059: Remove reference to legacy external sqlite3 repository (GH-24364)
https://github.com/python/cpython/commit/de76ce540ed013a31d4c80bca2587a2dd7c23652


--

___
Python tracker 

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



[issue43059] sqlite3: Externally developed?

2021-01-30 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 926ca51be4b9b80c41a647bbc2fb9c40ff108ff0 by Miss Islington (bot) 
in branch '3.9':
bpo-43059: Remove reference to legacy external sqlite3 repository (GH-24364)
https://github.com/python/cpython/commit/926ca51be4b9b80c41a647bbc2fb9c40ff108ff0


--

___
Python tracker 

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



[issue43059] sqlite3: Externally developed?

2021-01-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23207
pull_request: https://github.com/python/cpython/pull/24393

___
Python tracker 

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



[issue43059] sqlite3: Externally developed?

2021-01-30 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +23206
pull_request: https://github.com/python/cpython/pull/24392

___
Python tracker 

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



[issue43059] sqlite3: Externally developed?

2021-01-30 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset e60344364245a23a7a1b25d5ebce6833652a656c by L in branch 'master':
bpo-43059: Remove reference to legacy external sqlite3 repository (GH-24364)
https://github.com/python/cpython/commit/e60344364245a23a7a1b25d5ebce6833652a656c


--

___
Python tracker 

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



[issue43075] ReDoS in request

2021-01-30 Thread yeting li


Change by yeting li :


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

___
Python tracker 

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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-01-30 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

Ned, and others watching.

In future versions of Python, we can use only "&" based separator. But I am not 
certain what should be proposed for the older releases of Python.   

Adam's Patch is a good one to specify explicitly specify the separator, but it 
changes the expectations in our test cases and is not backwards compatible. 

Victor / Marc-Andre: Need your recommendation here.

--

___
Python tracker 

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



[issue42967] [security] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-01-30 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
assignee:  -> orsenthil

___
Python tracker 

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



[issue43042] Delete or merge redundant tutorial sentence.

2021-01-30 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy

___
Python tracker 

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



[issue43080] pprint for dataclass instances

2021-01-30 Thread Lewis Gaul


Change by Lewis Gaul :


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

___
Python tracker 

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



[issue43080] pprint for dataclass instances

2021-01-30 Thread Lewis Gaul


New submission from Lewis Gaul :

Currently the pprint module does not have support for dataclasses. I have 
implemented support for this and will link the PR once I have the issue number!

See also issue37376 for SimpleNamespace support.

--
components: Library (Lib)
messages: 386002
nosy: LewisGaul, eric.snow, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: pprint for dataclass instances
type: enhancement
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



[issue43078] Equality Errors when Unpickling and Pickling a Dictionary with a nan

2021-01-30 Thread Rohan Prasad


Rohan Prasad  added the comment:

I see this makes a ton of sense, thanks! I'll close this issue.

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



[issue24275] lookdict_* give up too soon

2021-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Please test also creating a large dict with string-only or non-string keys. 
Since you add a code in insertdict() it can potentially affects performance.

--

___
Python tracker 

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



[issue43079] wrong IP address range given for ipv4_mapped

2021-01-30 Thread Al


New submission from Al :

https://docs.python.org/3.9/library/ipaddress.html

This documentation for the 'ipaddress' IPv4/IPv6 Manipulation Library 
incorrectly states the address range for 'ipv4_mapped' as ::/96 (which 
means 0:0:0:0:0:0:0:/96).  This is just flat out wrong.  There are some 
websites out there, e.g. APNIC, that also have this error.

The correct address range can be expressed by any of the following methods:
1) 0:0:0:0:0::0:0/96
2) :::0:0/96
3) 0:0:0:0:0:::/96

--
assignee: docs@python
components: Documentation
messages: 385999
nosy: alwhaley, docs@python
priority: normal
severity: normal
status: open
title: wrong IP address range given for ipv4_mapped
type: behavior
versions: Python 3.10, 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



[issue43078] Equality Errors when Unpickling and Pickling a Dictionary with a nan

2021-01-30 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I think this is the expected behavior.

It is expected by IEEE 754 that nan != nan, so that behavior exists:

>>> nan = float('nan')
>>> nan2 = float('nan')
>>> assert nan != nan2
>>> assert nan != nan

However, for "practicality beats purity" (speed) reasons, we compare containers 
by first checking if the entries are identical (aliases of the same object), 
before falling back to the actual comparisons. So identical entries make for 
equal containers, even if the entries don't compare equal.

>>> assert nan is nan   # quick check for identity succeeds,
>>> assert [nan] == [nan]   # therefore these compare equal

>>> assert nan is not nan2  # quick check for identity fails,
>>> assert nan != nan2  # fall back to actual comparison, which fails
>>> assert [nan] != [nan2]  # therefore these do not compare equal

When you serialize and deserialize the container with pickle, you make new 
entries that are no longer aliases.

>From https://docs.python.org/3.9/reference/expressions.html#comparisons:
"The built-in containers typically assume identical objects are equal to 
themselves."

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue24275] lookdict_* give up too soon

2021-01-30 Thread Hristo Venev


Hristo Venev  added the comment:

> Why is the first key built up as vx='x'; vx += '1' instead of just k1="x1"?

I wanted to construct a key that is equal to, but not the same object as, 
`'x1'`. Consider this example:

assert 'x1' is 'x1'
spam = 'x1'
assert spam is 'x1'
eggs = 'x'
eggs += '1'
assert eggs == 'x1'
assert eggs is not 'x1'
assert sys.intern(eggs) is 'x1'

When doing a dict lookup and the lookup key is the same object as a stored 
entry, `__eq__` is not called. Lookups are then significantly faster, maybe 20%.

Consider this example:

class EqTest:
def __eq__(self, other):
raise RuntimeError
def __hash__(self):
return id(self)

adict = {}
k1 = EqTest()
k2 = EqTest()

adict[k1] = 42
adict[k2] = 43
print(adict[k1], adict[k2])

Here `k1` is considered the same as `k1` and `k2` is considered the same as 
`k2`. However, `k1` and `k2` are considered distinct and never compared because 
they have different hashes.

However, if we were to set `EqTest.__hash__ = lambda self: 42`, we'd get a 
RuntimeError when we try to set `adict[k2]` because it would get compared for 
equality with `k1`.

Even if `__eq__` works, we can get some interesting behaviors. For example, 
when using multiple instances of `float('nan')` as keys.

> Using a str subclass in the test is a great idea, and you've created a truly 
> minimal one.  It would probably be good to *also* test with a non-string, 
> like 3 or 42.0.  I can't imagine this affecting things (unless you missed an 
> eager lookdict demotion somewhere), but it would be good to have that path 
> documented against regression.

I also tested a custom class that compares equal to strings. Other than being 
much slower, there weren't any significant differences. I also did some checks 
with int key lookups, which obviously fail with KeyError. They did not make the 
performance worse for the subsequent str lookups.

I will try to make a proper test tomorrow.

--

___
Python tracker 

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



[issue24275] lookdict_* give up too soon

2021-01-30 Thread Jim Jewett


Jim Jewett  added the comment:

Based on Hristo's timing, it appears to be a clear win.  

A near-wash for truly string-only dicts that shouldn't be effected; a near-wash 
for looking up non-(exact-)strings, and a nearly 40% speedup for the target 
case of looking up but not inserting a non-string or string subclass, then 
looking up strings thereafter. 

Additional comments:

Barring objections, I will promote from patch review to commit review when I've 
had a chance to look more closely.  I don't have commit privs, but I think some 
of the others following this issue do.

The test looks pretty good enough -- good enough that I wonder if I'm missing 
something on the parts that seem odd.  It would be great if you either cleaned 
them up or commented to explain why:

Why is the first key vx1, which seems, if anything, like a variable? 
 Why not k1 or string_key?

Why is the first key built up as vx='x'; vx += '1' instead of just k1="x1"?

Using a str subclass in the test is a great idea, and you've created a truly 
minimal one.  It would probably be good to *also* test with a non-string, like 
3 or 42.0.  I can't imagine this affecting things (unless you missed an eager 
lookdict demotion somewhere), but it would be good to have that path documented 
against regression.

This seems like a test that could probably be rolled into a bigger testfile for 
the actual commit.  I don't have the name of such an appropriate file at hand 
right now, but will try to find it on a deeper review.

--

___
Python tracker 

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



[issue42939] Linux's chattr i.e. ioctl(FS_IOC_SETFLAGS) is not supported in os.chflags()

2021-01-30 Thread Eryk Sun


Eryk Sun  added the comment:

bpo-39533 is a related issue that seeks to support the Linux statx() system 
call. A statx record includes an stx_attributes field, which supports the 
following file attributes that can be set with chattr:

[a]ppend: STATX_ATTR_APPEND
[c]ompressed: STATX_ATTR_COMPRESSED
no [d]ump   : STATX_ATTR_NODUMP
[i]mmutable : STATX_ATTR_IMMUTABLE
da[x]   : STATX_ATTR_DAX (5.8)

and the following read-only file attributes that can be listed with lsattr:

[E]ncrypted : STATX_ATTR_ENCRYPTED
[V]erity: STATX_ATTR_VERITY (5.5)

--
nosy: +eryksun

___
Python tracker 

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



[issue24275] lookdict_* give up too soon

2021-01-30 Thread Jim Jewett


Jim Jewett  added the comment:

This was originally "can be reopened if a patch is submitted" and Hristo Venev 
has now done so. Therefore, I am reopening.

--
resolution: rejected -> remind
stage:  -> patch review
status: closed -> open
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



[issue43075] ReDoS in request

2021-01-30 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

+1. The suggested fix looks good to me.

--

___
Python tracker 

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



[issue42982] Update suggested number of iterations for pbkdf2_hmac()

2021-01-30 Thread Christian Heimes


Christian Heimes  added the comment:

PBKDF2-HMAC is a serialized algorithm. It cannot be parallized. That means the 
runtime depends on single core-performance. The single core-performance of 
desktop and server CPUs hasn't improved much in the last decade. Modern CPUs 
have more cores, larger caches, and better IPC. Intel Nehalem architecture from 
2009 had up to 3.33 GHz. Fast 2020 Comet Lake CPUs have up to 3.7 GHz base 
frequence and about 5GHz turbo.

--

___
Python tracker 

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



[issue43048] Printing RecursionError results in RecursionError

2021-01-30 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy

___
Python tracker 

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



[issue43048] Printing RecursionError results in RecursionError

2021-01-30 Thread Irit Katriel


Irit Katriel  added the comment:

Maybe it is worth doing something less invasive in 3.9, such as catching the 
recursion error and truncating the output?

--
status: closed -> open
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



[issue43078] Equality Errors when Unpickling and Pickling a Dictionary with a nan

2021-01-30 Thread Rohan Prasad


New submission from Rohan Prasad :

Hi,

I'm having a weird issue with floats in dictionaries and equality comparison 
(see attached screenshot for an example). When I create two dictionaries with a 
nan value they pass an equivalence test. However, if I pickle and unpickle one 
of the dictionaries they become no longer equivalent. I would expect that the 
behavior would be the same irrespective of whether they are pickled/unpickled. 
Is there something else I should be doing here or is there a way to easily 
resolve this (short of writing custom ways to compare equality)?

--
files: numpy-nan-dict-error.png
messages: 385990
nosy: rp4fx12
priority: normal
severity: normal
status: open
title: Equality Errors when Unpickling and Pickling a Dictionary with a nan
type: behavior
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49781/numpy-nan-dict-error.png

___
Python tracker 

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



[issue43077] Update bundled pip to 21.0.1 and setuptools to 52.0.0

2021-01-30 Thread Paul Moore


Change by Paul Moore :


--
pull_requests: +23203
pull_request: https://github.com/python/cpython/pull/24388

___
Python tracker 

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



[issue42896] Solaris 11.4 crle output not handled correctly

2021-01-30 Thread Hergen Lange


Hergen Lange  added the comment:

Fix for python 3.8.7
Also added support for LD_CONFIG and LD_LIBRARY_PATH environment variables.

Patch File: py387_ctypes_util.patch

TEST successfull:
 
/opt/python/lib/python3.8/ctypes$ python3 util.py
libm.so.2
libc.so.1
libbz2.so.1
libx264.so.157


libcrypt.so.1

--
versions:  -Python 3.10, Python 3.7, Python 3.9
Added file: https://bugs.python.org/file49780/py387_ctypes_util.patch

___
Python tracker 

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



[issue43077] Update bundled pip to 21.0.1 and setuptools to 52.0.0

2021-01-30 Thread Paul Moore


Change by Paul Moore :


--
keywords: +patch
pull_requests: +23202
pull_request: https://github.com/python/cpython/pull/24387

___
Python tracker 

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



[issue43077] Update bundled pip to 21.0.1 and setuptools to 52.0.0

2021-01-30 Thread Paul Moore


Paul Moore  added the comment:


New changeset 4d11ecbb5ed78e6259ee27289c7638aad795f473 by Paul Moore in branch 
'master':
bpo-43077: Update bundled pip to 21.0.1 and setuptools to 52.0.0 (GH-24386)
https://github.com/python/cpython/commit/4d11ecbb5ed78e6259ee27289c7638aad795f473


--

___
Python tracker 

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



[issue43075] ReDoS in request

2021-01-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
stage:  -> needs patch
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



[issue43075] ReDoS in request

2021-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I agree. There is no catastrophic backtracking here (it was fixed in 
issue39503), but the complexity of matching the regular expression is linear. 
Searching the pattern in a sequence of commas has quadratic complexity, because 
every step has linear complexity and we advance only one character at every 
attempt.

The proposed solution looks correct to me and fixes the issue. Yeting Li, do 
you mind to create a pull request for it? I can do it myself, but since you 
have found the problem and the solution, it would be better if the commit be 
attributed to you.

--

___
Python tracker 

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



[issue42939] Linux's chattr i.e. ioctl(FS_IOC_SETFLAGS) is not supported in os.chflags()

2021-01-30 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue43077] Update bundled pip to 21.0.1 and setuptools to 52.0.0

2021-01-30 Thread Paul Moore


Change by Paul Moore :


--
assignee:  -> paul.moore
nosy: +Marcus.Smith, dstufft, ncoghlan, pradyunsg
stage:  -> patch review

___
Python tracker 

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



[issue43077] Update bundled pip to 21.0.1 and setuptools to 52.0.0

2021-01-30 Thread Paul Moore


New submission from Paul Moore :

I've just released pip 21.0.1, so this updates the bundled copy (as well as 
updating setuptools).

I assume this should be backported to 3.8 and 3.9.

--
components: Library (Lib)
messages: 385986
nosy: paul.moore
priority: normal
pull_requests: 23201
severity: normal
status: open
title: Update bundled pip to 21.0.1 and setuptools to 52.0.0
type: behavior
versions: Python 3.10, 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



[issue43053] Speed up math.isqrt, again

2021-01-30 Thread Juraj Sukop


Juraj Sukop  added the comment:

Mark, thank you very much for the thorough reply!

I believe it is not for me to say whether the complication is worth it or not. 
What really huge numbers goes, if I'm not mistaken, the original `isqrt` is 
already "fast" and only constant speed-up is possible.

I was also trying to speed up the last correction, i.e. that full-width 
multiplication, but didn't get too far (only M(n) -> M(n/2)). Continuing from 
`isqrt_2`:

a = (a << l) + ((n - (a**2 << 2*l)) >> l)//a//2
return a - (a*a > n)

a = (a << l) + ((n - (a**2 << 2*l)) >> (l + 1))//a
return a - (a**2 > n)

x = a
a = (x << l) + ((n - (x**2 << 2*l)) >> (l + 1))//x
return a - (((x << l) + ((n - (x**2 << 2*l)) >> (l + 1))//x)**2 > n)

x = a
x2 = x**2
a = (x << l) + ((n - (x2 << 2*l)) >> (l + 1))//x
return a - (((x << l) + ((n - (x2 << 2*l)) >> (l + 1))//x)**2 > n)

x = a
x2 = x**2
t = (n - (x2 << 2*l)) >> (l + 1)
u = t//x
a = (x << l) + u
b = ((x << l) + u)**2
return a - (b > n)

x = a
x2 = x**2
t = (n - (x2 << 2*l)) >> (l + 1)
u = t//x
a = (x << l) + u
b = ((x << l)**2 + 2*(x << l)*u + u**2)
return a - (b > n)

x = a
x2 = x**2
t = (n - (x2 << 2*l)) >> (l + 1)
u, v = divmod(t, x)
a = (x << l) + u
b = ((x2 << 2*l) + ((t - v) << (l + 1)) + u**2)
return a - (b > n)

But then I got stuck on that `u**2`. The above should be a bit faster but 
probably is not worth the complication. On the other hand, if it was worth the 
complication, each iteration would use only single half width multiplication as 
`x2` of one interaction is `b` of previous iteration.

Another idea maybe worth trying (only in C) is to use such an `l` during the 
iterations that it would make the numbers land on the word boundaries. In other 
words, computing few more bits here and there may not hurt the performance much 
but it would replace the shifts by pointer arithmetic. Here the only change is 
`//64*64`:

def isqrt_3(n):
l = (n.bit_length() - 1)//4//64*64
a = isqrt(n >> 2*l)
a = (a << l) + ((n - (a**2 << 2*l)) >> l)//a//2
return a - (a*a > n)

--

___
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-01-30 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue40455] GCC 10 compiler warnings

2021-01-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you Pablo!!

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



[issue40455] GCC 10 compiler warnings

2021-01-30 Thread Dong-hee Na


Change by Dong-hee Na :


--
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue40455] GCC 10 compiler warnings

2021-01-30 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 86e322f1412be6c5a6c8fa8e73af68b99c42bb18 by Pablo Galindo in 
branch 'master':
bpo-40455: Fix gcc10+ warning about writing into a section of offset 0 
(GH-24384)
https://github.com/python/cpython/commit/86e322f1412be6c5a6c8fa8e73af68b99c42bb18


--

___
Python tracker 

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



[issue43069] Python fails to read a script whose path is `/dev/fd/X`

2021-01-30 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

I would suggest to start digging from the following piece of code in 
`maybe_pyc_file()` (Python/pythonrun.c):

 int ispyc = 0;
 if (ftell(fp) == 0) {
 if (fread(buf, 1, 2, fp) == 2 &&
 ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic)
 ispyc = 1;
 rewind(fp);
 }

--
nosy: +izbyshev

___
Python tracker 

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



[issue42896] Solaris 11.4 crle output not handled correctly

2021-01-30 Thread Hergen Lange


Hergen Lange  added the comment:

For python 3.8.7 should be:

--- util.py.broken  2021-01-30 12:15:35.047669249 +0100
+++ util.py 2021-01-30 12:28:04.425931587 +0100
@@ -251,6 +251,9 @@
 line = line.strip()
 if line.startswith(b'Default Library Path (ELF):'):
 paths = os.fsdecode(line).split()[4]
+elif line.startswith(b'Default Library Path:'):
+## allow for Solaris 11.4 output
+paths = os.fsdecode(line).split()[3]
 
 if not paths:
 return None

--
nosy: +hergen

___
Python tracker 

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



[issue42050] ensurepip fails if cwd contains illformed setup.cf

2021-01-30 Thread Jan Christoph


Jan Christoph  added the comment:

Just wanted to say, I ran into this while using direnv. See the issue I opened 
before knowing of this one: https://bugs.python.org/issue43038

--
nosy: +con-f-use
Added file: https://bugs.python.org/file49779/shell-session.txt

___
Python tracker 

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



[issue43047] logging.config formatters documentation is out of sync with code

2021-01-30 Thread miss-islington


miss-islington  added the comment:


New changeset 62437a2fa9ebd2352dc1e15ae310895eef6ff981 by Ian Wienand in branch 
'master':
bpo-43047: logging.config formatters documentation update (GH-24358)
https://github.com/python/cpython/commit/62437a2fa9ebd2352dc1e15ae310895eef6ff981


--
nosy: +miss-islington

___
Python tracker 

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



[issue43069] Python fails to read a script whose path is `/dev/fd/X`

2021-01-30 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I can reproduce the issue on macOS 11.1. 

As you write:
- running /dev/fd/X as a script fails silently if it refers to an smallish file
- reading /dev/fd/X referring to the same smallish files works fine (the 
``open('/dev/fd/9').read()`` scenario. 

If I read the code in Modules/main.c correctly the main difference between the 
two scenario's is that the first scenario using the C stdio library to read the 
file (in pymain_run_file_obj), and the latter uses the normal Python io stack.

Reading /dev/fd/9 works fine when using either stdio or open/read in C code. 

I have not yet tried to untangle the layers of C code from pymain_run_file_obj 
to actually reading the script, there might be something there that sheds light 
on what's going on here.

I'm not yet willing to claim this is an OS bug as I've failed to reproduce this 
outside of Python.

--

___
Python tracker 

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



[issue43075] ReDoS in request

2021-01-30 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +orsenthil, serhiy.storchaka
type:  -> security

___
Python tracker 

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



[issue43076] str.split() indexing issue

2021-01-30 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Slicing is described here:

https://docs.python.org/3/tutorial/introduction.html

--

___
Python tracker 

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



[issue43076] str.split() indexing issue

2021-01-30 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Hi Aleksandr,

In future, when posting what you think might be a bug, please try to cut the 
code down to the bare minimum needed. In this case, it doesn't matter at all 
that the strings you are processing come from splitting a larger string. 
split() has done its job, correctly, giving you a list of  substrings

['WORD', 'BIRD\nBIRD\nBIRD']

You then extract each item, and only then take the slice from it. So you can 
simplify the problem:

string = 'WORD'
print(string[0:3])

You ask:

"Shouldn't index [0:3] give 4 chars?"

No. It gives *three* characters. The end index is not included in the slice. 
Slice indexes occur *between* the characters:

|W|O|R|D|
0.1.2.3.4

so a slice from 0 to 3 includes only three characters, not four.

--
nosy: +steven.daprano
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



[issue43076] str.split() indexing issue

2021-01-30 Thread Aleksandr Sigalov


New submission from Aleksandr Sigalov :

The following code ran in Google Colab...

=

import sys

print (sys.version)

string = 'WORD=BIRD\nBIRD\nBIRD'

print(string.split())

print('')

print(string.split('=')[0][0:3])
print(string.split('=')[1][0:3])

=

produces this...

=

3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0]
['WORD=BIRD', 'BIRD', 'BIRD']

WOR
BIR

=

Shouldn't index [0:3] give 4 chars? I looked in the docs and I could not find 
anything explaining this behavior.

=

Thanks.

--
components: Build
messages: 385975
nosy: tegridycode
priority: normal
severity: normal
status: open
title: str.split() indexing issue
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue43075] ReDoS in request

2021-01-30 Thread yeting li

New submission from yeting li :

Hi,

I find this regex '(?:^|,)[ \t]*([^ \t]+)[ \t]+' may be stucked by input.

The vulnerable regex is located in 
https://github.com/python/cpython/blob/5c5a938573ce665f00e362c7766912d9b3f3b44e/Lib/urllib/request.py#L946

The ReDOS vulnerability of the regex is mainly due to the sub-pattern ',([^ 
\t]+)' and can be exploited with the following string
attack_str = "," * 1

You can execute redos_python.py to reproduce the ReDos vulnerability.


I am willing to suggest that you replace '(?:^|,)[ \t]*([^ \t]+)[ \t]+' with 
'(?:^|,)[ \t]*([^ \t,]+)[ \t]+'

Looking forward for your response​!

Best,
Yeting Li

--
components: Library (Lib)
files: redos_python.py
messages: 385974
nosy: yetingli
priority: normal
severity: normal
status: open
title: ReDoS in request
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49778/redos_python.py

___
Python tracker 

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



[issue34321] mmap.mmap() should not necessarily clone the file descriptor

2021-01-30 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
versions: +Python 3.10 -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 
3.7, Python 3.8

___
Python tracker 

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