[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Because '{' in '{:3' is a drive letter. When you open file with path '{:3' you 
open file with name '3' in the current directory of drive '{', not file with 
name '{:3' on current drive and directory.

It is not a Python bug. If you think there is a bug, please file a report for 
Windows. The behavior of os.path.join() will be changed after Windows change 
its file path resolution rules.

--
nosy: +serhiy.storchaka -2262720766
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



[issue41564] Cannot access member "hex" for type "ByteString"

2020-08-18 Thread Eric V. Smith


Change by Eric V. Smith :


--
status: open -> pending

___
Python tracker 

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



[issue41566] Include much faster DEFLATE implementations in Python's gzip and zlib libraries. (isa-l)

2020-08-18 Thread Ruben Vorderman


Ruben Vorderman  added the comment:

I just find out that libdeflate does not support streaming: 
https://github.com/ebiggers/libdeflate/issues/73 . I should have read the 
manual better.

So that explains the memory usage. Because of that I don't think it is suitable 
for usage in CPython.

--

___
Python tracker 

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



[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Eryk Sun

Eryk Sun  added the comment:

> I mean,os.path.join('3', '{:3')  return  '{:3' in windows, However, 
> os.path.join('3', '{:3') return  '3/{:3'in linux, output result not 
> '3' in windows, why?

The implementation of ntpath.join handles "{:" as a drive. Thus "{:3" is a 
drive-relative path, i.e. "3" is relative to the current working directory on 
drive "{:". 

In particular, for each joined component, ntpath.join calls ntpath.splitdrive, 
which splits at the second character if it's a colon, regardless of the first 
character. For example:

>>> ntpath.splitdrive('{:3')
('{:', '3')

As demonstrated in my previous post, the Windows file API supports drive names 
that use any basic multilingual plane (BMP) character, including symbol 
characters such as "{". So the long-standing behavior of ntpath.splitdrive in 
this regard is generally right. Except it shouldn't allow the first character 
to be a path separator, i.e. the following result is nonsense:

>>> ntpath.splitdrive('/:/spam')
('/:', '/spam')

> with path '{:3' you open file with name '3' in the current 
> directory of drive '{'

The drive name would be "{:", not "{". It's a common usage, for example, to 
call "C:" the "C" drive, but the drive name actually includes the colon. This 
differs from the usage of colon in file streams, in which the colon is a 
delimiter that's not part of the name.

--

___
Python tracker 

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



[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Paul Moore


Paul Moore  added the comment:

I think the key point here is that os.path.join is *meant* to have 
platform-native semantics, so it treats '{:' as a drive letter on Windows, but 
Linux doesn't have drive letters, so os.path.join treats '{:' as a normal part 
of a filename on Linux.

--

___
Python tracker 

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



[issue41401] Using non-ascii that require UTF-8 breaks AIX testing

2020-08-18 Thread Michael Felt


Michael Felt  added the comment:

As much as I wish I had the skills to do the cherry picking - I am not going to 
touch this.

The AIX bots for 3.9 branch continue to report broken for test_io (ENV change) 
- as they still wait for the backport for that branch!

--

___
Python tracker 

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



[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Eryk Sun


Eryk Sun  added the comment:

It's worth mentioning that pathlib restricts the first character of a Windows 
drive name to the set of ASCII letters in 
pathlib._WindowsFlavour.drive_letters. For example:

>>> Path('3') / 'C:3'
WindowsPath('C:3')

vs.

>>> Path('3') / '{:3'
WindowsPath('3/{:3')

This design supports normal DOS drive names such as drives assigned 
automatically or via diskmgmt.msc, diskpart.exe, and so on.

--

___
Python tracker 

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



[issue41513] Scale by power of two in math.hypot()

2020-08-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Hmm, I tried-out a C implementation and the timings weren't bad, 60% slower in 
exchange for always being correctly rounded.  Do you all think that would be 
worth it?

# New correctly rounded
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.5, 
0.3, 5.2)'
200 loops, best of 11: 101 nsec per loop
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.81)'
500 loops, best of 11: 82.8 nsec per loop

# Current baseline for Python 3.10
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.5, 
0.3, 5.2)'
500 loops, best of 11: 65.6 nsec per loop
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.81)'
500 loops, best of 11: 56.6 nsec per loop

# Current baseline for Python 3.9
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.5, 
0.3, 5.2)'
500 loops, best of 11: 72.2 nsec per loop
~/npython $ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 
15.81)'
500 loops, best of 11: 56.2 nsec per loop

--
status: closed -> open

___
Python tracker 

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



[issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication.

2020-08-18 Thread Prudent


New submission from Prudent :

I am writing codes for opening file dialog to select a file by clicking a 
button. The function I used was "askopenfilename()" in tkinter.filedialog 
module. However, a warning displayed when I ran the code. And, the file filter 
option was also disabled after one click. The displayed warning was below.

--
components: macOS
files: warning.png
messages: 375601
nosy: Prudent, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Python[11231:143796] WARNING:  running 
implicitly; please run panels using NSSavePanel rather than NSApplication.
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49403/warning.png

___
Python tracker 

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



[issue41513] Scale by power of two in math.hypot()

2020-08-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +21032
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/21916

___
Python tracker 

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



[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread song super


song super <2262720...@qq.com> added the comment:

Think you very much,I am a college student, do not understand these underlying 
principles, this problem is I wrote a program on Linux, later moved to the 
windows system found, thank you very much for your answers

--
nosy: +2262720766
status: closed -> open

___
Python tracker 

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



[issue41575] Please use active voice "Return foobar" instead of passive voice "foobar is returned"

2020-08-18 Thread Denilson Figueiredo de Sá

New submission from Denilson Figueiredo de Sá :

When reading the documentation for call_soon(), call_later(), call_at(), and 
several other functions, the sentence that describes the return value is in 
passive voice:
https://docs.python.org/3/library/asyncio-eventloop.html

> An instance of asyncio.TimerHandle is returned which can be used to cancel 
> the callback.

The problem:

Most functions in Python documentation describe the return value by "Return 
foobar", an active voice sentence at the beginning of a paragraph. (e.g. 
https://docs.python.org/3/library/functions.html ) Thus, for the reader, it's 
easy to quickly skim the text for the return value. Even easier because the 
reader is already trained to do so, given other occurrences in the 
documentation.

However, by hiding "is returned" in the middle of the sentence/paragraph, the 
reader can't easily find the return value, having to carefully read through all 
the text. Not only this is slower, but way more difficult if the reader is in a 
hurry or tired. (That was my case, I missed that sentence even after looking at 
the documentation several times.)

Solution:

Change it to: Return an instance of asyncio.TimerHandle which can be used to 
cancel the callback.

Further solution:

Search the documentation for other cases of "is returned" and consider if it is 
worth rewording as active voice.

Bonus link: https://developers.google.com/tech-writing/one/active-voice

--
assignee: docs@python
components: Documentation
messages: 375603
nosy: denilsonsa, docs@python
priority: normal
severity: normal
status: open
title: Please use active voice "Return foobar" instead of passive voice "foobar 
is returned"
type: enhancement
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



[issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication.

2020-08-18 Thread E. Paine


E. Paine  added the comment:

To help us to reproduce the issue, please give your Python version, Tcl/Tk 
patchlevel (`tkinter.test.support.get_tk_patchlevel()`), MacOS version and a 
small demonstration script (along with exact keystrokes/clicks if necessary). I 
suspect this is another Tcl/Tk issue rather than a tkinter problem with this 
warning being because the MacOS API has changed slightly.

--
components: +Tkinter
nosy: +epaine

___
Python tracker 

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



[issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication.

2020-08-18 Thread Prudent


Prudent  added the comment:

The versions of Python, Tcl/Tk and MacOS I used are 3.8.5, 8.5.9 and the newest 
Catalina 10.15.6, respectively. 

Your words give me a hint about the version of Tcl/Tk. So I checked it. The 
version I used seems too old, the newest version for it is 8.6. In my thoughts, 
I always thought those embedded packages could be automatically upgraded after 
I re-installed a newer python. However, it seems the packages are not be 
updated as expected.

--

___
Python tracker 

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



[issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication.

2020-08-18 Thread E. Paine


E. Paine  added the comment:

Ned, does it appear like Python is using the MacOS built-in Tcl version? My 
(very limited) understanding is that Python will default to the Tcl version 
packaged with it (which is currently 8.6.8).

--

___
Python tracker 

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



[issue41576] document BaseException in favour of bare except in error tutorial

2020-08-18 Thread Thomas Grainger


Change by Thomas Grainger :


--
assignee: docs@python
components: Documentation
nosy: docs@python, graingert
priority: normal
pull_requests: 21033
severity: normal
status: open
title: document BaseException in favour of bare except in error tutorial

___
Python tracker 

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



[issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication.

2020-08-18 Thread Prudent


Prudent  added the comment:

Yes, you are right. Just now, I re-installed Python3.8.5. But when I opened my 
.py file with tkinter and ran it, it still linked to the old Tcl/Tk(8.5.9) in 
Python3.7.5. However, when I ran the command "python3 -m tkinter" to check its 
version. It showed me the new version 8.6. My understanding is that when a 
newer python is installed, the old files are not replaced. Both of them are 
kept in computer. Is it right? So, I should manually remove those old files, 
right?

--

___
Python tracker 

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



[issue41576] document BaseException in favour of bare except in error tutorial

2020-08-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

What a problem do you try to solve? What is wrong with the current 
documentation?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41576] document BaseException in favour of bare except in error tutorial

2020-08-18 Thread Thomas Grainger


Thomas Grainger  added the comment:

it seems odd to document digging around in sys.exc_info() in favour of the more 
ergonomic syntax to do the same thing

--

___
Python tracker 

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



[issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication.

2020-08-18 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

How did you install Python? Did you use the installer on Python.org or some 
other method?

A script that demonstrates the problem would be useful as well, I've tried to 
reproduce the problem in an interactive session in the terminal:

>>> from tkinter import filedialog
>>> filedialog.askopenfilename()

This works for me, I also don't get the warning in the attached image.

---

Which version of Tk is used depends on how Python is installed. The Python.org 
installers ship with a copy of Tk for use by Tkinter. Every version (3.7, 3.8, 
...) you install ships with its own copy of Tk and won't use the copy of Tk 
from a different install.

Other distributions of Python (home-brew, anaconda, ...) might arrange thing 
differently.

--

___
Python tracker 

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



[issue41573] Correct wrong sentences in General FAQ

2020-08-18 Thread Mika Hawkins


Mika Hawkins  added the comment:

Submitted.

Regards,
Mika Hawkins

--
nosy: +Mika_Hawkins

___
Python tracker 

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



[issue41553] encoded-word abused for header line folding causes RFC 2047 violation

2020-08-18 Thread Mika Hawkins


Mika Hawkins  added the comment:

Truly for the vault changes. I thought we had fixed the bug that was causing 
message-id to get encoded, yet perhaps it despite everything exists in 3.7? I 
don't recall when we fixed it (and I might be recollecting incorrectly!) 

With respect to X-"unstructured headers" getting destroyed, by *definition* in 
the rfc, if the header body is unstructured it must help RFC encoding. In the 
event that doesn't, it's anything but an unstructured header field. Which is 
the reason I said we have to consider what attributes the default parser ought 
to have. The RFC doesn't generally address that, it anticipates that each 
header should be one of the characterized types...but while a X-header may be 
of a characterized type, the email bundle can't realize that except if it is 
told, so what would it be a good idea for us to use as the default parsing 
procedure? "text without encoded words" isn't generally RFC consistent, I 
think. (In spite of the fact that I'll let it be known has been some time since 
I last explored the important RFCs.) 

Note that I accept that we have an open issue (or if nothing else an open 
conversation) that we should change the 'refold_source' default from 'long' to 
'none', which implies that X-headers would in any event be gone through of 
course. It would likewise alleviate this issue, and can be utilized as a nearby 
workaround for headers that are simply getting gone through and not altered.

Regards,
Mika Hawkins

--
nosy: +Mika_Hawkins

___
Python tracker 

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



[issue33051] IDLE: Create new tab for editor options in configdialog

2020-08-18 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@epaine, thank you for taking a look at that PR and for your feedback.  I agree 
with you that the changes can still be taken further than we've already done.  
`init_validators` was added after the initial refactoring and I'm not sure if 
we've gone back to it to really use it or any other input validators.  There's 
another bug issue (#31306) that addresses the validation on configdialog, so 
maybe your ideas can be incorporated with that issue.

--

___
Python tracker 

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



[issue39345] Py_Initialize Hangs on Windows 10

2020-08-18 Thread Fieschi


Change by Fieschi :


--
nosy: +feellemon

___
Python tracker 

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



[issue41560] pathlib.Path.glob fails on empty string

2020-08-18 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pitrou

___
Python tracker 

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



[issue41577] Cannot use ProcessPoolExecutor if in a decorator?

2020-08-18 Thread Bob Fang


New submission from Bob Fang :

I have this minimal example:

```
from functools import wraps
from concurrent import futures
import random

def decorator(func):
num_process = 4

def impl(*args, **kwargs):
with futures.ProcessPoolExecutor() as executor:
fs = []
for i in range(num_process):
fut = executor.submit(func, *args, **kwargs)
fs.append(fut)
result = []
for f in futures.as_completed(fs):
result.append(f.result())
return result
return impl

@decorator
def get_random_int():
return random.randint(0, 100)


if __name__ == "__main__":
result = get_random_int()
print(result)
```
If we try to run this function I think we will have the following error:
```
_pickle.PicklingError: Can't pickle : it's not the same object as __main__.get_random_int
```
I think the main issue here is that the "wraps" decorator itself alters the 
`func` object and thus make it impossible to pickle. I found this rather 
strange. I am just wondering if there is any way to get around this behavior? I 
would want to use `wraps` if possible. Thanks!

--
components: Library (Lib)
messages: 375614
nosy: bob.fang.london
priority: normal
severity: normal
status: open
title: Cannot use ProcessPoolExecutor if in a decorator?
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



[issue41577] Cannot use ProcessPoolExecutor if in a decorator?

2020-08-18 Thread Bob Fang


Change by Bob Fang :


--
versions: +Python 3.6, Python 3.7, Python 3.9

___
Python tracker 

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



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-18 Thread Brett Cannon


New submission from Brett Cannon :

https://docs.python.org/3/reference/datamodel.html#object.__ror__ has a note 
saying:

"If the right operand's type is a subclass of the left operand's type and that 
subclass provides the reflected method for the operation, this method will be 
called before the left operand's non-reflected method." The slightly unclear 
part (at least to me) is the "provides the reflected method."

What this actually means according to https://bugs.python.org/issue30140 is 
that the subclass **implements** the `__r*__` method, not just that the method 
is reachable on the subclass via getattr(). That wasn't clear to me when I 
initially read this.

--
assignee: docs@python
components: Documentation
messages: 375621
nosy: brett.cannon, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: Clarify documentation for binary arithmetic operation subclass __r*__ 
precedence
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



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-18 Thread Brett Cannon


Change by Brett Cannon :


--
assignee: docs@python -> brett.cannon

___
Python tracker 

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



[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Eryk Sun


Change by Eryk Sun :


--
status: open -> closed
type: compile error -> behavior

___
Python tracker 

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



[issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence

2020-08-18 Thread Brett Cannon


Brett Cannon  added the comment:

Or to be more clear, the RHS subclass must provide a **different** 
implementation of the method than the LHS.

--

___
Python tracker 

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



[issue41513] Scale by power of two in math.hypot()

2020-08-18 Thread Tim Peters


Tim Peters  added the comment:

About speed, the fsum() version I posted ran about twice as fast as the 
all-Decimal approach, but the add_on() version runs a little slower than 
all-Decimal. I assume that's because fsum() is coded in C while the add_on() 
prototype makes mounds of additional Python-level function calls. Using 
released Windows 3.8.5 CPython and on argument vectors of length 50.

Is it worth it? Up to you ;-) There are good arguments to be made in favor of 
increased accuracy, and in favor of speed.

About "correctly rounded", such a claim can only be justified by proof, not by 
testing (unless testing exhaustively covers the entire space of inputs). Short 
of that, best you can claim is stuff like "max error < 0.51 ulp" (or whatever 
other bound can be proved).

--

___
Python tracker 

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



[issue35024] Incorrect logging in importlib when '.pyc' file creation fails

2020-08-18 Thread Brett Cannon


Brett Cannon  added the comment:

It looks like it! Thanks, Irit!

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



[issue41585] policy.max_line_length is incorrectly assumed to never be None

2020-08-18 Thread Erik Quaeghebeur

New submission from Erik Quaeghebeur :

I got the following error (Python 3.7.8):

Traceback (most recent call last):
  File "/home/equaeghe/.local/bin/html2alternative.py", line 68, in 
replaceable.add_alternative(plain)
  File "/usr/lib/python3.7/email/message.py", line 1153, in add_alternative
self._add_multipart('alternative', *args, **kw)
  File "/usr/lib/python3.7/email/message.py", line 1144, in _add_multipart
part.set_content(*args, **kw)
  File "/usr/lib/python3.7/email/message.py", line 1171, in set_content
super().set_content(*args, **kw)
  File "/usr/lib/python3.7/email/message.py", line 1101, in set_content
content_manager.set_content(self, *args, **kw)
  File "/usr/lib/python3.7/email/contentmanager.py", line 37, in set_content
handler(msg, obj, *args, **kw)
  File "/usr/lib/python3.7/email/contentmanager.py", line 185, in 
set_text_content
cte, payload = _encode_text(string, charset, cte, msg.policy)
  File "/usr/lib/python3.7/email/contentmanager.py", line 154, in _encode_text
max(len(x) for x in lines) <= policy.max_line_length):
TypeError: '<=' not supported between instances of 'int' and 'NoneType'

This is triggered because it is incorrectly assumed that policy.max_line_length 
cannot be None. This issue is still present in current master:

https://github.com/python/cpython/blob/c3dd7e45cc5d36bbe2295c2840faabb5c75d83e4/Lib/email/contentmanager.py#L149

--
components: email
messages: 375625
nosy: barry, equaeghe, r.david.murray
priority: normal
severity: normal
status: open
title: policy.max_line_length is incorrectly assumed to never be None
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-18 Thread Stefan Krah


Stefan Krah  added the comment:

The original patch is a bit dated, do we still need the export symbol 
generation?

https://www.ibm.com/support/knowledgecenter/en/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/proguide/compiling_shared_aix.html

"Use the -G option to create a shared library from the generated object files, 
and to enable runtime linking with applications that support it."

"If you do not specify a -bE option, all the global symbols are exported except 
for those symbols that have the hidden or internal visibility attribute."

--

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-18 Thread David Edelsohn


David Edelsohn  added the comment:

Yes, export file generation still is required.

Python does not need to utilize runtime linking.  Using -G is a very bad choice 
and severely discouraged with severe performance and other penalties.

--

___
Python tracker 

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



[issue39345] Py_Initialize Hangs on Windows 10

2020-08-18 Thread Steve Dower


Steve Dower  added the comment:

Are you able to capture a process dump at the hang? I haven't seen this 
anywhere else, and don't even know how to go about trying to reproduce it with 
this information - Py_Initialize is called by every single Python process, so 
there's something special about your situation that isn't obvious yet :)

--

___
Python tracker 

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



[issue41483] Do not acquire lock in MemoryHandler.flush() if no target defined

2020-08-18 Thread Irit Katriel


Irit Katriel  added the comment:

I think it is unlikely that this change would make a measurable speedup 
(benchmarks would be needed to prove that it does).

And even if it does, it's for the case where no target has been set, in which 
case the logger isn't doing anything anyway. Why is this a case worth 
optimizing?

--

___
Python tracker 

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



[issue23802] patch: __deepcopy__ memo dict argument usage

2020-08-18 Thread Irit Katriel


Irit Katriel  added the comment:

This seems resolved, can it be closed?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue23802] patch: __deepcopy__ memo dict argument usage

2020-08-18 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


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



[issue41541] [PATCH] Make pty.spawn set window size

2020-08-18 Thread Soumendra Ganguly


Soumendra Ganguly  added the comment:

v0.5 had introduced minor mistakes + one hack [ was using master instead of 
slave to set window size ]. v0.6 removes all such mistakes.

--
Added file: https://bugs.python.org/file49404/pty.diff

___
Python tracker 

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



[issue41577] Cannot use ProcessPoolExecutor if in a decorator?

2020-08-18 Thread Kyle Stanley


Kyle Stanley  added the comment:

Due to the way pickle works, it's not presently possible to serialize wrapped 
functions directly, at least not in a way that allows you to pass it to 
executor.submit() within the inner function (AFAICT). I'm also not certain what 
it would involve to provide that, or if it would be feasible to do so in a 
manner that would be backwards compatible.

In the meantime, this is a decent work-around:

```
from concurrent import futures
import random

class PPEWrapper:
def __init__(self, func, num_proc=4):
self.fn = func
self.num_proc = num_proc

def __call__(self, *args, **kwargs):
with futures.ProcessPoolExecutor() as executor:
fs = []
for i in range(self.num_proc):
fut = executor.submit(self.fn, *args, **kwargs)
fs.append(fut)
result = []
for f in futures.as_completed(fs):
result.append(f.result())
return result


def _get_random_int():
return random.randint(0, 100)

# it's often quite useful anyways to have a parallel and non-parallel version
# (for testing and devices that don't support MP)
get_random_int = PPEWrapper(_get_random_int, num_proc=4)

if __name__ == "__main__":
result = get_random_int()
print(result)
```

This doesn't allow you to use the decorator syntax, but it largely provides the 
same functionality. That being said, my familiarity with the pickle protocol 
isn't overly strong, so the above is mostly based on my own recent 
investigation. There could very well be a way to accomplish what you're looking 
for in a way that I was unable to determine.

--
nosy: +aeros, alexandre.vassalotti, pitrou

___
Python tracker 

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



[issue31861] add aiter() and anext() functions to operator module

2020-08-18 Thread Dima Tisnek


Dima Tisnek  added the comment:

Might as well re-target for 3.10 as 3.9 seems feature-complete now.

--
versions: +Python 3.10 -Python 3.8

___
Python tracker 

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



[issue41513] Scale by power of two in math.hypot()

2020-08-18 Thread Tim Peters


Tim Peters  added the comment:

Here's a "correct rounding" fail for the add_on approach:

xs = [16.004] * 9

decimal result = 48.01065814103642
which rounds to float 48.014

add_on result: 48.01

That's about 0.50026 ulp too small - shocking ;-)

The fsum approach got this one right, but has similar failures on other inputs 
of the same form; i.e.,

[i + ulp(i)] * 9

for various integers `i`.

--

___
Python tracker 

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



[issue41513] Scale by power of two in math.hypot()

2020-08-18 Thread Tim Peters


Tim Peters  added the comment:

> That's about 0.50026 ulp too small - shocking ;-)

Actually, that's an illusion due to the limited precision of Decimal.  The 
rounded result is exactly 1/2 ulp away from the infinitely precise result - 
it's a nearest/even tie case.

To make analysis easy, just note that the mathematical hypot(*([x] * 9)) is 
exactly 3*x.  For x = 16 + ulp(16), 3*x moves to a higher binade and has two 
trailing one bits.  The last has to be rounded away, rounding up to leave the 
last retained bit even.  Any source of error, no matter how tiny, can be enough 
so that doesn't happen.

--

___
Python tracker 

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



[issue41109] subclasses of pathlib.PurePosixPath never call __init__ or __new__

2020-08-18 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


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

___
Python tracker 

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



[issue41586] Allow to set pipe size on subprocess.Popen.

2020-08-18 Thread Ruben Vorderman


New submission from Ruben Vorderman :

Pipes block if reading from an empty pipe or when writing to a full pipe. When 
this happens the program waiting for the pipe still uses a lot of CPU cycles 
when waiting for the pipe to stop blocking.

I found this while working with xopen. A library that pipes data into an 
external gzip process. (This is more efficient than using python's gzip module, 
because the subprocess escapes the GIL, so your main algorithm can fully 
utilize one CPU core while the compression is offloaded to another).

It turns out that increasing the pipe size on Linux from the default of 64KB to 
the maximum allowed pipe size in /proc/sys/fs/max-pipe-size (1024KB) 
drastically improves performance: https://github.com/marcelm/xopen/issues/35. 
TLDR: full utilization of CPU cores, a 40%+ decrease in wall-clock time and a 
20% decrease in the number of compute seconds (indicating that 20% was wasted 
waiting on blocking pipes).

However, doing this with subprocess is quite involved as it is now.

1. You have to find out which constants to use in fcntl for setting the 
pipesize (these constants are not in python). 
2. You have to start the Popen process with routing stdout to subprocess.Pipe. 
3. You have to get my_popen_process.stdout.fileno() 
4. Use fcntl.fcntl to modify the pipe size.

It would be much easier to do `subprocess.Popen(args, pipesize=1024 *1024)` for 
example.

I am currently working on a PR implementing this. It will also make 
F_GETPIPE_SZ and F_SETPIPE_SZ available to the fcntl module.

--
components: Library (Lib)
messages: 375636
nosy: rhpvorderman
priority: normal
severity: normal
status: open
title: Allow to set pipe size on subprocess.Popen.
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



[issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication.

2020-08-18 Thread Prudent


Prudent  added the comment:

Sorry, I forget how I installed the old python 3.7.5, but I installed the new 
python 3.8.5 using the downloaded installer from Python.org. Besides, I checked 
the "Tcl" under the path: "/System/Library/Tcl", its version still is 8.5. I 
think my code used the library here, and this is the reason why the warning 
showed.

--

___
Python tracker 

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



[issue41109] subclasses of pathlib.PurePosixPath never call __init__ or __new__

2020-08-18 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

I created a PR that should provide the desired behavior:  __init__() and 
__new__() get called in subclass objects that are created by Path and PurePath. 
 Also, Path and PurePath now have __init__() functions, and the __new__() 
functions only return new objects and rely upon __init__() to perform the 
object initialization.

--

___
Python tracker 

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



[issue41109] subclasses of pathlib.PurePosixPath never call __init__ or __new__

2020-08-18 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
components: +Library (Lib)

___
Python tracker 

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