[issue40111] Introspect ssl context: read ALPN and NPN protocols

2020-03-29 Thread Dima Tisnek


New submission from Dima Tisnek :

It's quite easy to create new or modify existing ssl context:

ssl_context = ssl.create_default_context()
ssl_context.set_alpn_protocols(["h2"])

I'm writing a library where the context may be passed by the caller (useful if 
the caller wants to set custom CA path, or client cert auth, share TLS session 
tickets, etc.).

I'd love to be able to check that the context I get has correct ALPN and/or NPN 
protocols specified.

I'd love to be able to do something like this:

assert "h2" in ssl_context.alpn_protocols
or
assert "h2" in ssl_context.get_alpn_protocols()


There's sortof precedent for this, I use following code to set and check TLS 
version flags:

ssl_context.options |= ssl.OP_NO_TLSv1
assert ssl.OP_NO_TLSv1 in ssl_context.options

--
components: Extension Modules
messages: 365300
nosy: Dima.Tisnek
priority: normal
severity: normal
status: open
title: Introspect ssl context: read ALPN and NPN protocols
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



[issue37614] Pasteing into idle makes it exit

2020-03-29 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
title: Pasteing into idle makes it crash -> Pasteing into idle makes it exit

___
Python tracker 

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



[issue39951] Ignore specific errors when closing ssl connections

2020-03-29 Thread Dima Tisnek


Dima Tisnek  added the comment:

Sorry I was too fast to close this.

39953 is about error codes.

This bug is about having an error at all.

I believe that the code in question should pass without error, even in the 
presence of network delays.

--
resolution: duplicate -> 
status: closed -> open

___
Python tracker 

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



[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread gaoxinge


gaoxinge  added the comment:

> I assume what you mean is that while shutdown will wait, it won't accept any 
> new job/future after it is called.

Yes, you are right. This is a feature of the ThreadPoolExecutor.

--

___
Python tracker 

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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-29 Thread Kubilay Kocak


Kubilay Kocak  added the comment:

Confirming: test_ssl passes with 1.1.1e + reverted EOF change

--

___
Python tracker 

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



[issue39089] Update IDLE's credits

2020-03-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I have thought about everything from deleting the file to a detailed update.  
If we keep it, anything would be an improvement. Perhap something in the 
middle, starting in 2013.  I just decided I don't need be be responsible for 
anything earlier, even this I actually started in Fall 2010.

2013 Roger Serwy (and perhaps GSOC Phil Webster -- I need to look more at News 
log.)
2014 Saimadhav Heblikar
2015 Mark Roseman
2017 Louie Lu, Cheryl Sabella, Serhiy Storchaka, the latter two to date.
201?, 2019 Tal Einat

Can you make a suggested addition?

--
stage:  -> needs patch

___
Python tracker 

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



[issue40110] multiprocessing.Pool.imap() should be lazy

2020-03-29 Thread Nick Guenther


New submission from Nick Guenther :

multiprocessing.Pool.imap() is supposed to be a lazy version of map. But it's 
not: it submits work to its workers eagerly. As a consequence, in a pipeline, 
all the work from earlier steps is queued, performed, and finished first, 
before starting later steps.

If you use python3's built-in map() -- aka the old itertools.imap() -- the 
operations are on-demand, so it surprised me that Pool.imap() doesn't. It's 
basically no better than using Pool.map(). Maybe it saves memory by not 
materializing large iterables in every worker process? But it still 
materializes the CPU time from the iterables even if unneeded.

This can be partially worked around by giving each step of the pipeline its own 
Pool -- then, at least the earlier steps of the pipeline don't block the later 
steps -- but the jobs are still done eagerly instead of waiting for their 
results to actually be requested.

--
files: multiprocessing-eager-imap.py
messages: 365295
nosy: kousu
priority: normal
severity: normal
status: open
title: multiprocessing.Pool.imap() should be lazy
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49010/multiprocessing-eager-imap.py

___
Python tracker 

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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-29 Thread Kubilay Kocak


Kubilay Kocak  added the comment:

Updating the koobs-freebsd-564d buildbots FreBSD openssl port now which has had 
the 1.1.1e EOF change reverted. Will run the last 3.x build again and report 
here whether it passes (it should) or not.

--

___
Python tracker 

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



[issue39951] Ignore specific errors when closing ssl connections

2020-03-29 Thread Dima Tisnek


Dima Tisnek  added the comment:

Let's close this in favour of https://bugs.python.org/issue39953 which has a 
pending pull request https://github.com/python/cpython/pull/19082

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



[issue39982] FreeBSD: SCTP tests of test_socket fails on AMD64 FreeBSD Shared 3.x

2020-03-29 Thread Kubilay Kocak


Kubilay Kocak  added the comment:

+1 to mutually beneficial relationships :)

--

___
Python tracker 

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



[issue39207] concurrent.futures.ProcessPoolExecutor does not properly reap jobs and spawns too many workers

2020-03-29 Thread Kyle Stanley


Kyle Stanley  added the comment:

So, I think a potential approach to this issue with ProcessPoolExecutor would 
be making it a bit more similar to ThreadPoolExecutor: instead of spawning 
*max_workers* processes on startup (see `_adjust_process_count()`), spawn each 
new process in submit() (see `_adjust_thread_count()`), and only do so when 
there are no idle processes (and the current count is below max_workers, of 
course).

This wouldn't reap the idle processes, but I think re-using them is a behavior 
we want to retain. It seems like it would be quite costly to constantly close 
and start new processes each time a work item is completed.

>From my perspective, the main issue is that the processes are being spawned 
>all at once instead of being spawned as needed. This can result in a 
>substantial amount of extra cumulative idle time throughout the lifespan of 
>the ProcessPoolExecutor.

I should have some time to work on this in the next month or sooner, so I'll 
assign myself to this issue.

(I also changed the version to just Python 3.9, as this seems like too 
significant of a behavioral change to backport to 3.8. Let me know if anyone 
disagrees.)

--
assignee:  -> aeros
stage:  -> needs patch
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue40109] List index doesn't work with multiple assignment

2020-03-29 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Python doesn't have multiple assignment, just tuple unpacking. Consider the 
order of evaluation here:

1. tmp = (6, x[2]) (i.e., (6, 2))
2. x[2] = tmp[0]
3. tmp2 = x.index(6) (= 2)
4. x[tmp2] = tmp[1] (i.e., x[2] = 2)

--
nosy: +benjamin.peterson
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



[issue40109] List index doesn't work with multiple assignment

2020-03-29 Thread Nathan Brooks


New submission from Nathan Brooks :

Faulty example:
x = [1,2,3,4,5,6,7]
# this should replace items 3 and 6 with each other
x[2], x[x.index(6)] = 6, x[2]
print(x)
[1,2,3,4,5,6,7]

Workaround:
x = [1,2,3,4,5,6,7]
i = x.index(6)
# this replaces items 3 and 6 in the list.
x[2], x[i] = 6, x[2]
print(x)
[1,2,6,4,5,3,7]

--
messages: 365289
nosy: Nathan Brooks
priority: normal
severity: normal
status: open
title: List index doesn't work with multiple assignment

___
Python tracker 

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



[issue39073] email incorrect handling of crlf in Address objects.

2020-03-29 Thread R. David Murray


Change by R. David Murray :


--
stage: patch review -> backport needed

___
Python tracker 

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



[issue39073] email incorrect handling of crlf in Address objects.

2020-03-29 Thread R. David Murray


R. David Murray  added the comment:

Thanks!

--

___
Python tracker 

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



[issue39073] email incorrect handling of crlf in Address objects.

2020-03-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18585
pull_request: https://github.com/python/cpython/pull/19223

___
Python tracker 

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



[issue39073] email incorrect handling of crlf in Address objects.

2020-03-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18586
pull_request: https://github.com/python/cpython/pull/19224

___
Python tracker 

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



[issue39073] email incorrect handling of crlf in Address objects.

2020-03-29 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue39073] email incorrect handling of crlf in Address objects.

2020-03-29 Thread R. David Murray


R. David Murray  added the comment:


New changeset 614f17211c5fc0e5b828be1d3320661d1038fe8f by Ashwin Ramaswami in 
branch 'master':
bpo-39073: validate Address parts to disallow CRLF (#19007)
https://github.com/python/cpython/commit/614f17211c5fc0e5b828be1d3320661d1038fe8f


--

___
Python tracker 

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



[issue36144] Dictionary union. (PEP 584)

2020-03-29 Thread Curtis Bucher


Change by Curtis Bucher :


--
pull_requests: +18583
pull_request: https://github.com/python/cpython/pull/19221

___
Python tracker 

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



[issue40108] Improve error message for -m option when .py is present

2020-03-29 Thread Raymond Hettinger


New submission from Raymond Hettinger :

I think we can do better than the following:

$ python3.8 -m unicode_math_symbols.py
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8: Error while 
finding module specification for 'unicode_math_symbols.py' 
(ModuleNotFoundError: __path__ attribute not found on 'unicode_math_symbols' 
while trying to find 'unicode_math_symbols.py')

It is a reasonably common mistake to add .py to the module name for module 
names loaded by the -m command-line launcher.  The error mess is somewhat 
opaque and not suggestive of what the actual problem is or how to fix it.

--
messages: 365286
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Improve error message for -m option when .py is present
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



[issue23574] datetime: support leap seconds

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

One option to explore is to add a "leap seconds" field to datetime.datetime 
which can be negative (just in case someone decides to add negative leap 
seconds in the future).

It can use in operations which involve time zones, it can be 
serialized/deserialized, but datetime.datetime.timestamp() would ignore this 
field ("drop" leap seconds on purpose).

--
nosy: +p-ganssle
resolution: wont fix -> 
status: closed -> open

___
Python tracker 

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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 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



[issue39924] pathlib handles missing `os.link`, `os.symlink` and `os.readlink` inconsistently

2020-03-29 Thread Barney Gale


Change by Barney Gale :


--
pull_requests: +18582
pull_request: https://github.com/python/cpython/pull/19220

___
Python tracker 

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



[issue40094] Add os.status_to_exitcode() function

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

The function can be used to convert the result of the following functions:

* os.system() (on Unix)
* os.wait()
* os.waitpid()
* os.wait3()
* os.wait4()
* pty.spawn()

Note: waitid() has a different API, si_status can be used directly, its meaning 
depends on si_code.

--

First, I proposed os._wait_status_to_returncode() name.

I renamed it to os.status_to_exitcode().

Maybe the "status" term used alone is too general. 

I'm not sure neither if it's correct to write "exitcode" a single word. For 
example, Windows uses GetExitCodeProcess() name: "Exit Code" means that they 
are two separated words. The Python os documentation uses "exit code" and "exit 
status", but never "exitcode" or "exitstatus".

The system() function manual page says:

"""
RETURN VALUE
  (...)
   In the last two cases, the return value is a "wait status" that can be 
examined using the macros described in waitpid(2).  (i.e., WIFEXITED(), 
WEXITSTATUS(), and so on).
"""

Python pty.spawn() documentation says: "(...) returns the status value from 
os.waitpid() on the child process".

--

In my current PR, the function documentation is: "Convert an exit status to an 
exit code"

Other name ideas:

* exit_status_to_code()
* exit_status_to_exit_code()
* wait_status_to_exit_code()

The Wikipedia article is called "Exit status" and then tells about "exit status 
code" :-) So it can be surprising to have a function supposed to convert an 
"exit status" into an "exit code".

It seems like "Convert a waitpid() wait status to an exit code" is the best 
documentation and so that wait_status_to_exit_code() is the most correct and 
least confusing name, even if it's longer than other name candidates.

--

___
Python tracker 

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



[issue40107] pathlib: make `_Accessor.open()` return a file object and not a file descriptor

2020-03-29 Thread Barney Gale


New submission from Barney Gale :

This is one of a series of bug reports / PRs that lay the groundwork for making 
pathlib extensible. See here for detail: 
https://discuss.python.org/t/make-pathlib-extensible/3428

Currently `_Accessor.open()` is expected to function like `os.open()` and 
return a file descriptor. I'd suggest this interface is too low-level if our 
eventual aim is to allow users to implement their own accessor.

It would be better is `_Accessor.open()` is expected to function like 
`io.open()` and return a file object. That way, accessors don't need to deal 
with file descriptors at all, which is important if they're working with remote 
filesystems.

I'm planning to wait for bpo-39895 / gh-18838 to land before starting work on 
this.

--
components: Library (Lib)
messages: 365283
nosy: barneygale
priority: normal
severity: normal
status: open
title: pathlib: make `_Accessor.open()` return a file object and not a file 
descriptor
type: enhancement
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



[issue40094] Add os.status_to_exitcode() function

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

Interesting information about process "exit status code":
https://en.wikipedia.org/wiki/Exit_status

--

___
Python tracker 

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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 Thread Mouse


Mouse  added the comment:

@mark.dickinson, thank you. Following your suggestion, I've added a comment in 
#28965, and created a new issue https://bugs.python.org/issue40106.

--
nosy: +vstinner

___
Python tracker 

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



[issue28965] Multiprocessing spawn/forkserver fails to pass Queues

2020-03-29 Thread Mouse


Mouse  added the comment:

On MacOS Catalina 10.15.4, I still see this problem occasionally even with 
p.join() added. See https://bugs.python.org/msg365251 and subsequent messages.

Also, see https://bugs.python.org/issue40106.

--
nosy: +mouse07410

___
Python tracker 

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



[issue40106] multiprocessor spawn

2020-03-29 Thread Mouse


New submission from Mouse :

MacOS Catalina 10.15.3 and 10.15.4. Python-3.8.2 (also tested with 3.7.7, which 
confirmed the problem being in the fix described in 
https://bugs.python.org/issue33725.

Trying to use "multiprocessor" with Python-3.8 and with the new default of 
`set_start_method('spawn')` is nothing but a disaster.

Not doing join() leads to consistent crashes, like described here 
https://bugs.python.org/issue33725#msg365249

Adding p.join() immediately after p.start() seems to work, but increases the 
total run-time by factor between two and four, user time by factor of five, and 
system time by factor of ten. 

Occasionally even with p.join() I'm getting some processes crashing like  shown 
in https://bugs.python.org/issue33725#msg365249. 

I found two workarounds:
1. Switch back to 'fork' by explicitly adding `set_start_method('fork') to the 
__main__.
2. Drop the messy "multiprocessing" package and use "multiprocess" instead, 
which turns out to be a good and reliable fork of "multiprocessing".

If anybody cares to dig deeper into this problem, I'd be happy to provide 
whatever information that could be helpful.

Here's the sample code (again):
```
#!/usr/bin/env python3
#
# Test "multiprocessing" package included with Python-3.6+
#
# Usage:
#./mylti1.py [nElements [nProcesses [tSleep]]]
#
#nElements  - total number of integers to put in the queue
# default: 100
#nProcesses - total number of parallel processes/threads
# default: number of physical cores available
#tSleep - number of milliseconds for a thread to sleep
# after it retrieved an element from the queue
# default: 17
#
# Algorithm:
#   1. Creates a queue and adds nElements integers to it,
#   2. Creates nProcesses threads
#   3. Each thread extracts an element from the queue and sleeps for tSleep 
milliseconds
#

import sys, queue, time
import multiprocessing as mp


def getElements(q, tSleep, idx):
l = []  # list of pulled numbers
while True:
try:
l.append(q.get(True, .001))
time.sleep(tSleep)
except queue.Empty:
if q.empty():
print(f'worker {idx} done, got {len(l)} numbers')
return


if __name__ == '__main__':
nElements = int(sys.argv[1]) if len(sys.argv) > 1 else 100
nProcesses = int(sys.argv[2]) if len(sys.argv) > 2 else mp.cpu_count()
tSleep = float(sys.argv[3]) if len(sys.argv) > 3 else 17

# To make this sample code work reliably and fast, uncomment following line
#mp.set_start_method('fork')

# Fill the queue with numbers from 0 to nElements
q = mp.Queue()
for k in range(nElements):
q.put(k)

# Keep track of worker processes
workers = []

# Start worker processes
for m in range(nProcesses):
p = mp.Process(target=getElements, args=(q, tSleep / 1000, m))
workers.append(p)
p.start()

# Now do the joining
for p in workers:
p.join()
```

Here's the timing:
```
$ time python3 multi1.py
worker 9 done, got 5 numbers
worker 16 done, got 5 numbers
worker 6 done, got 5 numbers
worker 8 done, got 5 numbers
worker 17 done, got 5 numbers
worker 3 done, got 5 numbers
worker 14 done, got 5 numbers
worker 0 done, got 5 numbers
worker 15 done, got 4 numbers
worker 7 done, got 5 numbers
worker 5 done, got 5 numbers
worker 12 done, got 5 numbers
worker 4 done, got 5 numbers
worker 19 done, got 5 numbers
worker 18 done, got 5 numbers
worker 1 done, got 5 numbers
worker 10 done, got 5 numbers
worker 2 done, got 5 numbers
worker 11 done, got 6 numbers
worker 13 done, got 5 numbers

real0m0.325s
user0m1.375s
sys 0m0.692s
```

If I comment out the join() and uncomment set_start_method('fork'), the timing 
is
```
$ time python3 multi1.py
worker 0 done, got 5 numbers
worker 3 done, got 5 numbers
worker 2 done, got 5 numbers
worker 1 done, got 5 numbers
worker 5 done, got 5 numbers
worker 10 done, got 5 numbers
worker 6 done, got 5 numbers
worker 4 done, got 5 numbers
worker 7 done, got 5 numbers
worker 9 done, got 5 numbers
worker 8 done, got 5 numbers
worker 14 done, got 5 numbers
worker 11 done, got 5 numbers
worker 12 done, got 5 numbers
worker 13 done, got 5 numbers
worker 16 done, got 5 numbers
worker 15 done, got 5 numbers
worker 17 done, got 5 numbers
worker 18 done, got 5 numbers
worker 19 done, got 5 numbers

real0m0.175s
user0m0.073s
sys 0m0.070s
```

You can observe the difference.

Here's the timing if I don't bother with either join() or set_start_method(), 
but import "multiprocess" instead:
```
$ time python3 multi2.py 
worker 0 done, got 5 numbers
worker 1 done, got 5 numbers
worker 2 done, got 5 numbers
worker 4 done, got 5 numbers
worker 3 done, got 5 numbers
worker 5 done, got 5 numbers
worker 6 done, got 5 numbers
worker 8 done, got 5 numbers
worker 9 done, got 5 numbers
worker 7 done, got 5 numbers
worker 

[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 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



[issue40084] HTTPStatus has incomplete dir() listing

2020-03-29 Thread Angelin BOOZ


Change by Angelin BOOZ :


--
keywords: +patch
nosy: +lem
nosy_count: 4.0 -> 5.0
pull_requests: +18581
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/19219

___
Python tracker 

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



[issue40105] Updating zip comment doesn't truncate the zip file

2020-03-29 Thread Yudi


New submission from Yudi :

Updating the zip file comment to a shorter comment should truncate the zip file 
at the end of the new comment.
Instead, the new comment is written to the zip file but the file length stays 
the same.

For example, for a zip file that has the following zip comment:
b'This is my old amazing comment, I bet you really like it!' # 57 character long

Executing the following code:

zipFile = ZipFile(filePath, 'a')
zipFile.comment = b'My new shorter comment' # 22 character long
zipFile.close()

Will actually update the comment length in the zip header to the correct new 
length (22), but the bytecode will still have the following data:
b'My new shorter comment comment, I bet you really like it!'

Python reads the comment correctly since it relies on the comment length from 
the metadata (as far as I can tell), but the file is corrupt.

This is similar to the following old issue -
https://bugs.python.org/issue9239

But I wasn't sure whether to try and re-open that old one or create a new one.

Tested on version 3.8.2 (Windows 10).

Thanks!

--
components: Library (Lib)
messages: 365278
nosy: yudilevi
priority: normal
severity: normal
status: open
title: Updating zip comment doesn't truncate the zip file
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue24132] Direct sub-classing of pathlib.Path

2020-03-29 Thread Barney Gale


Barney Gale  added the comment:

I'm taking another look at making `pathlib` extensible. There's some discussion 
here: https://discuss.python.org/t/make-pathlib-extensible/3428

List or preparatory bugfixes and tidy-ups: 
https://docs.google.com/spreadsheets/d/1TicFDMudKKA6CZcrscg1Xq9kt5Q8To8y0hADGw9u11I/edit#gid=0

--
nosy: +barneygale

___
Python tracker 

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



[issue37973] improve docstrings of sys.float_info

2020-03-29 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 4.0 -> 5.0
pull_requests: +18580
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19218

___
Python tracker 

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



[issue40104] ElementTree does not find elements in a default namespace with namespaces

2020-03-29 Thread Myron Walker


Myron Walker  added the comment:

Looks like this is fixed in the latest source code.

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



[issue39950] Add pathlib.Path.hardlink_to()

2020-03-29 Thread Barney Gale


Barney Gale  added the comment:

A question:

For my patch, I need to include a Python version where `Path.link_to()` will 
become unavailable. I'm not entirely sure how this should be determined. Some 
factors in play:

- `link_to()` was added in Python 3.8
- On github, I found these three repos which use `link_to()`:
  - https://github.com/akubera/pion-analysis
  - https://github.com/DailyDreaming/load-project
  - https://github.com/eight04/vpip

Can anyone suggest in which version of Python this function should be removed? 
Thanks.

--

___
Python tracker 

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



[issue38337] inspect: getmembers calls properties

2020-03-29 Thread Jonas Drotleff

Jonas Drotleff  added the comment:

I'm still thinking about this bug/issue/undefined behaviour. Today I wanted to 
test its behaviour with async:

import inspect


class Foo:
def __init__(self, bar):
self._bar = bar

@property
async def spam(self):
print('Called spam')
return self._bar


if __name__ == '__main__':
instance = Foo('eggs')
members = inspect.getmembers(instance)

##

This will result in a RuntimeWarning:


RuntimeWarning: coroutine 'Foo.spam' was never awaited
  members = inspect.getmembers(instance)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback


Sure, async properties might not be particularly beautiful or best-practice, 
but I frequently stumble upon code where getmembers would fail – just like this 
example. However, I am still clueless about what to do.

--

___
Python tracker 

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



[issue40104] ElementTree does not find elements in a default namespace with namespaces

2020-03-29 Thread Myron Walker


New submission from Myron Walker :

When you have an xml document like the one with a default namespace below.  
When you try to lookup nodes in the document they are not found.

```
docTree.find("specVersion")
None
```

If you add a namespaces map with the '' key and the default namespaces like:

{ '': 'urn:schemas-upnp-org:device-1-0' }

then the nodes are still not found.  The issue is that there is a case
missing from xpath_tokenizer that does not yield a pair with the default 
namespace when one is specified.  Here is a fix.

https://github.com/myronww/cpython/commit/0fc65daca239624139f2a018a83f0b0ec04a8068




```
from xml.etree.ElementTree import fromstring as parse_xml_fromstring
from xml.etree.ElementTree import ElementTree

SAMPLEXML = """

10

urn:schemas-wifialliance-org:device:WFADevice:1
R7400 (Wireless AP)



rootNode = parse_xml_fromstring(SAMPLEXML)
# Create a namespaces map like { '': 'urn:schemas-upnp-org:device-1-0' }
defaultns = {"": docNode.tag.split("}")[0][1:]}

specVerNode = docNode.find("specVersion", namespaces=defaultns)
```
Results should look like this

```
docNode.find("specVersion", namespaces=defaultns)

```

--
components: Library (Lib)
messages: 365273
nosy: Myron Walker
priority: normal
severity: normal
status: open
title: ElementTree does not find elements in a default namespace with namespaces
type: behavior
versions: 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



[issue40098] dir() does not return the list of valid attributes for the object

2020-03-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

FWIW it might be a good idea to look into how PEP 585 could benefit from the 
improvements to dir(). Currently, dir(list) and dir(list[int]) are quite 
different -- only the former shows list methods like append and insert.

See https://github.com/gvanrossum/cpython/tree/pep585

--

___
Python tracker 

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



[issue40098] dir() does not return the list of valid attributes for the object

2020-03-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

I think you're going too far for some of these.

> 1. metaclasses

This is reasonable.

> 2. __mro__

This is also reasonable. (I wonder if that part of the dir() implementation 
predates __mro__?)  I'm not sure about honoring mro() in the metaclass, but it 
may be useful.

> 3. __dict__

I think this is probably a feature -- I can't think of a reason to override 
__dict__ as a property except when implementing some sort of proxy class, and 
then it's likely that there's a matching overrid of __getattr__.

> 4. __class__

Again, I think this is a feature. For example, PEP 585 overrides __class__:

>>> t = list[int]
>>> type(t)

>>> t.__class__


> 4.1 auto-creation of instance dict

This seems an accident of implementation, and if you can avoid it, that's 
better. (Though what use case of dir() currently suffers from memory overhead 
due to this?)

--

___
Python tracker 

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



[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread fireattack


fireattack  added the comment:

Here is another more bizarre showcase of the issue I come up with.

If you do:

```
import concurrent.futures
import time

def test():
time.sleep(3)
print('test')

ex = concurrent.futures.ThreadPoolExecutor(max_workers=10)
ex.submit(test)
```

This will print "test" after 3 seconds just fine.

Now, if you do:

```
import concurrent.futures
import time

def test():
time.sleep(3)
ex.submit(print, 'ex-print')
print('test') #this is not printed

ex = concurrent.futures.ThreadPoolExecutor(max_workers=10)
ex.submit(test)
```

Not only it doesn't print "ex-print", it does NOT even print "test" any more. 
And this is no error.

--

___
Python tracker 

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



[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread fireattack


fireattack  added the comment:

Hi gaoxinge, thanks for the reply.

I assume what you mean is that while shutdown will wait, it won't accept any 
new job/future after it is called.

That makes sense, but this still doesn't work:

```
from concurrent.futures import ThreadPoolExecutor
from time import sleep

def wait_on_future():
sleep(1)
f2 = executor.submit(pow, 5, 2)
print(f2.result())
executor.shutdown(wait=True) #Uncomment/comment this makes no difference

executor = ThreadPoolExecutor(max_workers=100)
f = executor.submit(wait_on_future)
```

This shows no error, but f2.result() is still not printed (`result()` has 
built-in wait). Actually, f2 is not executed at all (you can change pow to 
other func to see that).

Please notice this example is modified from an example from the official 
documentation: https://docs.python.org/3/library/concurrent.futures.html 

In that example, the comment says "This will never complete because there is 
only one worker thread and it is executing this function.", which is correct. 
But this is kinda misleading because it implies it will work if you increase 
the number of the worker. However, it will NOT work if you increase the number 
of worker, but also add a small delay, like shown above.

The point is, I failed to find a way to keep executor from main thread alive to 
accept future/job from a child thread if there is a delay. I tried 
shutdown/nothing/with/as_completed they all fail in similar fashion.

--

___
Python tracker 

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



[issue40102] Improve XLC support for function attributes

2020-03-29 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



[issue40103] ZipFile.extractall is not multiprocess safe with regard to directory creation.

2020-03-29 Thread Nathan Silberman


New submission from Nathan Silberman :

When extracting multiple zip files, each from a separate process, if the files 
being extracted are in nested directories and files across zips contain the 
same parent directories, the extraction process fails as one zip attempts to 
create a directory that was already created by the extraction call in another 
process.

--
components: Library (Lib)
messages: 365268
nosy: nathansilberman
priority: normal
severity: normal
status: open
title: ZipFile.extractall is not multiprocess safe with regard to directory 
creation.
type: behavior
versions: Python 3.5, 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



[issue40102] Improve XLC support for function attributes

2020-03-29 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
assignee:  -> BTaskaya

___
Python tracker 

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



[issue40102] Improve XLC support for function attributes

2020-03-29 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

XLC supports visibility, deprecated and aligned attributes (can be seen in this 
language reference 
https://www.ibm.com/support/pages/sites/default/files/support/swg/swgdocs.nsf/0/18b50c3c2309a37585257daf004d373e/%24FILE/langref.pdf)

--
messages: 365267
nosy: BTaskaya, pablogsal
priority: normal
severity: normal
status: open
title: Improve XLC support for function attributes
type: enhancement
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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 Thread Mark Dickinson


Mark Dickinson  added the comment:

@Mouse: replace the last block of your code with something like this:

# Start worker processes
workers = []
for m in range(nProcesses):
p = mp.Process(target=getElements, args=(q, tSleep / 1000, m))
workers.append(p)
p.start()

# Wait for all workers to complete
for p in workers:
p.join()

But I don't think this tracker issue is the right place to have this 
conversation. It's highly unlikely that this change will be reverted - there 
are strong reasons to avoid fork on macOS, and the issue you're reporting isn't 
directly related to this one: it's an issue with using "spawn" on any OS.

However, there may be scope for improving the documentation so that fewer users 
fall into this trap. I'd suggest opening another issue for that, or continuing 
the conversation on #28965.

--

___
Python tracker 

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



[issue40090] The referenced RFC for the json module should be corrected to rfc8259

2020-03-29 Thread Ama Aje My Fren


Ama Aje My Fren  added the comment:

I am not the expert on this but I did a swift check of the two documents
before doing the documentation PR
.

>From my reading of the two, RFC8259
 seems that:

   This document's goal is to apply the errata, remove inconsistencies
   with other specifications of JSON, and highlight practices that can
   lead to interoperability problems.

When one reads a diff of the two RFCs together
, the only place that seems to
have changed from a protocol point of view is in Section 8.1 (RFC 7159
, RFC 8259
)  which now (RFC
8259) requires that all data should be encoded using UTF-8.

The security section 
in the current (RFC 8259) standard states:

   certain characters such as U+2028 LINE SEPARATOR and U+2029
   PARAGRAPH SEPARATOR are legal in JSON but not JavaScript

(This has changed in the latest ECMAScript Edition)

Therefore from my understanding:

1. which document better describes the behavior of our json module?

 The json module allows for utf-16 and utf-32 encoding in the loads
method. It does not appear to enforce the utf-8 encoding - so closer
to RFC 7159.

2. Does it need to be updated along with a doc change?

Maybe. I defer to the maintainers of the module.

On Sun, Mar 29, 2020 at 2:09 AM Terry J. Reedy 
wrote:

>
> Terry J. Reedy  added the comment:
>
> The header for 8259 says "Obsoletes: 7159" (December 2017) and the header
> for 7159 agrees: "Obsoleted by: 8259".  But... to the extent that there is
> any difference, which document better describes the behavior of our json
> module?  Does it need to be updated along with a doc change?
>
> --
> nosy: +ezio.melotti, rhettinger, terry.reedy
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40096] Support _Py_NO_RETURN on XLC

2020-03-29 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:


New changeset 0003c2dc1d4cf5b122e73e83177fd274fa9a9913 by Batuhan Taşkaya in 
branch 'master':
bpo-40096: Support __attribute__((__noreturn__)) on xlc (GH-19204)
https://github.com/python/cpython/commit/0003c2dc1d4cf5b122e73e83177fd274fa9a9913


--
nosy: +pablogsal

___
Python tracker 

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



[issue40096] Support _Py_NO_RETURN on XLC

2020-03-29 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 Thread Mouse


Mouse  added the comment:

Also, adding `p.join()` immediately after `p.start()` in my sample code showed 
this timing:
```
$ time python3.8 multi1.py 
worker 0 done, got 100 numbers
worker 1 done, got 0 numbers
worker 2 done, got 0 numbers
worker 3 done, got 0 numbers

real0m2.342s
user0m0.227s
sys 0m0.111s
$ 
```

Setting instead start to `fork` showed this timing:
```
$ time python3.8 multi1.py 
worker 2 done, got 25 numbers
worker 0 done, got 25 numbers
worker 1 done, got 25 numbers
worker 3 done, got 25 numbers

real0m0.537s
user0m0.064s
sys 0m0.040s
$ 
```

The proposed fix is roughly four times slower, compared to reverting start to 
`fork`.

--

___
Python tracker 

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



[issue40001] ignore errors in SimpleCookie

2020-03-29 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy:  -BTaskaya

___
Python tracker 

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



[issue40001] ignore errors in SimpleCookie

2020-03-29 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
pull_requests:  -18577

___
Python tracker 

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



[issue40101] lib2to3 fails on default convert functionality

2020-03-29 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



[issue40001] ignore errors in SimpleCookie

2020-03-29 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya
nosy_count: 2.0 -> 3.0
pull_requests: +18577
pull_request: https://github.com/python/cpython/pull/19214

___
Python tracker 

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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 Thread Mouse


Mouse  added the comment:

@mark.dickinson, the issue you referred to did not show a working sample. Could 
you demonstrate on my example how it should be applied? Thanks!

--

___
Python tracker 

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



[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread gaoxinge


gaoxinge  added the comment:

The workflow is like below:

- executor submit wait_on_future, and return the future f
- executor call shutdown
- executor submit pow (because executor already call shutdown, this submit will 
fail and raise a runtime error)
- then fail above will cause work thread fail when running wait_on_future
- then work thread will set both done singal and exception to f, which is the 
future of wait_on_future

--

___
Python tracker 

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



[issue40101] lib2to3 fails on default convert functionality

2020-03-29 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

When using driver/parser without a custom convert function (like 
pyconvert.convert),  it tries to assign used_names to the root node, which can 
be anything depending on the given convert function. If none given, it will be 
a tuple. 

>>> from lib2to3.pygram import python_grammar
>>> from lib2to3.pgen2.driver import Driver
>>> 
>>> d = Driver(grammar=python_grammar)
>>> d.parse_string("test\n")
Traceback (most recent call la

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.9/lib2to3/pgen2/driver.py", line 103, in 
parse_string
return self.parse_tokens(tokens, debug)
  File "/usr/local/lib/python3.9/lib2to3/pgen2/driver.py", line 71, in 
parse_tokens
if p.addtoken(type, value, (prefix, start)):
  File "/usr/local/lib/python3.9/lib2to3/pgen2/parse.py", line 136, in addtoken
self.pop()
  File "/usr/local/lib/python3.9/lib2to3/pgen2/parse.py", line 204, in pop
self.rootnode.used_names = self.used_names
AttributeError: 'tuple' object has no attribute 'used_names'

--
components: Library (Lib)
messages: 365260
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: lib2to3 fails on default convert functionality
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



[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread gaoxinge


gaoxinge  added the comment:

```
from concurrent.futures import ThreadPoolExecutor
from time import sleep

def wait_on_future():
sleep(1)
print(f.done()) # f is not done obviously
f2 = executor.submit(pow, 5, 2)
print(f2.result())
sleep(1)


executor = ThreadPoolExecutor(max_workers=100)
f = executor.submit(wait_on_future)
executor.shutdown(wait=True)
print(f.done()) # True
print(f.result())   # raise errror: cannot schedule new futures after 
shutdown
# print(f.exception())
```

Actually `executor.shutdown(wait=True)` works, it really wait f to be done.

--
nosy: +gaoxinge

___
Python tracker 

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



[issue40094] Add os.status_to_exitcode() function

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

I modified my PR to add Windows support. On Windows, os.waitpid() status also 
requires an operation (shif right by 8 bits) to get an exitcode from the 
waitpid status. So IMO it's worth it to add it to Windows as well, which makes 
the function even more useful ;-)

--

___
Python tracker 

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



[issue40077] Convert static types to PyType_FromSpec()

2020-03-29 Thread Dong-hee Na


Dong-hee Na  added the comment:

> You pass a *type to isinstance() in bench_isinstance_check.py.

Thanks for the catch my mistake.

The result is showing:
Not significant (1): bench _abc_instancecheck

--
Added file: https://bugs.python.org/file49009/bench_isinstance_check.py

___
Python tracker 

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



[issue39982] FreeBSD: SCTP tests of test_socket fails on AMD64 FreeBSD Shared 3.x

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

Wow wow wow, that's huge. Python helps to detect FreeBSD kernel bugs :-)

Thanks a lot Kubilay Kocak!

--

___
Python tracker 

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



[issue40077] Convert static types to PyType_FromSpec()

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

IMO 1.01x slower on a *microbenchmark* is not significant so it's ok. Thanks 
for checking.

You pass a *type to isinstance() in bench_isinstance_check.py. You should pass 
*an instance* instead. Like (complete the (...) ;-)):

runner.timeit(name="bench _abc_instancecheck",
  stmt="isinstance(obj, T)",
  setup = """from abc import ABC (...) obj = (1, 2, 3)""")

Would you mind to fix your microbenchmark and re-run it?

--

___
Python tracker 

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



[issue40024] Add PyModule_AddType helper function

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Dong-hee Na for fixing many reference leaks! I like the new 
PyModule_AddType() helper function.

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



[issue40024] Add PyModule_AddType helper function

2020-03-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 016bdd519d76c282bbe0220c67a49226b6262638 by Dong-hee Na in branch 
'master':
bpo-40024: Update _elementtree to use PyModule_AddType() (GH-19205)
https://github.com/python/cpython/commit/016bdd519d76c282bbe0220c67a49226b6262638


--

___
Python tracker 

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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 Thread Mark Dickinson


Mark Dickinson  added the comment:

@Mouse: see #28965. The fix for the code you show is to join the child 
processes before the main process starts exiting.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 Thread Mouse


Mouse  added the comment:

Tried 'spawn', 'fork', 'forkserver'. 

- 'spawn' causes consistent `FileNotFoundError: [Errno 2] No such file or 
directory`;
- 'fork' consistently works (tested on machines with 4 and 20 cores);
- 'forkserver' causes roughly half of the processes to crash with 
`FileNotFoundError`, the other half succeeds (weird!).

--

___
Python tracker 

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



[issue40100] IDLE: Undesired behavior of emoji in editor.

2020-03-29 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Terminal codepages are irrelevant in the IDLE tk based gui.  The problem is 
that windows codes astral chars as two surrogates.  While tkinter can display 
them, after recent changes to _tkinter, the text widget cannot handle then 
properly when editing.  This was explained in more detail on an earlier issue, 
but I will have to check if there is already an issue for fixing it.

For editing, one should use unicode escapes, as in

>>> print('\U0001f60d')


Python in a Windows console prints the surrogates separately.


and in IDLE, one will see a black-and_white version of the smiley.

--
title: Unexpected behavior when handling emoji under codec cp936 -> IDLE: 
Undesired behavior of emoji in editor.

___
Python tracker 

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



[issue33725] Python crashes on macOS after fork with no exec

2020-03-29 Thread Mouse


Mouse  added the comment:

The fix applied for this problem actually broke multiprocessing on MacOS. The 
change to the new default 'spawn' from 'fork' causes program to crash in 
spawn.py with `FileNotFoundError: [Errno 2] No such file or directory`.

I've tested this on MacOS Catalina 10.15.3 and 10.15.4, with Python-3.8.2 and 
Python-3.7.7.

With Python-3.7.7 everything works as expected.

Here's the output:
{{{
$ python3.8 multi1.py 
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py",
 line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/spawn.py",
 line 126, in _main
self = reduction.pickle.load(from_parent)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/synchronize.py",
 line 110, in __setstate__
self._semlock = _multiprocessing.SemLock._rebuild(*state)
FileNotFoundError: [Errno 2] No such file or directory
}}}

Here's the program:
{{{
#!/usr/bin/env python3
#
# Test "multiprocessing" package included with Python-3.6+
#
# Usage:
#./mylti1.py [nElements [nProcesses [tSleep]]]
#
#nElements  - total number of integers to put in the queue
# default: 100
#nProcesses - total number of parallel processes/threads
# default: number of physical cores available
#tSleep - number of milliseconds for a thread to sleep
# after it retrieved an element from the queue
# default: 17
#
# Algorithm:
#   1. Creates a queue and adds nElements integers to it,
#   2. Creates nProcesses threads
#   3. Each thread extracts an element from the queue and sleeps for tSleep 
milliseconds
#

import sys, queue, time
import multiprocessing as mp


def getElements(q, tSleep, idx):
l = []  # list of pulled numbers
while True:
try:
l.append(q.get(True, .001))
time.sleep(tSleep)
except queue.Empty:
if q.empty():
print(f'worker {idx} done, got {len(l)} numbers')
return


if __name__ == '__main__':
nElements = int(sys.argv[1]) if len(sys.argv) > 1 else 100
nProcesses = int(sys.argv[2]) if len(sys.argv) > 2 else mp.cpu_count()
tSleep = float(sys.argv[3]) if len(sys.argv) > 3 else 17

# Uncomment the following line to make it working with Python-3.8+
#mp.set_start_method('fork')

# Fill the queue with numbers from 0 to nElements
q = mp.Queue()
for k in range(nElements):
q.put(k)

# Start worker processes
for m in range(nProcesses):
p = mp.Process(target=getElements, args=(q, tSleep / 1000, m))
p.start()
}}}

--
nosy: +mouse07410
type:  -> crash

___
Python tracker 

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



[issue40003] test.regrtest: add an option to run test.bisect_cmd on failed tests, use it on Refleaks buildbots

2020-03-29 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40024] Add PyModule_AddType helper function

2020-03-29 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-29 Thread hai shi


hai shi  added the comment:

> I believe it's a known problem with either `import_fresh_module` or `datetime`
after removed the cleanup operation of `sys.modules` in PR19213, the  testcases 
is successed in my local vm(I am not sure there have any other potential risks).

--

___
Python tracker 

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



[issue40058] Running test_datetime twice fails with: module 'datetime' has no attribute '_divide_and_round'

2020-03-29 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue40100] Unexpected behavior when handling emoji under codec cp936

2020-03-29 Thread Alex

New submission from Alex <2423067...@qq.com>:

Python 3.8.2 IDLE has an unexpected behavior.
When I insert an emoji into IDLE like ''.
Then I found I can't delete it(by typing backspace).
When I type the left arrow then it became '��'(U+FFFD).
Then I type the left arrow again, then it is '' again!
(When I use the delete button, or type the right button there aren't any bugs.)
What's wrong?
Also, when I have two emojis like '', I press delete button between them, 
nothing happens; when I delete on the right, both of them disappear!
(This bug seems not appears on plain 0.)

--
assignee: terry.reedy
components: IDLE
messages: 365247
nosy: Alex-Python-Programmer, terry.reedy
priority: normal
severity: normal
status: open
title: Unexpected behavior when handling emoji under codec cp936
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue40051] Dead link in help(lib2to3/idlelib/turtledemo/tkinter.sub/test_*/?)

2020-03-29 Thread wyz23x2


wyz23x2  added the comment:

My opinion:
I think No.2 makes more sense to users that visit the docs directly by 
https://docs.python.org/3.8/library/lib2to3.html; they will copy the 
"docs.python.org/version/library/modulename.html" format from other modules. 
But I also agree it's fragile.
No.3 is good too, according to me. Can use it if No.2 is too fragile.

--

___
Python tracker 

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