[issue32309] Implement asyncio.run_in_executor shortcut

2020-05-20 Thread Kyle Stanley


Kyle Stanley  added the comment:

Now that the `versionadded` label has been added and the contextvar issue was 
addressed, this issue can be closed.

--
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-05-20 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Sure -- I'll file the issue.

--

___
Python tracker 

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



[issue30612] Unusual Windows registry path syntax

2020-05-20 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 7.0 -> 8.0
pull_requests: +19558
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20281

___
Python tracker 

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



[issue32309] Implement asyncio.run_in_executor shortcut

2020-05-20 Thread miss-islington


miss-islington  added the comment:


New changeset 3e650545bfe949fa435b0d41e54986f615891ec8 by Miss Islington (bot) 
in branch '3.9':
bpo-32309: Add support for contextvars in asyncio.to_thread() (GH-20278)
https://github.com/python/cpython/commit/3e650545bfe949fa435b0d41e54986f615891ec8


--

___
Python tracker 

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



[issue40705] use-after-free in _zoneinfo.c's module_free function

2020-05-20 Thread Ammar Askar


Change by Ammar Askar :


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

___
Python tracker 

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



[issue40705] use-after-free in _zoneinfo.c's module_free function

2020-05-20 Thread Ammar Askar


New submission from Ammar Askar :

This was caught on oss-fuzz's ASAN builder:

Step #4: ==7656==ERROR: AddressSanitizer: heap-use-after-free on address 
0x604001568ea0 at pc 0x7f603e4b974b bp 0x7ffe4f7e8f90 sp 0x7ffe4f7e8f88
Step #4: READ of size 8 at 0x604001568ea0 thread T0
Step #4: #0 0x7f603e4b974a in module_free 
/src/cpython3/Modules/_zoneinfo.c:2610:10
Step #4: #1 0x570311 in module_dealloc 
/src/cpython3/Objects/moduleobject.c:675:9
Step #4: #2 0x57b7fc in _Py_Dealloc /src/cpython3/Objects/object.c:2209:5
Step #4: #3 0x54ce60 in _Py_DECREF /src/cpython3/./Include/object.h:430:9
Step #4: #4 0x551cdc in _Py_XDECREF /src/cpython3/./Include/object.h:497:9
Step #4: #5 0x54e1b2 in insertdict /src/cpython3/Objects/dictobject.c:1129:5
Step #4: #6 0x54d2fe in PyDict_SetItem 
/src/cpython3/Objects/dictobject.c:1579:12
Step #4: #7 0x55b5dc in dict_ass_sub 
/src/cpython3/Objects/dictobject.c:2179:16
Step #4: #8 0x87520f in PyObject_SetItem 
/src/cpython3/Objects/abstract.c:210:16
Step #4: #9 0x6c1e89 in _PyImport_Cleanup 
/src/cpython3/Python/import.c:523:13
Step #4: #10 0x6fc40a in Py_FinalizeEx 
/src/cpython3/Python/pylifecycle.c:1422:5
Step #4: #11 0x4dd17a in Py_RunMain /src/cpython3/Modules/main.c:634:9
Step #4: #12 0x4ddbea in pymain_main /src/cpython3/Modules/main.c:662:12
Step #4: #13 0x4dde34 in Py_BytesMain /src/cpython3/Modules/main.c:686:12
Step #4: #14 0x4dd030 in main /src/cpython3/./Programs/python.c:15:12
Step #4: #15 0x7f60440bc82f in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Step #4: #16 0x434ce8 in _start (/src/cpython3/python+0x434ce8)
Step #4: 
Step #4: 0x604001568ea0 is located 16 bytes inside of 48-byte region 
[0x604001568e90,0x604001568ec0)
Step #4: freed by thread T0 here:
Step #4: #0 0x4ad20d in free 
/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:123:3
Step #4: #1 0x57c493 in _PyMem_RawFree 
/src/cpython3/Objects/obmalloc.c:127:5
Step #4: #2 0x57dbc2 in PyObject_Free /src/cpython3/Objects/obmalloc.c:709:5
Step #4: #3 0x75e81a in PyObject_GC_Del 
/src/cpython3/Modules/gcmodule.c:2325:5
Step #4: #4 0x5a12cd in object_dealloc 
/src/cpython3/Objects/typeobject.c:4008:5
Step #4: #5 0x59abbb in subtype_dealloc 
/src/cpython3/Objects/typeobject.c:1371:5
Step #4: #6 0x57b7fc in _Py_Dealloc /src/cpython3/Objects/object.c:2209:5
Step #4: #7 0x7f603e4b0700 in _Py_DECREF 
/src/cpython3/./Include/object.h:430:9
Step #4: #8 0x7f603e4b05dc in _Py_XDECREF 
/src/cpython3/./Include/object.h:497:9
Step #4: #9 0x7f603e4b96de in module_free 
/src/cpython3/Modules/_zoneinfo.c:2609:5
Step #4: #10 0x570311 in module_dealloc 
/src/cpython3/Objects/moduleobject.c:675:9
Step #4: #11 0x57b7fc in _Py_Dealloc /src/cpython3/Objects/object.c:2209:5
Step #4: #12 0x54ce60 in _Py_DECREF /src/cpython3/./Include/object.h:430:9
Step #4: #13 0x551cdc in _Py_XDECREF /src/cpython3/./Include/object.h:497:9
Step #4: #14 0x54e1b2 in insertdict 
/src/cpython3/Objects/dictobject.c:1129:5
Step #4: #15 0x54d2fe in PyDict_SetItem 
/src/cpython3/Objects/dictobject.c:1579:12
Step #4: #16 0x55b5dc in dict_ass_sub 
/src/cpython3/Objects/dictobject.c:2179:16
Step #4: #17 0x87520f in PyObject_SetItem 
/src/cpython3/Objects/abstract.c:210:16
Step #4: #18 0x6c1e89 in _PyImport_Cleanup 
/src/cpython3/Python/import.c:523:13
Step #4: #19 0x6fc40a in Py_FinalizeEx 
/src/cpython3/Python/pylifecycle.c:1422:5
Step #4: #20 0x4dd17a in Py_RunMain /src/cpython3/Modules/main.c:634:9
Step #4: #21 0x4ddbea in pymain_main /src/cpython3/Modules/main.c:662:12
Step #4: #22 0x4dde34 in Py_BytesMain /src/cpython3/Modules/main.c:686:12
Step #4: #23 0x4dd030 in main /src/cpython3/./Programs/python.c:15:12
Step #4: #24 0x7f60440bc82f in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Step #4: 
Step #4: previously allocated by thread T0 here:
Step #4: #0 0x4ad48d in malloc 
/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
Step #4: #1 0x57c37c in _PyMem_RawMalloc 
/src/cpython3/Objects/obmalloc.c:99:12
Step #4: #2 0x57da49 in PyObject_Malloc 
/src/cpython3/Objects/obmalloc.c:685:12
Step #4: #3 0x75e17c in _PyObject_GC_Alloc 
/src/cpython3/Modules/gcmodule.c:2233:26
Step #4: #4 0x75e0c5 in _PyObject_GC_Malloc 
/src/cpython3/Modules/gcmodule.c:2260:12
Step #4: #5 0x598619 in PyType_GenericAlloc 
/src/cpython3/Objects/typeobject.c:1086:15
Step #4: #6 0x5a1922 in object_new 
/src/cpython3/Objects/typeobject.c:4002:12
Step #4: #7 0x59d2c7 in type_call /src/cpython3/Objects/typeobject.c:1017:11
Step #4: #8 0x4fbb0b in _PyObject_MakeTpCall 
/src/cpython3/Objects/call.c:191:18
Step #4: #9 0x4feefa in _PyObject_VectorcallTstate 
/src/cpython3/./Include/cpython/abstract.h:116:16
Step #4: #10 0x4fb5e7 in _PyObject_CallNoArgTstate 
/src/cpython3/./Include/internal/pycore_call.h:33:12
Step #4: 

[issue32309] Implement asyncio.run_in_executor shortcut

2020-05-20 Thread miss-islington


miss-islington  added the comment:


New changeset 0f56263e62ba91d0baae40fb98947a3a98034a73 by Kyle Stanley in 
branch 'master':
bpo-32309: Add support for contextvars in asyncio.to_thread() (GH-20278)
https://github.com/python/cpython/commit/0f56263e62ba91d0baae40fb98947a3a98034a73


--

___
Python tracker 

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



[issue32309] Implement asyncio.run_in_executor shortcut

2020-05-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19556
pull_request: https://github.com/python/cpython/pull/20279

___
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-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

> So maybe the test coverage (or removal?) should be a separate issue.

That sounds good. Want to file the issue?

--

___
Python tracker 

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



[issue40703] PyType_FromSpec*() overwrites the type's "__module__"

2020-05-20 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40651] class:`OrderedDict` Examples: LRU implementation has a bug.

2020-05-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d88f0aa8e24ea7562f2e04833f46d8526e846334 by Miss Islington (bot) 
in branch '3.8':
bpo-40651: Improve LRU recipe in the OrderedDict documentation  (GH-GH-20139) 
(GH-20167)
https://github.com/python/cpython/commit/d88f0aa8e24ea7562f2e04833f46d8526e846334


--

___
Python tracker 

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



[issue32309] Implement asyncio.run_in_executor shortcut

2020-05-20 Thread Kyle Stanley


Change by Kyle Stanley :


--
pull_requests: +19555
pull_request: https://github.com/python/cpython/pull/20278

___
Python tracker 

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



[issue29981] Update Index for set, dict, and generator 'comprehensions'

2020-05-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I wrote the above before your PR was listed here.  I will review it a piece at 
a time.

--

___
Python tracker 

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



[issue29981] Update Index for set, dict, and generator 'comprehensions'

2020-05-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The issue is still open. The basic idea is to treat list, set, and dict in 
parallel fashions in the docs, mostly copying what is done with lists for the 
other two.  In my original post, the title and items 1 to 3 are about index 
entries in Reference chapter 6, Expressions (reference/expressions.rst).  I 
tacked on item 4 about adding entries to the Glossary (glossary.rst).  These 
could easily be and for easier review should be separate PRs.

The original PR, opened relatively soon after githup went public, was reviewed 
by 5 different committers, which is an unusually large number.
It included both indexing and glossary changes, and added changes to the 
Library chapter on built-in types (stdtypes.rst).  The last was the most 
controversial and definitely needed to be a followup PR.

In June 2017, after much discussion and revision, Louie Lu switched his github 
account from 'louisom' to 'louielu' and ceased working on this.  Some later, 
louisom/cpython was deleted and the PR closed for inactivity.

> We don't *call* generator expressions 'generator comprehensions',

A subsequent pydev discussion approved of 'generator comprehension' and I 
believe some doc changes followed*.  So I expect that the previous PR is 
somewhat obsolete.  Pick either indexing Expressions or new Glossary entries 
and see what change you think is still needed and consider any discussion of 
that change on PR 995. Note: I am not sure that I reviewed (and approved) the 
index part of the patch, as I likely focused on other parts.   You can propose 
(and justify) changes here before making a PR.

* Any changes may or may not have been backported to 3.7, so it may or may not 
be possible to easily backport any new changes (with the robot).

--
keywords:  -patch
stage: patch review -> needs patch
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue40425] Refleak in CDataObject

2020-05-20 Thread Zachary Ware


Zachary Ware  added the comment:

Absent anyone showing me where a proper refleak is here, I'm closing the issue.

--
resolution:  -> works for me
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



[issue40065] py39: remove deprecation note for xml.etree.cElementTree

2020-05-20 Thread Manjusaka


Manjusaka  added the comment:

I'm working on it. I will make a PR today.

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Okay, I'll keep it one issue then. Someone else is still welcome to work on the 
more general issue.

Note that there is some chance the narrower fix should happen independent of 
the more general fix. This is because _PyErr_ChainExceptions() (which is the 
call I added for the gen.throw() case) doesn't call the code path that we're 
discussing. Thus, cycles could still wind up being introduced at that call site.

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> If someone else agrees, I can create a new issue.

I'd keep this one issue, but really up to you. I don't think I have time in the 
next few days to work on what I proposed but would be happy to brainstorm / 
review PRs.

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

>From a process perspective, I think we should probably pursue two PR's for 
>this: one for the general issue that affects all Python versions (what Yury is 
>talking about), and something narrower that addresses the 3.9.0b1 case that 
>came up here. I'd like to focus on the latter first. Someone else is welcome 
>to work on the more general issue while I'm doing that.

I'm not 100% sure if the more general issue should be a new bpo issue or not. 
I'm leaning towards separate because it is bigger and there are different 
decisions to be made around backporting, etc, but we should decide that now. If 
someone else agrees, I can create a new issue.

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

Just a note, __context__ cycles can theoretically be longer than 2 nodes. I've 
encountered cycles like `exc.__context__.__context__.__context__ is exc` a few 
times in my life, typically resulting from some weird third-party libraries.

The only solution is to use a `set()` collection to track already visited 
exceptions.

To make it fast I propose to modify the code to:

1. Do a fast traverse with a regular while loop without tracking (no set())

2. If the number of iterations is longer than 100 and there's still no top 
context found -- go to (3)

3. Do a slower implementation with set()

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I don't think that would be a real solution because it looks like that would 
cause the while loop always to loop at most once (which would defeat its 
purpose) -- because the loop ends with "o = context":

while ((context = PyException_GetContext(o))) {
Py_DECREF(context);
if (context == value) {
PyException_SetContext(o, NULL);
break;
}
o = context;
}

--

___
Python tracker 

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



[issue40563] Support pathlike objects on dbm/shelve

2020-05-20 Thread Hakan Çelik

Change by Hakan Çelik :


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

___
Python tracker 

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



[issue38870] Expose ast.unparse in the ast module

2020-05-20 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue40704] PyIter_Check fails when compiling in the Limited API

2020-05-20 Thread Maxwell Bernstein

Maxwell Bernstein  added the comment:

See for example the following C program:

```
#define Py_LIMITED_API

#include "Python.h"

int main() {
  Py_Initialize();
  PyObject* foo;
  PyIter_Check(foo);
}
```

when compiled (gcc test.c `pkg-config --cflags python3`) produces:

```
In file included from /usr/include/python3.6m/Python.h:135:0,
 from test.c:3:
test.c: In function ‘main’:
/usr/include/python3.6m/abstract.h:712:20: error: dereferencing pointer to 
incomplete type ‘struct _typeobject’
 ((obj)->ob_type->tp_iternext != NULL && \
^
test.c:8:3: note: in expansion of macro ‘PyIter_Check’
   PyIter_Check(foo);
   ^~~~
/usr/include/python3.6m/abstract.h:713:38: error: 
‘_PyObject_NextNotImplemented’ undeclared (first use in this function); did you 
mean ‘PyObject_HashNotImplemented’?
  (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
  ^
test.c:8:3: note: in expansion of macro ‘PyIter_Check’
   PyIter_Check(foo);
   ^~~~
/usr/include/python3.6m/abstract.h:713:38: note: each undeclared identifier is 
reported only once for each function it appears in
  (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
  ^
test.c:8:3: note: in expansion of macro ‘PyIter_Check’
   PyIter_Check(foo);
   ^~~~
```

--

___
Python tracker 

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



[issue40065] py39: remove deprecation note for xml.etree.cElementTree

2020-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

Although the modules has been deprecated for a long time, the removal came as 
surprise. We are currently debating to bring the module back and warn users 
that it will be removed in 3.10.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue40704] PyIter_Check fails when compiling in the Limited API

2020-05-20 Thread Maxwell Bernstein


New submission from Maxwell Bernstein :

PyIter_Check is itself marked as available in the Limited API but:

a) it's a macro, and
b) it pokes directly at tp_iternext

This means that it's functionally impossible to use PyIter_Check
when working with the Limited API.

--
components: C API
messages: 369479
nosy: tekknolagi
priority: normal
severity: normal
status: open
title: PyIter_Check fails when compiling in the Limited API
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue40563] Support pathlike objects on dbm/shelve

2020-05-20 Thread Hakan Çelik

Hakan Çelik  added the comment:

Yes I will send pr soon.

--

___
Python tracker 

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



[issue40703] PyType_FromSpec*() overwrites the type's "__module__"

2020-05-20 Thread Stefan Behnel


Change by Stefan Behnel :


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

___
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-05-20 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I just ran the entire test suite with:

--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4179,6 +4179,7 @@ _PyEval_EvalCode(PyThreadState *tstate,
 Py_ssize_t j;

 if (keyword == NULL || !PyUnicode_Check(keyword)) {
+printf("THIS CODE WAS RUN!\n");
 _PyErr_Format(tstate, PyExc_TypeError,
   "%U() keywords must be strings",
   qualname);

and the line was never printed. So maybe the test coverage (or removal?) should 
be a separate issue.

--

___
Python tracker 

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



[issue40703] PyType_FromSpec*() overwrites the type's "__module__"

2020-05-20 Thread Stefan Behnel


New submission from Stefan Behnel :

The PyType_FromSpec() functions set the type's "__module__" attribute at the 
end:

https://github.com/python/cpython/blob/0509c4547fc95cc32a91ac446a26192c3bfdf157/Objects/typeobject.c#L3154-L3172

There are only two possible cases, either it finds a module name in the spec 
name and sets "__module__" from that, or it outputs a deprecation warning. Both 
behaviours are annoying because they ignore anything that the type already has 
in its dict, e.g. a property entry from the "members" or "getset" structs.

Since this code can't really be moved before the call to "PyType_Ready()" 
(which creates the type's dict and populates it), I think the best fix would be 
to first check if "__module__" is already in the dict and only otherwise take 
care of setting it.

I noticed this when trying to make the "__module__" attribute of Cython's 
coroutine type work with type specs, which should actually return the instance 
specific module name, i.e. the module that defines the coroutine, not the 
module that defines the type. This would normally be solved with an entry in 
"members", but that is discarded by the code above. While this approach means 
that the type does not have its own "__module__" entry, I think the use cases 
of pickling and documentation support it, because they care about the module 
name of the instance, not of the type.

I think working around this behaviour is somewhat easy by creating a new 
descriptor with PyDescr_NewMember() and re-adding it after calling 
PyType_FromSpec*(), so this is something that can just be fixed in Py3.9+.

Relevant tickets: issue 15146 for setting "__module__" and issue 20204 for the 
deprecation warning.

--
components: C API
messages: 369476
nosy: ncoghlan, petr.viktorin, scoder, serhiy.storchaka
priority: normal
severity: normal
status: open
title: PyType_FromSpec*() overwrites the type's "__module__"
type: behavior
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



[issue29981] Update Index for set, dict, and generator 'comprehensions'

2020-05-20 Thread Florian Dahlitz


Change by Florian Dahlitz :


--
keywords: +patch
pull_requests: +19552
pull_request: https://github.com/python/cpython/pull/20272

___
Python tracker 

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



[issue29981] Update Index for set, dict, and generator 'comprehensions'

2020-05-20 Thread Florian Dahlitz


Florian Dahlitz  added the comment:

I would like to work on this issue if it is still open.

--
nosy: +DahlitzFlorian

___
Python tracker 

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



[issue40065] py39: remove deprecation note for xml.etree.cElementTree

2020-05-20 Thread Florian Dahlitz


Florian Dahlitz  added the comment:

Are you still working on this @Manjusaka?
If not, I would like to submit a patch for it.

--
nosy: +DahlitzFlorian

___
Python tracker 

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



[issue39580] Check for COMMAND_LINE_INSTALL variable in Python_Documentation.pkg

2020-05-20 Thread Rick Heil


Change by Rick Heil :


--
keywords: +patch
nosy: +rickheil
nosy_count: 3.0 -> 4.0
pull_requests: +19551
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20271

___
Python tracker 

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



[issue40702] frozensets should not allow the |= operator

2020-05-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is okay. In this case `a |= b` is equivalent to `a = a | b`.

The same behavior is for tuples, strings, and other non-mutable collections:

t = (1, 2)
t += (3, 4)
s = 'ab'
s += 'cd'

And even for numbers!

i = 5
i += 1

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



[issue39580] Check for COMMAND_LINE_INSTALL variable in Python_Documentation.pkg

2020-05-20 Thread Rick Heil


Rick Heil  added the comment:

In case folks reading this are not aware, installer(8) sets an environmental 
variable COMMAND_LINE_INSTALL when an installation is triggered on the command 
line versus when a user double-clicks a package in the GUI to kick off the 
install.

I've filed the linked PR to add a test on the APPDIR open statement to avoid 
popping up the Finder when the package is installed on the command line. If 
there's a different method by which I should do this, please point me in the 
vague direction and I'm happy to update!

(note - I just signed the CLA today so it should be registered soonish)

--

___
Python tracker 

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



[issue40563] Support pathlike objects on dbm/shelve

2020-05-20 Thread Florian Dahlitz


Florian Dahlitz  added the comment:

Are you still working on this @hakancelik?

--
nosy: +DahlitzFlorian

___
Python tracker 

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



[issue40702] frozensets should not allow the |= operator

2020-05-20 Thread Chris Cordero

New submission from Chris Cordero :

Frozensets disallow the .update and the .__ior__ methods from being used, but 
allows the |= operator, which I think is inconsistent with the disallowed 
methods†.

```
foo = frozenset()
print(foo) # frozenset()
foo.update({"hello"})  # AttributeError, expected
foo.__ior__({"hello"}) # AttributeError, expected
foo |= {"hello"}   # No error
print(foo) # frozenset({"hello"})
```

--
messages: 369470
nosy: cs-cordero
priority: normal
severity: normal
status: open
title: frozensets should not allow the |= operator
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



[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-20 Thread Eric L.


New submission from Eric L. :

tempfile fails on mixed str and bytes when setting tempfile.tempdir to a 
non-existent bytes path but succeeds when set to an existing bytes path.

$ python3.9
Python 3.9.0a6 (default, Apr 28 2020, 00:00:00) 
[GCC 10.0.1 20200430 (Red Hat 10.0.1-0.14)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.tempdir = b'/doesntexist'
>>> tempfile.TemporaryFile()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.9/tempfile.py", line 615, in TemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "/usr/lib64/python3.9/tempfile.py", line 248, in _mkstemp_inner
file = _os.path.join(dir, pre + name + suf)
  File "/usr/lib64/python3.9/posixpath.py", line 90, in join
genericpath._check_arg_types('join', a, *p)
  File "/usr/lib64/python3.9/genericpath.py", line 155, in _check_arg_types
raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components
>>> tempfile.tempdir = b'/tmp'
>>> tempfile.TemporaryFile()
<_io.BufferedRandom name=3>
>>> tempfile.mktemp()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.9/tempfile.py", line 400, in mktemp
file = _os.path.join(dir, prefix + name + suffix)
  File "/usr/lib64/python3.9/posixpath.py", line 90, in join
genericpath._check_arg_types('join', a, *p)
  File "/usr/lib64/python3.9/genericpath.py", line 155, in _check_arg_types
raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components

It seems to me that the case of `tempfile.tempdir` being of type bytes hasn't 
been completely considered and is handled inconsistently. My suggestion would 
be to manage the paths as bytes if there is no other indication like suffix or 
prefix.

--
messages: 369469
nosy: ericzolf
priority: normal
severity: normal
status: open
title: tempfile mixes str and bytes in an inconsistent manner
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-05-20 Thread Irv Kalb


Irv Kalb  added the comment:

Thanks for all the message about this issue.

I have made a three-minute video that demonstrates what I am seeing.  Here is a 
link (the video is marked as "unlisted" so only people with this link can see 
it):

https://youtu.be/OIu-HCVVDn8

To answer your questions:

- Using 3.7 because I'm a heavy user of Pygame, and my understanding is that 
3.8 is not compatible with Pygame now
- Yes, this is an absolutely standard installation from Python.org
- In all my testing, I have never seen multiple instances of IDLE.  There is 
only one.

I understand from the comments that this may not fully be an IDLE issue, and 
may require changes from Apple.  

I appreciate anything you can do to help resolve this issue. I am willing to 
supply any more information and/or do any testing to help.

--

___
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-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

Can you propose a PR with your doc enhancement? I suggest to start with 
updating https://docs.python.org/dev/library/sys.html#sys.platlibdir 
documentation.

--

___
Python tracker 

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



[issue40670] supplying an empty string to timeit causes an IndentationError

2020-05-20 Thread Edison Abahurire


Edison Abahurire  added the comment:

Yes, This is unexpected

In the first case:
Supplying an empty string can also mean no code has been supplied. So it could 
be better treated as 'pass'.

In the second case:
 Error messages are meant to inform you of what you have done wrong so that you 
fix it. I think raising an Indentation error is far from what a user who is 
calling that method would be expecting, it does not help them at-all.

In the third case:
Supplying an empty string to timeit directly in bash ```python -m timeit '' ``` 
raises no such error. so we could say that fixing this will align the behavior 
in the two ways the function is run to be the same.

--

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-05-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
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-05-20 Thread hai shi


Change by hai shi :


--
pull_requests: +19549
pull_request: https://github.com/python/cpython/pull/20263

___
Python tracker 

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



[issue40700] Make WSGIRequestHandler easier to be customized by the user

2020-05-20 Thread Manjusaka


Change by Manjusaka :


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

___
Python tracker 

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



[issue40700] Make WSGIRequestHandler easier to be customized by the user

2020-05-20 Thread Manjusaka


New submission from Manjusaka :

Hello everyone

I think we can make WSGIRequestHandler in wsgiref easier to be customized by 
the user

Here's the detail

the WSGIRequestHandler in wsgiref.simple_server has some code like this

class WSGIRequestHandler(BaseHTTPRequestHandler):
def handle(self):
"""Handle a single HTTP request"""

self.raw_requestline = self.rfile.readline(65537)
if len(self.raw_requestline) > 65536:
self.requestline = ''
self.request_version = ''
self.command = ''
self.send_error(414)
return

if not self.parse_request(): # An error code has been sent, just exit
return

handler = ServerHandler(
self.rfile, self.wfile, self.get_stderr(), self.get_environ(),
multithread=False,
)
handler.request_handler = self  # backpointer for logging
handler.run(self.server.get_app())

If people want just to replace the ServerHandler, they need to override all the 
handle method, I don't think this is a good way to use.

I prefer do something like this

class WSGIRequestHandler(BaseHTTPRequestHandler):

server_version = "WSGIServer/" + __version__
server_handler = ServerHandler

def handle(self):
"""Handle a single HTTP request"""

self.raw_requestline = self.rfile.readline(65537)
if len(self.raw_requestline) > 65536:
self.requestline = ''
self.request_version = ''
self.command = ''
self.send_error(414)
return

if not self.parse_request(): # An error code has been sent, just exit
return

handler = self.server_handler(
self.rfile, self.wfile, self.get_stderr(), self.get_environ(),
multithread=False,
)
handler.request_handler = self  # backpointer for logging
handler.run(self.server.get_app())

Now if people just need simple code to replace the ServerHandler, like this

class CustomWSGIRequestHandler(WSGIRequestHandler):
server_handler = CustomeServerHandler

what do you think, I'm glad to make a PR for this

--
components: Library (Lib)
messages: 369465
nosy: Manjusaka
priority: normal
severity: normal
status: open
title: Make WSGIRequestHandler easier to be customized by the user
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Maybe we should revert this change and modify the "how to port to ..." section 
as we did in bpo-35810 to tell users that they need to manually visit the 
parent in classes created with PyType_FromSpec

--

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-05-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
Removed message: https://bugs.python.org/msg369463

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Maybe we should revert

--
priority: normal -> release blocker

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-05-20 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Re-opening the issue

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> Is this a separate bug? So maybe the issue is that the new code is letting 
> things get into this state. Some of my changes added new chaining in various 
> places, so that would fit (but still investigating).

Looks like there isn't a recursion guard on 
https://github.com/python/cpython/blob/e572c7f6dbe5397153803eab256e4a4ca3384f80/Python/errors.c#L143-L154

I'm not sure if this would be the real solution but, for this case, it works 
diff --git a/Python/errors.c b/Python/errors.c
index 3b42c1120b..ba3df483e2 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -141,8 +141,8 @@ _PyErr_SetObject(PyThreadState *tstate, PyObject 
*exception, PyObject *value)
usually very short. Sensitive readers may try
to inline the call to PyException_GetContext. */
 if (exc_value != value) {
-PyObject *o = exc_value, *context;
-while ((context = PyException_GetContext(o))) {
+PyObject *o = exc_value, *context = NULL;
+while (o != context && (context = PyException_GetContext(o))) {
 Py_DECREF(context);
 if (context == value) {
 PyException_SetContext(o, NULL);
(END)

--
nosy: +BTaskaya

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-05-20 Thread Petr Viktorin


Petr Viktorin  added the comment:

It looks like the fix breaks types that override Py_tp_alloc but not 
Py_tp_traverse (as some types in PySide do.)

I'll investigate more and work on fixing that if someone doesn't beat me to it.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks Charis and Donald!

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread miss-islington


miss-islington  added the comment:


New changeset f541a371a5e608517314a106012e0c19739d2d02 by Miss Islington (bot) 
in branch '3.9':
bpo-40698: Improve distutils upload hash digests (GH-20260)
https://github.com/python/cpython/commit/f541a371a5e608517314a106012e0c19739d2d02


--

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread miss-islington


miss-islington  added the comment:


New changeset e572c7f6dbe5397153803eab256e4a4ca3384f80 by Christian Heimes in 
branch 'master':
bpo-40698: Improve distutils upload hash digests (GH-20260)
https://github.com/python/cpython/commit/e572c7f6dbe5397153803eab256e4a4ca3384f80


--
nosy: +miss-islington

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19547
pull_request: https://github.com/python/cpython/pull/20261

___
Python tracker 

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



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2020-05-20 Thread Tal Einat


Tal Einat  added the comment:

Attaching the changes I made while testing as a patch file.

--
Added file: https://bugs.python.org/file49173/tkinter-clipboard-on-exit.patch

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-05-20 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I will look at this tommorrow. Am abit busy today. Thanks Victor

--

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-05-20 Thread STINNER Victor


STINNER Victor  added the comment:

The new test leaks references:

https://buildbot.python.org/all/#/builders/563/builds/105

test_interpreters leaked [216, 216, 216] references, sum=648
test_interpreters leaked [84, 84, 84] memory blocks, sum=252

Use "./python -m test.bisect_cmd -R 3:3 test_interpreters" to find tests which 
leak. Example:

$ ./python -m test test_interpreters -R 3:3 -m 
test.test_interpreters.TestInterpreterDestroy.test_from_current
0:00:00 load avg: 0.82 Run tests sequentially
0:00:00 load avg: 0.82 [1/1] test_interpreters
beginning 6 repetitions
123456
..
test_interpreters leaked [36, 36, 36] references, sum=108
test_interpreters leaked [14, 14, 14] memory blocks, sum=42
test_interpreters failed

== Tests result: FAILURE ==

1 test failed:
test_interpreters

Total duration: 1.3 sec
Tests result: FAILURE

--

___
Python tracker 

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



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2020-05-20 Thread E. Paine


E. Paine  added the comment:

After some initial testing, I have found that while calling Tcl_Finalize  on 
window closure keeps the clipboard contents (as expected), it also finishes the 
Python interpreter.

The solution was to instead use the Tcl_FinalizeThread method, "which you can 
call if you just want to clean up per-thread state" 
(https://www.tcl.tk/man/tcl8.4/TclLib/Exit.htm).

Reading this, I was expecting it to stop further Tk instances from being 
created after the original one was closed, however some initial testing has 
found this to not be true.

I feel it is too early to create a PR for this yet (I need to do more research 
and properly understand the calls), but it is quite possible calling this 
method on root "destroy" is the only thing required to fix this issue.

--

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks for your elaborate explanation, Donald!

I have implemented your proposal in PR 20260.

--

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

The Django details might not matter so much at this point, but to add to 
something I said above: It might not only be process_exception_by_middleware() 
as I mentioned, but also asgiref's sync_to_async() function. In that function, 
you can see an already active exception being re-raised (here the exc_info 
comes from sys.exc_info()):

# If we have an exception, run the function inside the except block
# after raising it so exc_info is correctly populated.
if exc_info[1]:
try:
raise exc_info[1]
except:
return func(*args, **kwargs)
else:
return func(*args, **kwargs)

https://github.com/django/asgiref/blob/edd0570a4f6e46f0948afa5ef197a192bb95b7b7/asgiref/sync.py#L306-L314

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

To start out sharing what I found in the Django code:

Here inside BaseHandler._get_response_async():
https://github.com/django/django/blob/3460ea49e839fd6bb924c48eaa1cd3d6dc888035/django/core/handlers/base.py#L226-L232

try:
response = await wrapped_callback(request, *callback_args,
  **callback_kwargs)
except Exception as e:
response = await sync_to_async(  # This line hangs.
self.process_exception_by_middleware,
thread_sensitive=True,
)(e, request)

you can see an exception being handled, which is then passed to 
process_exception_by_middleware(). Process_exception_by_middleware() can wind 
up re-raising that same exception, which causes __context__ to be set 
circularly inside the except block:
https://github.com/django/django/blob/3460ea49e839fd6bb924c48eaa1cd3d6dc888035/django/core/handlers/base.py#L323-L332

If you boil this down, you get the following as a simple reproducer. This 
doesn't hang, but you can tell the difference by comparing exc2 to 
exc2.__context as indicated below:

import asyncio

async def process_exc(exc):
raise exc

async def run():
try:
raise RuntimeError
except Exception as exc:
task = asyncio.create_task(process_exc(exc))
try:
await task
except BaseException as exc2:
# Prints True in 3.9.0b1 and False in 3.9.0a6.
print(exc2 is exc2.__context__)

loop = asyncio.new_event_loop()
try:
loop.run_until_complete(run())
finally:
loop.close()

The cause is probably the following PR, which enabled exception chaining for 
gen.throw() in the yield from case:
https://github.com/python/cpython/pull/19858
So the answer might be to do some cycle detection when chaining the exception, 
which apparently _PyErr_ChainExceptions() doesn't do.

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

FWIW, I found that the following hangs, but it also hangs on earlier versions 
of Python:

import traceback

try:
raise RuntimeError
except Exception as exc:
print(f'handling: {exc!r}')
exc.__context__ = exc
print('printing traceback')
print(traceback.format_exc())  # hangs

Is this a separate bug? So maybe the issue is that the new code is letting 
things get into this state. Some of my changes added new chaining in various 
places, so that would fit (but still investigating).

--

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

Charis pointed me to https://github.com/pypa/warehouse/issues/681 / 
https://github.com/pypa/warehouse/pull/891

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

There is also https://github.com/pypa/warehouse/pull/888

So I would assume it's safe it change the digest to sha256.

--
nosy: +cstratak

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Donald Stufft


Donald Stufft  added the comment:

> Does PyPI support other digests, e.g. SHA2-256 digest?

There is a simple and a complicated answer to this.

The simple answer is yes, PyPI supports uploads with any combination of MD5, 
SHA256, and blake2_256 (blake2b with a 256 digest, no personalization or key). 
It will also compute all 3 on an upload on it's own and verify that they match 
any provided hashes and to fill in any missing hashes.

The more complicated answer is the upload API is an old API from long before we 
started documenting and standardizing them, so when you start talking about non 
PyPI implementations of that API, what they support is kind of a big who knows.

More to the problem at hand:

We don't rely on this hash for security (We couldn't, it comes in the exact 
same payload as the artifact itself from the exact same source, someone who can 
modify the artifact en route can modify the hash too). So the inclusion of MD5 
is not a concern.

Removing it *might* break non-PyPI servers that attempted to implement this API 
and assumed it was a mandatory field (though I do not have any a priori 
knowledge of this being the case).

Adding additional hashes *might* break non-PyPI servers that assumed what 
distutils used to send was all it would ever send (this is unlikely though, 
most web tools ignore unknown form fields).

I looked into what twine is doing here, and it appears it is sending md5, 
sha256, and blake2_256 hashes all along with every request. However if FIPS 
mode has disabled MD5 it just skips generating and sending MD5 (but still sends 
the other two) and it appears it's done this for 2+ years.

It's probably safe to just mimc what twine is doing here, sending all 3 hashes, 
skip MD5 if it's unavailable.

--

___
Python tracker 

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



[issue40642] Cpython "pystate.h" subdirectory wrong

2020-05-20 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks for the info.

It's weird that this is just showing up for you, and I assume works everywhere 
else. How are you invoking the compiler, via make, or something else?

And, what's the gcc command line look like when this specific file fails?

I grepped the source code, and didn't see anywhere else where we import 
something this way, so maybe that's a reason to change it.

As for the "./" think: maybe using it would be a better hint as to what's going 
on.

But I'd like to hear from other core devs and get their opinion on any change, 
first.

--

___
Python tracker 

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



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2020-05-20 Thread Tal Einat


Tal Einat  added the comment:

Regarding multiple Tk instances, IMO we should try the straightforward solution 
first: Tcl/Tk has its own mechanisms for handling per-interpreter state, so we 
may not actually need to handle any of this ourselves.

Regarding the title of this issue, it is indeed a bug in Tkinter rather than 
IDLE, but it does affect IDLE significantly, and someone searching for this 
might search for IDLE rather than Tkinter. I suggest leaving the title as it is.

--

___
Python tracker 

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



[issue40699] Memory leak in threading library with Python 3.6-3.8

2020-05-20 Thread Cristian Martinez de Morentin


New submission from Cristian Martinez de Morentin :

Hi everyone,

I have found a memory leak when using Queue and Condition from threading 
library.

The issue can be reproduced with the following code:


import queue
import threading


class MemoryTest(threading.Thread):

def __init__(self):
threading.Thread.__init__(self)
self.queue = queue.Queue()
self.cv = threading.Condition()

def put(self, msg):
self.queue.put(msg)

with self.cv:
self.cv.notify()

def run(self):
while True:
while not self.queue.empty():
self.queue.get()
self.queue.task_done()

with self.cv:
self.cv.wait_for(lambda: not self.queue.empty())


If you run a MemoryTest object in another thread, by calling its start() 
method, and you send it messages by using its put() method, you will see how 
RAM memory usage starts increasing.

This behaviour has been observed in Windows (64 bits) with Python 3.6, 3.7 & 
3.8, but not with Python 3.5.

Thank you so much.

--
components: Windows
messages: 369443
nosy: Cristian Martinez de Morentin, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: Memory leak in threading library with Python 3.6-3.8
type: resource usage
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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +dstufft, eric.araujo, gregory.p.smith

___
Python tracker 

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



[issue40698] distutils.command.upload md5_digest

2020-05-20 Thread Christian Heimes


New submission from Christian Heimes :

The distutils upload command creates a MD5 digest of the file content. This is 
not compatible with systems with systems that run under a strict security 
policy that blocks MD5.

Possible fixes are:

* declare that the MD5 digest is not used for security. Security is provided by 
TLS/SSL and HTTPS. The digest is just a simple checksum to detect file 
corruption during upload.
* Remove MD5 digest completely
* Don't create a MD5 digest if ``hashlib.md5(content)`` fails
* Skip the test case if MD5 is not available

Does PyPI support other digests, e.g. SHA2-256 digest?

--
components: Library (Lib)
messages: 369442
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: distutils.command.upload md5_digest
type: behavior
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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I'm getting close to tracking this down. There is a certain point in the code 
path of the Django test where `exc is exc.__context__` becomes True. I'm 
guessing this is what's causing the hang. I'll try to get a simple reproducer 
(there is a lot of Django code to sort through).

--

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +aeros

___
Python tracker 

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



[issue40452] Tkinter/IDLE: preserve clipboard on closure

2020-05-20 Thread E. Paine


E. Paine  added the comment:

Multiple Tk instances are already recommended against, but what would be the 
implications of preventing multiple roots? 

A simple check could be added to the Tk class init which ensures _default_root 
is None (if it is not None, an error is raised). In this case, I think it would 
be much easier for the proposed changes to _tkinter, but also make future 
maintenance of tkinter easier.

I am currently investigating potential solutions based on what Tal has found, 
and will come back with details if I succeed (and thank you Tal for offering to 
review a PR).

Separately, should we change the issue from IDLE to tkinter, as that the fix we 
are looking at applying?

--

___
Python tracker 

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



[issue40695] hashlib: OpenSSL hash detection should obey security policy

2020-05-20 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue9216] FIPS support for hashlib

2020-05-20 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +19544
pull_request: https://github.com/python/cpython/pull/20258

___
Python tracker 

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



[issue40697] add fissix as a lib2to3 alternative

2020-05-20 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Does / Will this project actively maintained? From what I can tell from the 
numerical stats (such as commit dates and star counts), it is not very much 
used and I'm afraid it doesn't look very active.

--
nosy: +BTaskaya, pablogsal

___
Python tracker 

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



[issue40697] add fissix as a lib2to3 alternative

2020-05-20 Thread Thomas Grainger


New submission from Thomas Grainger :

now that lib2to3 is deprecated, the stdlib should point to alternatives

currently the docs point to libcst or parso, however neither is a drop-in 
replacement for lib2to3

the docs should add fissix as a lib2to3 alternative, because it is a drop-in 
replacement

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 369438
nosy: graingert
priority: normal
pull_requests: 19543
severity: normal
status: open
title: add fissix as a lib2to3 alternative
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



[issue40448] ensurepip uses cache directory

2020-05-20 Thread Paul Moore


Paul Moore  added the comment:

PR looks good to me. There's a test failure that needs fixing and the PR needs 
a news entry, but otherwise looks fine.

--

___
Python tracker 

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



[issue40448] ensurepip uses cache directory

2020-05-20 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the PR. We should get a review from at least one of the pip 
developers. @oradyunsg, @dstufft, @paul.moore, opinions?

--
nosy: +Marcus.Smith, ned.deily, paul.moore
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



[issue34956] _tkinter built on macOS 10.14 does not link to Tcl and Tk in /Library/Frameworks

2020-05-20 Thread miss-islington


miss-islington  added the comment:


New changeset e7bf8684e2f9d5f7e92284a0ea085a791f5173df by Miss Islington (bot) 
in branch '3.9':
bpo-34956: edit and format better NEWS item in 3.9.0b1 changelog (GH-20255)
https://github.com/python/cpython/commit/e7bf8684e2f9d5f7e92284a0ea085a791f5173df


--

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2020-05-20 Thread Ned Deily


Change by Ned Deily :


--
nosy:  -ned.deily
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



[issue34956] _tkinter built on macOS 10.14 does not link to Tcl and Tk in /Library/Frameworks

2020-05-20 Thread Ned Deily


Ned Deily  added the comment:


New changeset bac170cd93bbae939fcb29ccc6b5d423f7f4a089 by Ned Deily in branch 
'master':
bpo-34956: edit and format better NEWS item in 3.9.0b1 changelog (GH-20255)
https://github.com/python/cpython/commit/bac170cd93bbae939fcb29ccc6b5d423f7f4a089


--
message_count: 6.0 -> 7.0
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +19542
pull_request: https://github.com/python/cpython/pull/20257

___
Python tracker 

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



[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-05-20 Thread Ned Deily


Ned Deily  added the comment:

Thanks, Andrew, for the offer. I think we have enough to go on right now but we 
may want to touch base a bit later.

>From your comment about how IDLE on macOS is different than it is on Windows 
>or Linux, I assume that means you may be new to IDLE on macOS. Yes, there are 
>a number of sometimes subtle differences. Most of these are differences in how 
>Tk behaves (rather than IDLE itself) and usually with a very good reason: Tk 
>tries very hard to be a "good" citizen in each of the three major windowing 
>environments it is supported: Windows-native, macOS-native, and X11 (Linux and 
>others). As such, Tk tries to look and behave as native applications in each 
>are expected to behave, which leads to subtle but important programming 
>issues, like the fact that macOS applications are expected to have one menu 
>bar that appears at the top of the active display whereas on other platforms, 
>each window may have its own menu bar.  Or Tk uses the macOS-supplied file 
>opening and closing sheets which differ from other platforms, etc etc. That 
>can make using Tk-based apps, like IDLE, more familiar-looking to and easier 
 to learn for macOS users but it can be disconcerting if you are using such an 
app on multiple platforms. Or perhaps you meant something else.

--

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2020-05-20 Thread Peixing Xin


Change by Peixing Xin :


--
pull_requests: +19541
pull_request: https://github.com/python/cpython/pull/20256

___
Python tracker 

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



[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-05-20 Thread AndrewGYork


AndrewGYork  added the comment:

If it's helpful, I'd be happy to do a screenshare session (Google Meet, Zoom, 
etc), to demonstrate and explore the behavior.

We have a 10.15.4 Mac with python 3.8.3 freshly installed from python.org, Tk 
version 8.6.8, IDLE version 3.8.3. IDLE file opening functions very differently 
on this machine then on any Linux or Windows machine I've used in the past 
decade.

--

___
Python tracker 

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



[issue34956] _tkinter built on macOS 10.14 does not link to Tcl and Tk in /Library/Frameworks

2020-05-20 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +19540
pull_request: https://github.com/python/cpython/pull/20255

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Chris Jerdonek


Change by Chris Jerdonek :


--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-05-20 Thread Ned Deily


Ned Deily  added the comment:

Irv, I'm sorry you are having problems and I think it is very reasonable to 
bump the priority of the issue as you are not alone, even though, as Terry 
notes, a complete resolution may require changes elsewhere. I am looking more 
into this now. macOS 10.15 Catalina has introduced a number of changes in the 
interest of improving your security and some of these have had an impact on 
both Python and on Tcl/Tk which IDLE uses to power its GUI. While most of the 
10.15-specific issues are addressed in the latest release of Python (3.8.3), 
the issue of double-clicking a file while IDLE is already open is not yet. 
However, I notice you mention that you are using IDLE from Python 3.7.3. If so, 
be aware that that is not the latest release of either Python 3 or Python 3.7 
(3.7.3 predates Catalina.) 3.7.7 is the most recent for 3.7 but Python 3.8 is 
now current and its most recent release, 3.8.3, has the most up-to-date support 
for 10.15. If possible, you should update to 3.8.3 or at least to 3.7
 .7, which has some. That won't fix everyting but it may make some issues go 
away.

You also mention the apparent closing of an IDLE edit window when you open 
another edit window. I have not seen nor am aware of reports of behavior 
exactly like that; however, I think you might be running into a similar 
situation to what Andrew reports in an earlier comment (msg366978) in this 
issue. What you may be going on is a case where trying to open another file to 
edit in IDLE unexpectedly causes a second instance of IDLE to open, with the 
original file still open in the original instance (but perhaps with its windows 
now obscured by other windows) and with the second file open in an edit window 
in the additional IDLE instance.  That can be very confusing as having more 
than one instance of the same app running is normally not supposed to happen. 
One way to tell that this is happening is to check the macOS Dock and see if 
there is more than one IDLE icon present with the active indicator. If you 
switch to the other IDLE instance, your original edit window should still be 
prese
 nt. (You could also use Mission Control features to see all open windows.)  
Let us know if you can determine that the closing window is the second IDLE 
case with 3.7.3; this problem may not occur with IDLE from 3.8.3 but let us 
know.

By the way, I am assuming here that you are using Python 3.7.3 downloaded from 
the python.org website. Let us know if that is not the case.

--
priority: normal -> critical

___
Python tracker 

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



[issue31904] Python should support VxWorks RTOS

2020-05-20 Thread Peixing Xin


Change by Peixing Xin :


--
pull_requests: +19539
pull_request: https://github.com/python/cpython/pull/20254

___
Python tracker 

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



[issue9216] FIPS support for hashlib

2020-05-20 Thread Christian Heimes


Christian Heimes  added the comment:

Memo to me: Add whatsnew

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

___
Python tracker 

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



[issue40696] "await" hangs in Python3.9.0b1.

2020-05-20 Thread Mariusz Felisiak

New submission from Mariusz Felisiak :

We noticed a behavior change in Python3.9.0b1 (it works properly in 
Python3.9.0a6). One of our tests 
`handlers.tests.AsyncHandlerRequestTests.test_suspiciousop_in_view_returns_400`[1]
 hangs on `await`. `/suspicious/` is a view that raises a custom exception 
`SuspiciousOperation`.

[1] 
https://github.com/django/django/blob/8328811f048fed0dd22573224def8c65410c9f2e/tests/handlers/tests.py#L258-L260

--
components: asyncio
messages: 369429
nosy: asvetlov, carltongibson, felixxm, yselivanov
priority: normal
severity: normal
status: open
title: "await" hangs in Python3.9.0b1.
versions: Python 3.9

___
Python tracker 

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



[issue40695] hashlib: OpenSSL hash detection should obey security policy

2020-05-20 Thread Christian Heimes


New submission from Christian Heimes :

The hashlib module prefers hash implementations from OpenSSL. In case OpenSSL 
is not available or OpenSSL does not provide a hash algorithm, hashlib falls 
back to builtin implementations for MD5, SHA1, SHA2 family, SHA3/SHAKE family, 
and Blake2. The __get_openssl_constructor [1] function checks OpenSSL by 
retrieving the constructor and calling it. The calls fails if OpenSSL doesn't 
implement the EVP digest.

It also fails when the EVP digest is available but blocked by a security 
policy. In this case it falls back to the builtin implementation. If the 
builtin implementation has been removed by the package builder or 
--with-builtin-hashlib-hashes, then Python considers the hash algorithm as 
broken.

I propose to change the detection code so that Python uses OpenSSL 
implementation although it's blocked by the current system policy. 

Current behavior:

$ rpm -qa openssl
openssl-1.1.1g-1.fc32.x86_64
$ /configure -C --with-builtin-hashlib-hashes=blake2
$ make -j4
$ ./python
>>> import hashlib
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/root/cpython/Lib/hashlib.py", line 131, in __get_openssl_constructor
f()
ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/cpython/Lib/hashlib.py", line 251, in 
globals()[__func_name] = __get_hash(__func_name)
  File "/root/cpython/Lib/hashlib.py", line 135, in __get_openssl_constructor
return __get_builtin_constructor(name)
  File "/root/cpython/Lib/hashlib.py", line 118, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
>>> hashlib.md5()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'hashlib' has no attribute 'md5'


Proposed behavior:

$ ./python
>>> import hashlib
>>> hashlib.md5()
Traceback (most recent call last):
  File "", line 1, in 
ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
>>> hashlib.md5(usedforsecurity=False)



Related issue:

bpo-9216 added the new hash constructor argument "usedforsecurity".
bpo-40637 added a new configure option --with-builtin-hashlib-hashes

[1] 
https://github.com/python/cpython/blob/97fe9cfd9f81fe96a70e1ce80fce04b0c937bfac/Lib/hashlib.py#L121-L135

--
assignee: christian.heimes
components: Library (Lib)
messages: 369428
nosy: christian.heimes, gregory.p.smith
priority: normal
severity: normal
status: open
title: hashlib: OpenSSL hash detection should obey security policy
type: behavior
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



[issue40642] Cpython "pystate.h" subdirectory wrong

2020-05-20 Thread jpelizza


jpelizza  added the comment:

In hindsight I provided absolutely nothing, new to this, bound to make dumb 
mistakes.

Compiler error:

In file included from /usr/include/python3.8/pystate.h:129,
 from /usr/include/python3.8/genobject.h:11,
 from /usr/include/python3.8/Python.h:121,
 from cpppython.cpp:2:
/usr/include/python3.8/cpython/pystate.h:9:10: fatal error: 
cpython/initconfig.h: No such file or directory
9 | #include "cpython/initconfig.h"
  |  ^~
compilation terminated.

Compiler version:
gcc version 9.3.0 (Arch Linux 9.3.0-1)

About the change, yeah "initconfig.h" and the other one are the same, if it is 
a real problem then there is no need for "./"

After changing it to just "initconfig.h" the code compiled normally. From my 
understanding since initconfig.h is already inside the folder cpython using 
"cpython/initconfig.h" will try to look for another cpython folder inside the 
cpython folder and then look for initconfig thus the error.

--

___
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-05-20 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Oh, that string is used in even more spots (sorry wasn't looking too closely 
the first time).

--

___
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-05-20 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Never mind; I think you're right, and 
https://github.com/python/cpython/blob/master/Objects/call.c#L1009 is the line.

--

___
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-05-20 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I got this:

>>> class A:
...  def f():
...   pass
...
>>> A.f(1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: A.f() takes 0 positional arguments but 1 was given
>>> A.f(**{1:2})
Traceback (most recent call last):
  File "", line 1, in 
TypeError: keywords must be strings

I think this is coming from 
https://github.com/python/cpython/blob/cd8295ff758891f21084a6a5ad3403d35dda38f7/Python/getargs.c#L1636.

--

___
Python tracker 

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



  1   2   >