[issue40837] email.utils.encode_rfc2231(string, None, None) returns broken value

2020-06-04 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +email
nosy: +barry, maxking, r.david.murray

___
Python tracker 

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



[issue40864] spec_set/autospec/spec seems to not be reading attributes defined in class body

2020-06-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

mock uses dir to iterate through the attributes that needs to be specced [0]. 
Unless the variable is initialized it's not listed in dir. Below is an example 
where age is initialized and name is not. name is not present in dir(Person) 
and hence spec will not be able to detect this. This is similar to 
https://bugs.python.org/issue36580.

cat /tmp/baz.py  
class Person:
name: str
age: int = 10

print(dir(Person))
print(Person.name)

python /tmp/baz.py
['__annotations__', '__class__', '__delattr__', '__dict__', '__dir__', 
'__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', 
'__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', 
'__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', 
'__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'age']
Traceback (most recent call last):
  File "/tmp/baz.py", line 6, in 
print(Person.name)
AttributeError: type object 'Person' has no attribute 'name'

[0] 
https://github.com/python/cpython/blob/e005ead49b1ee2b1507ceea94e6f89c28ecf1f81/Lib/unittest/mock.py#L2647

--
components: +Library (Lib) -Tests
nosy: +xtreak

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This is a spinoff of #37824.

My above comments about compile are wrong.  The example nests '' within ''.  
And, with freshly compiled master, I found an example where Deprecation 
warning, but not SyntaxWarning, accompanies SyntaxError, and which requires 
trailing \n.

>>> compile("if'\e' is 1: 1", '', 'single')
DeprecationWarning...
SyntaxError: unexpected EOF while parsing
>>> compile("if'\e' is 1: 1\n", '', 'single')
DeprecationWarning...
SyntaxWarning...


Interactively,
>>> if'\e' is 1: 1
:1: DeprecationWarning: invalid escape sequence \e
... 
:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
>>>

In IDLE, DeprecationWarning is repeated, but that is another issue.

The secondary prompts seems like a bug,  The statement is complete and entering 
anything but a comment is a SyntaxError.  (A comment results in another ... 
prompt.)

--

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 12d3061c7819a73d891dcce44327410eaf0e1bc2 by Miss Islington (bot) 
in branch '3.7':
[3.8] bpo-40807: Backport test_codeop change [GH-19670]
https://github.com/python/cpython/commit/12d3061c7819a73d891dcce44327410eaf0e1bc2


--

___
Python tracker 

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



[issue40869] errno missing descriptions

2020-06-04 Thread YoSTEALTH


New submission from YoSTEALTH :

`errno` https://docs.python.org/3/library/errno.html is missing description for 
symbols like `ECANCELED` 
https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html There might 
be others missing description as well, i haven't investigated further, figure i 
start the bug report process.

--
assignee: docs@python
components: Documentation
messages: 370749
nosy: YoSTEALTH, docs@python
priority: normal
severity: normal
status: open
title: errno missing descriptions

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset a5d6aba318ead9cc756ba750a70da41f5def3f8f by Terry Jan Reedy in 
branch '3.8':
[3.8] bpo-40807: Backport test_codeop change [GH-19670]
https://github.com/python/cpython/commit/a5d6aba318ead9cc756ba750a70da41f5def3f8f


--

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19867
pull_request: https://github.com/python/cpython/pull/20647

___
Python tracker 

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



[issue39325] Original window focus when opening IDLE by double clicking Python file Mac

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Irv also posted to idledev, where he explained his particular need: He teaches 
a class with assignment to write a .py file with certain behavior.  Submissions 
are in 1 directory.  He would like to double-click to load a file and F5 to run 
it.  Currently, he has to move the mouse and click the loaded editor before 
running and move it back.

In reply to my post yesterday, he explained how to make double-click in finder 
open in IDLE: """I did change the default for how my Mac opens ".py" files.  To 
do that I selected any ".py" and did a Get Info on it.  A tall window opens, 
and allows me to change the default application for opening the file.  I 
selected IDLE.app and chose "Change all"."""

More testing with my Macbook: both 'python3.9 -m idlelib -i file.py' in 
terminal *and* double-clicking in Finder open an editor, with 'Format' in the 
IDLE menu, open Shell (shifted right), with 'Shell' in the IDLE menu, and then 
lift the editor window, without giving it focus and changing the IDLE menu 
back.  Rereview of the video (which omits the IDLE menu) suggests the same 
because Shell is to the right of the editor.  The video is not as clear because 
the IDLE menu is omitted, the  editor has only one line, and Irv's machine is 
much faster.

I consider the inconsistency to be a bug.  The cause is this code after the 
creation of Shell.

if macosx.isAquaTk() and flist.dict:
# On OSX: when the user has double-clicked on a file that causes
# IDLE to be launched the shell window will open just in front of
# the file she wants to see. Lower the interpreter window when
# there are open files.
shell.top.lower()

Widgit.raise() and .lower() do not change focus.  Since there is no way to shed 
focus, we need to save the focus window, if there is one (and make sure it is 
not the withdrawn root), before creating Shell and restore it after.  There 
might be situations in which Shell should be left on top with the focus.

--
components: +macOS
nosy: +ronaldoussoren

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +19866
pull_request: https://github.com/python/cpython/pull/20646

___
Python tracker 

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



[issue38160] [subinterpreters] Add a "PyInterpreterState *" field to PyTypeObject.

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:

Which kind of code pattern is supposed to be more efficient if it would be 
possible to get a "PyInterpreterState *" from a "PyTypeObject*"? I don't 
understand which problem this issue is supposed to solve.

--

___
Python tracker 

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



[issue40514] [subinterpreters] Add --experimental-isolated-subinterpreters build option

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue40514] [subinterpreters] Add --experimental-isolated-subinterpreters build option

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:

I started to *remove* a few"#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS":

* commit 88ec9190105c9b03f49aaef601ce02b242a75273: Make list free list 
per-interpreter
* commit 3744ed2c9c0b3905947602fc375de49533790cb9: Make frame free list 
per-interpreter
* PR 20645 (under review): Make dict free lists per-interpreter

--

___
Python tracker 

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



[issue40868] io.TextIOBase.buffer is not necessarily a buffer

2020-06-04 Thread Manuel Jacob


New submission from Manuel Jacob :

https://docs.python.org/dev/library/io.html#io.TextIOBase.buffer says:

"The underlying binary buffer (a BufferedIOBase instance) that TextIOBase deals 
with. This is not part of the TextIOBase API and may not exist in some 
implementations."

It is not necessarily a buffer (a BufferedIOBase instance), e.g. when the 
stdout and stderr streams are set to be unbuffered. Example:

% python -u
Python 3.8.3 (default, May 17 2020, 18:15:42) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import io, sys
>>> sys.stdout
<_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
>>> isinstance(sys.stdout, io.TextIOBase)
True
>>> sys.stdout.buffer
<_io.FileIO name='' mode='wb' closefd=False>
>>> isinstance(sys.stdout.buffer, io.BufferedIOBase)
False

Therefore the name and the documentation are incorrect.

I suggest to deprecate the attribute "buffer", introduce a new attribute with a 
correct name, and forward the old attribute to the new attribute and vice versa 
in the io.TextIOBase class.

I think that "binary" would be a good attribute name for the underlying binary 
stream, as it would be consistent with io.BufferedIOBase.raw (for "the 
underlying raw stream").

--
assignee: docs@python
components: Documentation, IO
messages: 370744
nosy: docs@python, mjacob
priority: normal
severity: normal
status: open
title: io.TextIOBase.buffer is not necessarily a buffer

___
Python tracker 

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



[issue36724] Clear _PyRuntime at exit

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:

> _PyRuntime.warnings is not cleared at Python exit: 3 objects are kept alive 
> even after Py_Finalize().

This issue has been fixed. Moreover, the GC state is now per-interpreter.

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19865
pull_request: https://github.com/python/cpython/pull/20645

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e005ead49b1ee2b1507ceea94e6f89c28ecf1f81 by Victor Stinner in 
branch 'master':
bpo-40521: Make context free list per-interpreter (GH-20644)
https://github.com/python/cpython/commit/e005ead49b1ee2b1507ceea94e6f89c28ecf1f81


--

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19864
pull_request: https://github.com/python/cpython/pull/20644

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 78a02c2568714562e23e885b6dc5730601f35226 by Victor Stinner in 
branch 'master':
bpo-40521: Make async gen free lists per-interpreter (GH-20643)
https://github.com/python/cpython/commit/78a02c2568714562e23e885b6dc5730601f35226


--

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19863
pull_request: https://github.com/python/cpython/pull/20643

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 88ec9190105c9b03f49aaef601ce02b242a75273 by Victor Stinner in 
branch 'master':
bpo-40521: Make list free list per-interpreter (GH-20642)
https://github.com/python/cpython/commit/88ec9190105c9b03f49aaef601ce02b242a75273


--

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread miss-islington


miss-islington  added the comment:


New changeset 3dfe549bfa08a099b88efd030669359199f31064 by Miss Islington (bot) 
in branch '3.9':
bpo-40807: Show warnings once from codeop._maybe_compile (GH-20486)
https://github.com/python/cpython/commit/3dfe549bfa08a099b88efd030669359199f31064


--

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19862
pull_request: https://github.com/python/cpython/pull/20642

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19861
pull_request: https://github.com/python/cpython/pull/20641

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19860
pull_request: https://github.com/python/cpython/pull/20640

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 052d3fc0907be253cfd64b2c737a0b0aca586011 by Cheryl Sabella in 
branch 'master':
bpo-40807: Show warnings once from codeop._maybe_compile (#20486)
https://github.com/python/cpython/commit/052d3fc0907be253cfd64b2c737a0b0aca586011


--

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3744ed2c9c0b3905947602fc375de49533790cb9 by Victor Stinner in 
branch 'master':
bpo-40521: Make frame free list per-interpreter (GH-20638)
https://github.com/python/cpython/commit/3744ed2c9c0b3905947602fc375de49533790cb9


--

___
Python tracker 

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



[issue40802] AbstractEventLoop.shutdown_default_executor breaks backwards compatibility

2020-06-04 Thread Kyle Stanley


Kyle Stanley  added the comment:

The main issue is that shutdown_default_executor() (or something that does the 
same thing) is necessary to ensure the resources of the event loop's 
ThreadPoolExecutor are finalized in a safe manner. Otherwise, it frequently 
results in dangling threads when run_in_executor() is used with the default 
executor, and was regularly doing so in the buildbots. So, I think this is a 
case where we ultimately have to break backwards compatibility in an upcoming 
version to fix a bug.

Also, the implementation of shutdown_default_executor() is fairly 
straightforward, and as far as I'm aware it's not incompatible with any of the 
listed projects that would need to implement it for 3.9. While inconvenient, I 
don't think the burden to address the compatibility break is at all high in 
this case.

> Since asyncio is no longer provisional, should it break backwards 
> compatibility with just a What's New entry?

Do you have an alternative suggestion? Personally, I don't think a deprecation 
warning (or other) would make much sense here since it would be effectively 
leaving a resource leak bug as long as it isn't implemented.

--
nosy: +aeros

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19858
pull_request: https://github.com/python/cpython/pull/20638

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7daba6f221e713f7f60c613b246459b07d179f91 by Victor Stinner in 
branch 'master':
bpo-40521: Make slice cache per-interpreter (GH-20637)
https://github.com/python/cpython/commit/7daba6f221e713f7f60c613b246459b07d179f91


--

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 2ba59370c3dda2ac229c14510e53a05074b133d1 by Victor Stinner in 
branch 'master':
bpo-40521: Make float free list per-interpreter (GH-20636)
https://github.com/python/cpython/commit/2ba59370c3dda2ac229c14510e53a05074b133d1


--

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19857
pull_request: https://github.com/python/cpython/pull/20637

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19856
pull_request: https://github.com/python/cpython/pull/20636

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 69ac6e58fd98de339c013fe64cd1cf763e4f9bca by Victor Stinner in 
branch 'master':
bpo-40521: Make tuple free list per-interpreter (GH-20247)
https://github.com/python/cpython/commit/69ac6e58fd98de339c013fe64cd1cf763e4f9bca


--

___
Python tracker 

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



[issue40867] Remove unused include in Module/_randommodule.c

2020-06-04 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue40867] Remove unused include in Module/_randommodule.c

2020-06-04 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

_Py_bswap32() is no longer used in _randommodule.c (removed in commit 2d87577), 
so including pycore_byteswap.h is not necessary.

--
components: Library (Lib)
messages: 370732
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: Remove unused include in Module/_randommodule.c
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue40866] Use PyModule_AddType() in posix module initialisation

2020-06-04 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue40866] Use PyModule_AddType() in posix module initialisation

2020-06-04 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Use PyModule_AddType() iso. PyModule_AddObject() in posix module 
initialisation, and use PyTypeObject iso. PyObject for type objects.

--
components: Library (Lib)
messages: 370731
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: Use PyModule_AddType() in posix module initialisation
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue40865] Remove unused insint() macro from the hash modules

2020-06-04 Thread miss-islington


miss-islington  added the comment:


New changeset e4e5ec18e2f79f9bba439b531ebf89ac148deda0 by Miss Islington (bot) 
in branch '3.9':
bpo-40865: Remove unused insint() macro from hash modules (GH-20627)
https://github.com/python/cpython/commit/e4e5ec18e2f79f9bba439b531ebf89ac148deda0


--

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset dc24b8a2ac32114313bae519db3ccc21fe45c982 by Victor Stinner in 
branch 'master':
bpo-39573: Porting to Python 3.10: Py_SET_SIZE() macro (GH-20610)
https://github.com/python/cpython/commit/dc24b8a2ac32114313bae519db3ccc21fe45c982


--

___
Python tracker 

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



[issue40865] Remove unused insint() macro from the hash modules

2020-06-04 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks for the cleanup! The 3.9 backport will land any minute.

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



[issue40865] Remove unused insint() macro from the hash modules

2020-06-04 Thread miss-islington


miss-islington  added the comment:


New changeset 6ed578f6dbffdec94f62cc2e36d626fc195678d7 by Erlend Egeberg 
Aasland in branch 'master':
bpo-40865: Remove unused insint() macro from hash modules (GH-20627)
https://github.com/python/cpython/commit/6ed578f6dbffdec94f62cc2e36d626fc195678d7


--
nosy: +miss-islington

___
Python tracker 

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



[issue40865] Remove unused insint() macro from the hash modules

2020-06-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19853
pull_request: https://github.com/python/cpython/pull/20633

___
Python tracker 

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



[issue40865] Remove unused insint() macro in SHA512 module

2020-06-04 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Indeed. I'll update the PR and the title of this issue.

--

___
Python tracker 

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



[issue40865] Remove unused insint() macro from the hash modules

2020-06-04 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
title: Remove unused insint() macro in SHA512 module -> Remove unused insint() 
macro from the hash modules

___
Python tracker 

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



[issue40865] Remove unused insint() macro in SHA512 module

2020-06-04 Thread Christian Heimes


Christian Heimes  added the comment:

The other builtin hashes have the same unused macro.

$ grep -R insint Modules/*.c
Modules/md5module.c:#define insint(n,v) { PyModule_AddIntConstant(m,n,v); }
Modules/sha1module.c:#define insint(n,v) { PyModule_AddIntConstant(m,n,v); }
Modules/sha256module.c:#define insint(n,v) { PyModule_AddIntConstant(m,n,v); }
Modules/sha512module.c:#define insint(n,v) { PyModule_AddIntConstant(m,n,v); }

--
components: +Extension Modules -Library (Lib)
nosy: +christian.heimes
type:  -> behavior
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am not sure if 3 compiles are always needed.  At one time, compile required a 
final '\n' to not raise, but that is no longer true.  And as near as I can 
tell, 'code without final newline\n' and 'code without final newline\n\n' 
always compile the same.  Certainly, Shell does not need to compile without a 
final newline.  But we can look at this in a separate issue.  If IDLE's 
requirement is different from code.II's, I believe it could pass its own 
compile function.

--

___
Python tracker 

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



[issue40865] Remove unused insint() macro in SHA512 module

2020-06-04 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue40865] Remove unused insint() macro in SHA512 module

2020-06-04 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

The insint() macro in line 741 is unused and can be removed.

--
components: Library (Lib)
messages: 370723
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: Remove unused insint() macro in SHA512 module
versions: Python 3.10, 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



[issue40807] Codeop: Show warnings once during _maybe_compile

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The purpose of code and codeop is to imitate interactive python in python.  
Calling compile() thrice is an implementation detail.  Exposing that is a bug.  
On #37824, Serhiy reported 3 'IDLE' bugs for 3.7 to 3.9: tripled 
DeprecationWarning (now joined by SyntaxWarning), printing to console (if 
available) instead of Shell, and an exit exception.  This issue is continuation 
of the triplicate issue, given that the bug is not in IDLE.  As a bug, I think 
it should still be backported.

I looked more carefully at the behavior of the standard REPL with different 
statement inputs.  Before executing, if the statement is complete, it may raise 
a compile exception, usually SyntaxError, or emit one or more a warnings, once 
for each instance.  For multiline statements, DeprecationWarnings are emitted 
immediately after the line with the deprecated code while SyntaxWarnings are 
emitted, if there is no syntax error, just before execution.  SyntaxWarnings 
for a given slice of code are not repeated.  However, at least some of these 
details have to be enforced in the UI code that repeatedly calls compile or 
_maybe_compile as lines are added, not in compile, and should not be in 
_maybe_compile.  Both have no memory or previous calls.  (I don't think that 
IDLE necessarily *must* do the same either.)

Looking at compile itself, it appears that warnings are not emitted if there is 
an exception.  But I am puzzled at this in 3.9 and master.

>>> if '\e' is 1:
:1: DeprecationWarning: invalid escape sequence \e
...
versus
>>> compile('if '\e' is 1:\n', '', 'single')
  File "", line 1
SyntaxError: unexpected character after line continuation character

Something must cause "'\e'" to be a warning instead of an error.

This is enough to experiment with your patch applied.

--
nosy: +serhiy.storchaka, terry.reedy
title: CODEOP: Show warnings once during _maybe_compile -> Codeop: Show 
warnings once during _maybe_compile
type: enhancement -> behavior
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Eryk Sun


Change by Eryk Sun :


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



[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Paul Moore


Paul Moore  added the comment:

Because if you open a file in text mode (without "b" in the mode), Python 
writes \n (newline) characters as \r\n (carriage return, line feed) which are 
the Windows textfile representation of "Newline".

>From the documentation of the built in open() function,

"When writing output to the stream, if newline is None, any '\n' characters 
written are translated to the system default line separator, os.linesep."

--
resolution:  -> not a bug

___
Python tracker 

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



[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Matthias Naegler


Matthias Naegler  added the comment:

I forgot something important. Using open with 'ab' works.

>>> ...above code...
with open("./test_binary.txt", "ab") as myfile:
... myfile.write(s.encode('utf-8'))

--

___
Python tracker 

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



[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Matthias Naegler


Matthias Naegler  added the comment:

Thanks Steven for your fast response.

> The best way to see what your string actually contains is the print the repr:
You are right. bytes.decode is correct.
Im not a python expert, so thanks for the note about "repr". With repr(...) 
everything looks fine.

Nevertheless, I get an additional \r in my output. Not sure if it is a problem 
of python, windows or just me.

I get the following output with the python interpretor:

Python 3.8.3rc1 (tags/v3.8.3rc1:802eb67, Apr 29 2020, 21:39:14) [MSC v.1924 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.stdout.encoding
'utf-8'
>>> b =  b'A\r\nA'
>>> s = b.decode('utf-8')
>>> print(b)
b'A\r\nA'
>>> print(repr(s))
'A\r\nA'
>>> print(s)
A
A
>>> sys.stdout.write(s)
A
A4
>>> with open("./test.txt", "a") as myfile:
... myfile.write(s)

This all looks right. But the file doesn't (see attached screenshot).

I also get an additional \r in the output file if i run the script throught 
"python test.py > piped.txt"

--
Added file: https://bugs.python.org/file49215/test.png

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-04 Thread Eryk Sun


Eryk Sun  added the comment:

> The purpose of _Py_BEGIN_SUPPRESS_IPH is to suppress such popup, no?

That macro suppresses the CRT's invalid parameter handler, which by default  
terminates abnormally with a fastfail (status code 0xC409), even in a 
release build. 

In a debug build, we still have message boxes from failed asserts that call 
_CrtDbgReportW. For example, the following stack trace shows _CrtDbgReportW 
called from _get_osfhandle:

Call Site
win32u!NtUserWaitMessage
user32!DialogBox2
user32!InternalDialogBox
user32!SoftModalMessageBox
user32!MessageBoxWorker
user32!MessageBoxTimeoutW
user32!MessageBoxW
ucrtbased!__acrt_MessageBoxW
ucrtbased!__crt_char_traits::message_box
ucrtbased!common_show_message_box
ucrtbased!__acrt_show_wide_message_box
ucrtbased!common_message_window
ucrtbased!__acrt_MessageWindowW
ucrtbased!_VCrtDbgReportW
ucrtbased!_CrtDbgReportW
ucrtbased!_get_osfhandle
python310_d!PyOS_StdioReadline

_get_osfhandle validates that the fd is open via

_VALIDATE_CLEAR_OSSERR_RETURN(_osfile(fh) & FOPEN, EBADF, -1);

which uses the following macro:

#define _VALIDATE_CLEAR_OSSERR_RETURN(expr, errorcode, retexpr) 
   \
{   
   \
int _Expr_val=!!(expr); 
   \
_ASSERT_EXPR((_Expr_val), _CRT_WIDE(#expr));
   \
if (!(_Expr_val))   
   \
{   
   \
_doserrno = 0L; 
   \
errno = errorcode;  
   \
_INVALID_PARAMETER(_CRT_WIDE(#expr));   
   \
return retexpr; 
   \
}   
   \
}

In a debug build, _ASSERT_EXPR expands as:

#define _ASSERT_EXPR(expr, msg) \
(void)( 
\
(!!(expr)) ||   
\
(1 != _CrtDbgReportW(_CRT_ASSERT, _CRT_WIDE(__FILE__), __LINE__, 
NULL, L"%ls", msg)) || \
(_CrtDbgBreak(), 0) 
\
)

which is where _CrtDbgReportW gets called. By default it reports the assertion 
failure with a message box. The suppression of this in libregrtest either 
ignores this report or sends it to stderr:

for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
if verbose:
msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
else:
msvcrt.CrtSetReportMode(m, 0)

msvcrt.CrtSetReportMode and msvcrt.CrtSetReportFile only exist in a debug build.

--

___
Python tracker 

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



[issue17258] multiprocessing.connection challenge implicitly uses MD5

2020-06-04 Thread miss-islington


miss-islington  added the comment:


New changeset 196810a98ab07714df3d329c325575ac36e61318 by Miss Islington (bot) 
in branch '3.9':
bpo-17258: Add requires_hashdigest to multiprocessing tests (GH-20412)
https://github.com/python/cpython/commit/196810a98ab07714df3d329c325575ac36e61318


--

___
Python tracker 

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



[issue17258] multiprocessing.connection challenge implicitly uses MD5

2020-06-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19851
pull_request: https://github.com/python/cpython/pull/20626

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:

I am confused. Code which uses the closed file descriptor 0 uses 
"_Py_BEGIN_SUPPRESS_IPH":

_Py_BEGIN_SUPPRESS_IPH
hStdIn = (HANDLE)_get_osfhandle(fileno(sys_stdin));
hStdErr = (HANDLE)_get_osfhandle(fileno(stderr));
_Py_END_SUPPRESS_IPH

and

_Py_BEGIN_SUPPRESS_IPH
handle = (HANDLE)_get_osfhandle(fileno(fp));
_Py_END_SUPPRESS_IPH

Macros defined as:

extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
#define _Py_BEGIN_SUPPRESS_IPH { _invalid_parameter_handler _Py_old_handler = \

_set_thread_local_invalid_parameter_handler(_Py_silent_invalid_parameter_handler);
#define _Py_END_SUPPRESS_IPH 
_set_thread_local_invalid_parameter_handler(_Py_old_handler); }

with PC/invalid_parameter_handler.c:

static void __cdecl _silent_invalid_parameter_handler(
wchar_t const* expression,
wchar_t const* function,
wchar_t const* file,
unsigned int line,
uintptr_t pReserved) { }

_invalid_parameter_handler _Py_silent_invalid_parameter_handler = 
_silent_invalid_parameter_handler;


The purpose of _Py_BEGIN_SUPPRESS_IPH is to suppress such popup, no?

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 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



[issue25377] Mention octal format of mode argument of os.chmod

2020-06-04 Thread Ama Aje My Fren


Ama Aje My Fren  added the comment:

I think I was finally able to do a PR for this on 3.10. Requesting a triager to 
please check because it does not appear as a Documentation change on Github.

Thanks

--

___
Python tracker 

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



[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

You don't need `b = bytes([0x41, 0x0D, 0x0A])`, this will work just as well:

b = b'\x41\x0D\x0A'

and this is even better:

b = b'A\r\n'


> It seems like bytes.decode always replaces "\n" with "\r\n".

What makes you say that? You are passing the output through print, which does 
things with newlines and carriage returns. Try this, for example:

py> print('ABCD\rZ\n', end='')
ZBCD


The best way to see what your string actually contains is the print the repr:

print(repr(b.decode('utf-8')))

which I'm pretty sure will print A\r\n as you expect. But I don't have a 
Windows box to test it on.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue40864] spec_set/autospec/spec seems to not be reading attributes defined in class body

2020-06-04 Thread Evan Fagerberg


Evan Fagerberg  added the comment:

Sorry one small note, the error in the example happens on
```python
logger.propagate = False
```

and not
```python
assert logger.propagate is False
```

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-06-04 Thread hai shi


Change by hai shi :


--
pull_requests: +19850
pull_request: https://github.com/python/cpython/pull/20625

___
Python tracker 

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



[issue40864] spec_set/autospec/spec seems to not be reading attributes defined in class body

2020-06-04 Thread Evan Fagerberg


New submission from Evan Fagerberg :

Hello, I really like that this library allows for really strict mocking however 
one thing I have noticed is that it seems like using spec on a mock does not 
properly read the class body for attributes like some of the documentation 
claims. For example this is a snippet of the Logger class in python 3.6's 
`logging` module
```python
class Logger(Filterer):
name: str
level: int
parent: Union[Logger, PlaceHolder]
propagate: bool
handlers: List[Handler]
disabled: int
```

Now I want to mock that class ensuring that propagate gets set to False for 
example
```python
from unittest import mock
from logging import Logger

logger = mock.Mock(spec_set=Logger)
logger.propagate = False
assert logger.propagate is False
*** AttributeError: Mock object has no attribute 'propagate'
```

I have noticed this does work when the value is initialized in the class body 
so for example

```python
class Logger(Filterer):
name: str
level: int
parent: Union[Logger, PlaceHolder]
propagate: bool = False
handlers: List[Handler]
disabled: int
```

This would not fail with the test in question.

Wondering if this is intended behavior or not or if I am misunderstanding 
something. I have tested this with Python 3.6.10, 3.8.2, all with the same 
result.

--
components: Tests
messages: 370712
nosy: efagerberg
priority: normal
severity: normal
status: open
title: spec_set/autospec/spec seems to not be reading attributes defined in 
class body
type: behavior
versions: Python 3.6, 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



[issue40686] Compiler warnings in _zoneinfo.c on Windows build in 64-bit

2020-06-04 Thread Paul Ganssle


Change by Paul Ganssle :


--
pull_requests: +19849
pull_request: https://github.com/python/cpython/pull/20624

___
Python tracker 

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



[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Matthias Naegler


New submission from Matthias Naegler :

```
# 0x0D, 13 = /r
# 0x0A, 10 = /n

print('test "\\r\\n"')
print('-')
b = bytes([0x41, 0x0D, 0x0A])
print("bytes: %s" % b)
print("string: %s" % b.decode('utf8'), end='')
# expected string: "A\r\n"
# ressult string: "A\r\r\n"

print('test "\\n"')
print('--')
b = bytes([0x41, 0x0A])
print("bytes: %s" % b)
print("string: %s" % b.decode('utf8'), end='')
# expected string: "A\n"
# ressult string: "A\r\n"
```

It seems like bytes.decode always replaces "\n" with "\r\n".

Tested with
Windows 10 with Python:
- 3.6.0
- 3.7.7
- 3.8.3-rc1
- 3.8.3
- 2.7.18 (works as expected)

--
components: Unicode, Windows
messages: 370711
nosy: Matthias Naegler, ezio.melotti, paul.moore, steve.dower, tim.golden, 
vstinner, zach.ware
priority: normal
severity: normal
status: open
title: bytes.decode changes/destroys line endings on windows
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue40836] logging.fatal() and logging.Logger.fatal() should raise a DeprecationWarning

2020-06-04 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Thanks for the feedback, I updated the PR accordingly.

--

___
Python tracker 

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



[issue40857] tempfile.TemporaryDirectory() context manager can fail to propagate exceptions generated within its context

2020-06-04 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

This was fixed in e9b51c0ad81da1da11ae65840ac8b50a8521373c so it's fixed in 
Python 3.8 and 3.9. Maybe it should have been backported to 3.7.

Python 3.6 only receives security fixes now.

See also bpo-26660 and bpo-35144.

--
components: +Library (Lib) -Extension Modules
nosy: +remi.lapeyre, serhiy.storchaka
versions: +Python 3.7

___
Python tracker 

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



[issue40860] Exception in multiprocessing/context.py under load

2020-06-04 Thread Arkady


Arkady  added the comment:

The problem is likely in the call to multiprocessing.Process.join() with 
timeout. If I use timeout=None the code works.

--

___
Python tracker 

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



[issue40679] show class name in method invocation TypeError

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:

> Thanks a lot, Victor.

You're welcome. Using the qualified name instead of the "short" name in error 
messages is nice enhancement!

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



[issue40679] show class name in method invocation TypeError

2020-06-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 232dda6cbc10860328a83517a6e3ea238ff4147f by Victor Stinner in 
branch 'master':
bpo-40679: Fix _PyEval_EvalCode() crash if qualname is NULL (GH-20615)
https://github.com/python/cpython/commit/232dda6cbc10860328a83517a6e3ea238ff4147f


--

___
Python tracker 

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



[issue17258] multiprocessing.connection challenge implicitly uses MD5

2020-06-04 Thread miss-islington


miss-islington  added the comment:


New changeset b022e5cffbd3ff51ae361cf80f2a3b660be8b1ee by Christian Heimes in 
branch 'master':
bpo-17258: Add requires_hashdigest to multiprocessing tests (GH-20412)
https://github.com/python/cpython/commit/b022e5cffbd3ff51ae361cf80f2a3b660be8b1ee


--
nosy: +miss-islington

___
Python tracker 

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



[issue40862] argparse.BooleanOptionalAction accept and silently discard its the const argument

2020-06-04 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
title: argparse.BooleanOptionalAction accept and silently its the const 
argument -> argparse.BooleanOptionalAction accept and silently discard its the 
const argument

___
Python tracker 

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



[issue1294959] Add sys.platlibdir and configure --with-platlibdir to use /usr/lib64 on Fedora and SuSE

2020-06-04 Thread Miro Hrončok

Miro Hrončok  added the comment:

Note: https://docs.python.org/3.9/install/index.html probably needs some update 
wrt this change.

--

___
Python tracker 

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



[issue40862] argparse.BooleanOptionalAction accept and silently its the const argument

2020-06-04 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


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

___
Python tracker 

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



[issue40862] argparse.BooleanOptionalAction accept and silently its the const argument

2020-06-04 Thread Rémi Lapeyre

New submission from Rémi Lapeyre :

The action is used to store None, True or False when an argument like --foo or 
--no-foo is given to the cli so it has no used for this action, but it is 
accepted without warning:

Python 3.10.0a0 (heads/bpo-wip:6e23a9c82b, Jun  4 2020, 13:41:35) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', const='this_is_not_used', 
>>> action=argparse.BooleanOptionalAction)
BooleanOptionalAction(option_strings=['--foo', '--no-foo'], dest='foo', 
nargs=0, const=None, default=None, type=None, choices=None, help=None, 
metavar=None)
>>> args = parser.parse_args()
>>> args
Namespace(foo=None)



We could either always refuse this argument, or accepted and raise ValueError 
if it is different than None. The attached PR does the first.

--
components: Library (Lib)
messages: 370703
nosy: remi.lapeyre
priority: normal
severity: normal
status: open
title: argparse.BooleanOptionalAction accept and silently its the const argument
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue40861] On Windows, liblzma is always built without optimization

2020-06-04 Thread Nikita Nemkin


New submission from Nikita Nemkin :

Windows build system always builds liblzma with optimizations disabled (/Od), 
even in Release configuration.

Compared to optimized build (/O2), compression speed is 2-2.5x slower and 
module size is 30% larger.

--
components: Build
messages: 370702
nosy: nnemkin
priority: normal
severity: normal
status: open
title: On Windows, liblzma is always built without optimization
type: performance
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



[issue40855] statistics.stdev ignore xbar argument

2020-06-04 Thread Matti

Matti  added the comment:

If we estimate the mean using a sample we loose one degree of freedom so it 
will be divided by N-1, while if we have the mean independent of the sample it 
should be divided by N to be unbiased. 

i.e. 
example 1 
sqrt(((1-1.5)²+(2-1.5)²)/(2-1)) = 0.7...
example 3
sqrt(((1-1.5)²+(2-1.5)²)/(2)) = 0.5

--

___
Python tracker 

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



[issue40860] Exception in multiprocessing/context.py under load

2020-06-04 Thread larytet


larytet  added the comment:

This code reproduces the problem https://github.com/larytet-py/multiprocess
I assume that my use of join() is not correct.

--

___
Python tracker 

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



[issue40856] IDLE line numbering should be light gray

2020-06-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

When the question of changing default-x.def has come up before (and there are 
things I would like to change) the answer has generally been that we should 
not, a) because it would be too disruptive, including affecting exiting 
customizations, and b) because users already have the option of customizing.  
Most of the behaviors we change are not customizable, so we have to change the 
current behavior to give most people a better behavior, even if some people 
(including Raymond) object.

However, I will reconsider here since a) Tal, who I believe choose the current 
default, not only agrees with changing it by also the direction, b) 
line-numbers are only a year old, and, importantly, c) themes are saved as a 
whole, rather than as individual pairs, so that existing customizations will 
not be affected.  Even so, I expect that there will be people using IDLE 
Classic that prefer the current default.

If we are to change, we need specific foreground and background RGB numbers to 
replace the Current ones.  Raymond, Tal, and Cheryl if you want, please play 
with the line number (and future Shell sidebar) colors and propose something 
specific for general use.  (Raymond, I can imagine that you might prefer for 
projection with a particular system something different than you think is best 
for default screen use.)  I intend to post to idledev and maybe elsewhere to 
get other opinions (including for IDLE Dark).  Since I will not use whatever is 
chosen, my main concern is that we not choose something so light as to be 
unreadable by people like me with less than 'perfect' vision.

Related issue: the IDLE New theme was added years ago as a copy of IDLE 
Classic.  I presume the intent was to provide an alternative (light) default, 
but it was never modified, making it currently useless.  We should either 
delete it, while recognizing the name, or actually change it.  I have some 
ideas for the latter, but I presume Raymond intends this issue to be about 
changing IDLE Classic.

--
nosy: +cheryl.sabella
resolution: not a bug -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

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



[issue31254] WeakKeyDictionary/Mapping doesn't call __missing__

2020-06-04 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

Just found this while searching to see if we had an existing way to combine 
WeakValueDictionary + defaultdict. The use case I've run into a few times is 
where you need a keyed collection of mutexes, like e.g. asyncio.Lock objects. 
You want to make sure that if there are multiple tasks trying to access the 
same key/resource, they all acquire the same lock, but you don't want to use a 
regular defaultdict, because that will end up growing endlessly as different 
keys/resources are encountered.

It'd be very handy to do something like:

lock_dict = WeakValueDictionary(default=asyncio.Lock)

async with lock_dict[key]:
...

and have everything magically work.

The alternative is to open-code the default handling at the call site, either:

# Wasteful: creates a new Lock object on every usage,
# regardless of whether it's actually needed.
async with lock_dict.setdefault(key, asyncio.Lock()):
...

Or else the verbose:

lock = lock_dict.get(key)
if lock is None:
lock = lock_dict[key] = asyncio.Lock()
async with lock:
...

--
nosy: +njs

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-04 Thread Eryk Sun


Eryk Sun  added the comment:

> Perhaps the child interpreter used by test_repl doesn't inherit 
> that behavior.

The OS error mode is inherited, unless the child is created with 
CREATE_DEFAULT_ERROR_MODE flag. But the CRT error mode isn't inherited. (For 
the spawn* family, in principle the CRT could pass its error modes in reserved 
STARTUPINFO fields, like it does for file descriptors, but it doesn't do that, 
and subprocess wouldn't be privy to that protocol anyway.) 

For example:

>>> import sys, subprocess
>>> from msvcrt import *
>>> SEM_FAILCRITICALERRORS, CRTDBG_MODE_FILE, CRTDBG_MODE_WNDW
(1, 1, 4)

>>> SetErrorMode(SEM_FAILCRITICALERRORS)
0
>>> CrtSetReportMode(CRT_ERROR, CRTDBG_MODE_FILE)
4

The return values are the previous values, which are respectively 0 (default) 
for the OS and CRTDBG_MODE_WNDW (message box) for the CRT. Now check the 
initial values in a child process:

>>> subprocess.call(f'{sys.executable} -q')

>>> from msvcrt import *
>>> SetErrorMode(SEM_FAILCRITICALERRORS)
1
>>> CrtSetReportMode(CRT_ERROR, CRTDBG_MODE_FILE)
4

The OS error mode of the parent was inherited, but the parent's CRT error mode 
was not.

libregrtest has a convenient function to suppress error reporting in the child. 
For example:

>>> import sys, subprocess
>>> subprocess.call(f'{sys.executable} -q')

>>> import os
>>> from test.libregrtest import setup
>>> setup.suppress_msvcrt_asserts(0)
>>> os.close(0)
>>>
0

--
nosy: +eryksun

___
Python tracker 

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