[issue35279] asyncio uses too many threads by default

2019-05-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I'm ok with changing the default threads number limit.
Not sure about numbers.
If you want to limit to 16-20 that may be ok but `cpu_count + 4` doesn't work 
in this case. On cloud servers, I see 128 or even more cores very often. 160+4 
is not that you want to propose, sure.

I insist on changing the default calculation schema in concurrent.futures, not 
in asyncio. There is no case for asyncio to be exceptional.

--

___
Python tracker 

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



[issue36996] unittest.mock.patch decorator doesn't work with async functions

2019-05-28 Thread miss-islington


miss-islington  added the comment:


New changeset 436c2b0d67da68465e709a96daac7340af3a5238 by Miss Islington (bot) 
(Xtreak) in branch 'master':
bpo-36996: Handle async functions when mock.patch is used as a decorator 
(GH-13562)
https://github.com/python/cpython/commit/436c2b0d67da68465e709a96daac7340af3a5238


--
nosy: +miss-islington

___
Python tracker 

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



[issue36996] unittest.mock.patch decorator doesn't work with async functions

2019-05-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue36933] sys.set_coroutine_wrapper documented as to be removed in 3.8 (still there)

2019-05-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue36933] sys.set_coroutine_wrapper documented as to be removed in 3.8 (still there)

2019-05-28 Thread miss-islington


miss-islington  added the comment:


New changeset 3880f263d2994fb1eba25835dddccb0cf696fdf0 by Miss Islington (bot) 
(Matthias Bussonnier) in branch 'master':
bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) 
(GH-13577)
https://github.com/python/cpython/commit/3880f263d2994fb1eba25835dddccb0cf696fdf0


--
nosy: +miss-islington

___
Python tracker 

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



[issue35279] asyncio uses too many threads by default

2019-05-28 Thread Inada Naoki


Inada Naoki  added the comment:

> If you want to limit to 16-20 that may be ok but `cpu_count + 4` doesn't work 
> in this case. On cloud servers, I see 128 or even more cores very often. 
> 160+4 is not that you want to propose, sure.


I proposed cpu_count + 4 because #24882 almost fixed the problem of large 
maxworks.
If you don't like it, how about min(32, cpu_count+4)?


> I insist on changing the default calculation schema in concurrent.futures, 
> not in asyncio. There is no case for asyncio to be exceptional.

Makes sense.

--

___
Python tracker 

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



[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-28 Thread Windson Yang


New submission from Windson Yang :

> PyBytes_FromStringAndSize(const char *v, Py_ssize_t len): 
> Return a new bytes object with a copy of the string v as value and length len 
> on success, and NULL on failure. If v is NULL, the contents of the bytes 
> object are uninitialized.

The function actually copies `len` bytes from string v instead of the whole 
string. (link 1) I suggested we can change to 

> Return a new bytes object with a copy of the first len bytes of string v as 
> value and length len on success...

> readinto(b)
> Read bytes into a pre-allocated, writable bytes-like object b and return the 
> number of bytes read. For example, b might be a bytearray.

The function will call _bufferediobase_readinto_generic(link 2) which may 
return NULL. Maybe we can change to 

> and return the number of bytes that read succeed (it may be smaller than b or 
> NULL if failed)...

1. https://github.com/python/cpython/blob/master/Objects/bytesobject.c#L126

2. https://github.com/python/cpython/blob/master/Modules/_io/bufferedio.c#L962

--
assignee: docs@python
components: Documentation
messages: 343741
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: clarify functions docs in IO modules and Bytes Objects
type: enhancement
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



[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


Added file: https://bugs.python.org/file48369/bpo-36411.c

___
Python tracker 

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



[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-28 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

I adapted the test code on StackOverflow to show the expected and actual values.

I get this output using Python 2.7.16:


opening myfile with wb
writing 3 bytes to file
('f.tell(): expecting 3, got', 3)
closing myfile
opening myfile with a+b
('f.tell(): expecting 3, got', 3)
writing 3 bytes to file
('f.tell(): expecting 6, got', 6)
('f.seek(0): expecting 0, got', None)
('f.tell(): expecint 0, got', 0)
writing 3 bytes to file
('f.tell(): expecting 9, got', 9)
writing 3 bytes to file
('f.tell(): expecting 12, got', 12)
('f.seek(0, io.SEEK_CUR): expecting 12, got', None)
('f.tell(): expecting 12, got', 12)
('f.seek(0): expecting 0, got', None)
("f.read(): expecting b'abcdefghijkl', got", 'abcdefghijkl')
closing file
removing file


As described, I get different results using Python 3.7.3 as well as the master 
branch (Python 3.8.0a4+):


closing myfile
opening myfile with a+b
f.tell(): expecting 3, got 3
writing 3 bytes to file
f.tell(): expecting 6, got 6
f.seek(0): expecting 0, got 0
f.tell(): expecint 0, got 0
writing 3 bytes to file
f.tell(): expecting 9, got 3
writing 3 bytes to file
f.tell(): expecting 12, got 6
f.seek(0, io.SEEK_CUR): expecting 12, got 12
f.tell(): expecting 12, got 12
f.seek(0): expecting 0, got 0
f.read(): expecting b'abcdefghijkl', got b'abcdefghijkl'
closing file
removing file


I wrote an equivalent C program using the stream I/O functions and get the same 
results as Python 2.7.16:


opening file with wb
writing 3 bytes to file
ftell(f): expecting 3, got 3
closing file
opening file with a+b
ftell(f): expecting 3, got 3
writing 3 bytes to filftell(f): expecting 6, got 6
fseek(f, 0, SEEK_SET): expecting 0, got 0
ftell(f): expecting 0, got 0
writing 3 bytes to file
ftell(f): expecting 9, got 9
writing 3 bytes to file
ftell(f): expecting 12, got 12
fseek(f, 0, SEEK_CUR): expecting 0, got 0
ftell(f): expecting 12, got 12
fseek(f, 0, SEEK_SET): expecting 0, got 0
fread(buf, 1, 256, f): expecting 12, got 12
expecting 'abcdefghijkl', got 'abcdefghijkl'
closing file
removing file


I consider this behavior to be a bug because Python 2.7 and C agree, but Python 
3.7 behaves differently. Requiring that developers know and work around 
non-standard quirky behavior leads to extra work and error-prone code.

--
nosy: +Jeffrey.Kintscher
Added file: https://bugs.python.org/file48368/bpo-36411.py

___
Python tracker 

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



[issue35279] asyncio uses too many threads by default

2019-05-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

> how about min(32, cpu_count+4)?

I think it produces reasonable good numbers for any CPU count.

Do you have time for preparing a pull request?

--

___
Python tracker 

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



[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


Removed file: https://bugs.python.org/file48369/bpo-36411.c

___
Python tracker 

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



[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-28 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

I saw the bug in the C output after I hit submit. Here is the correct output:

opening file with wb
writing 3 bytes to file
ftell(f): expecting 3, got 3
closing file
opening file with a+b
ftell(f): expecting 3, got 3
writing 3 bytes to file
ftell(f): expecting 6, got 6
fseek(f, 0, SEEK_SET): expecting 0, got 0
ftell(f): expecting 0, got 0
writing 3 bytes to file
ftell(f): expecting 9, got 9
writing 3 bytes to file
ftell(f): expecting 12, got 12
fseek(f, 0, SEEK_CUR): expecting 0, got 0
ftell(f): expecting 12, got 12
fseek(f, 0, SEEK_SET): expecting 0, got 0
fread(buf, 1, 256, f): expecting 12, got 12
expecting 'abcdefghijkl', got 'abcdefghijkl'
closing file
removing file

--
Added file: https://bugs.python.org/file48370/bpo-36411.c

___
Python tracker 

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



[issue37074] os.stat() does not work for NUL and CON

2019-05-28 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

>>> os.stat('nul')
Traceback (most recent call last):
  File "", line 1, in 
OSError: [WinError 1] Incorrect function: 'nul'
>>> os.stat('con')
Traceback (most recent call last):
  File "", line 1, in 
OSError: [WinError 87] The parameter is incorrect: 'con'

But os.open() and os.fstat() work.

>>> os.fstat(os.open('nul', os.O_RDONLY))
os.stat_result(st_mode=8192, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, 
st_gid=0, st_size=0, st_atime=0, st_mtime=0, st_ctime=0)
>>> os.fstat(os.open('con', os.O_RDONLY))
os.stat_result(st_mode=8192, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, 
st_gid=0, st_size=0, st_atime=0, st_mtime=0, st_ctime=0)

--
components: Windows
messages: 343745
nosy: paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.stat() does not work for NUL and CON
type: behavior
versions: Python 2.7, 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



[issue37058] Implement PEP 544: add Protocol to typing

2019-05-28 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 74d7f76e2c953fbfdb7ce01b7319d91d471cc5ef by Ivan Levkivskyi in 
branch 'master':
bpo-37058: PEP 544: Add Protocol to typing module (GH-13585)
https://github.com/python/cpython/commit/74d7f76e2c953fbfdb7ce01b7319d91d471cc5ef


--

___
Python tracker 

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



[issue37058] Implement PEP 544: add Protocol to typing

2019-05-28 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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



[issue37005] bz2 module doesn't write end-of-stream marker

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue36988] zipfile: string IndexError on extract

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-05-28 Thread Piotr Karkut


Piotr Karkut  added the comment:

Bump?

--

___
Python tracker 

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



[issue1230540] sys.excepthook doesn't work in threads

2019-05-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If we want to support low-level threads created by start_new_thread() we should 
call excepthook() from t_bootstrap instead of Thread._bootstrap_inner. 
Otherwise implementing excepthook() as a Thread method would be more convenient.

--

___
Python tracker 

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



[issue36976] email: AttributeError

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue36910] Certain Malformed email causes email.parser to throw AttributeError

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue36881] isinstance raises TypeError for metaclass with metaclass=ABCMeta

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-05-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

It looks like this caused bpo-37072: PyAST_FromNodeObject doesn't ignore flags 
any more, and when PyNode_Compile passes NULL flags, it crashes.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue36691] SystemExit & sys.exit : Allow both exit status and message

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue37072] PyNode_Compile() crashes in Python 3.8.

2019-05-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

Looks like this is caused by: 
https://github.com/python/cpython/pull/12086/files#diff-4d35cf8992b795c5e97e9c8b6167cb34R787

PyAST_FromNodeObject doesn't ignore flags any more, so when PyNode_Compile 
passes NULL flags, it crashes.

(This is unfamiliar code for me; I won't have time to fix & test properly this 
week.)

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue36956] Calling "functions" used to implement generators/comps easily cause crash

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue2818] pulldom cannot handle xml file with large external entity properly

2019-05-28 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue36900] Use _PyCoreConfig rather than global configuration variables

2019-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13517
pull_request: https://github.com/python/cpython/pull/13614

___
Python tracker 

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



[issue1230540] Add threading.excepthook() to handle uncaught exceptions raised by Thread.run()

2019-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
title: sys.excepthook doesn't work in threads -> Add threading.excepthook() to 
handle uncaught exceptions raised by Thread.run()

___
Python tracker 

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



[issue37039] IDLE: Improve zoomheight doc and behavior.

2019-05-28 Thread Tal Einat


Tal Einat  added the comment:

I haven't found a way to maximize a hidden window; being "zoomed" and 
"withdrawn" are both considered "states" by Tk, and apparently a window cannot 
be in both states simultaneously.

An alternative is, when zooming the height:

1. save the current window position and size
2. maximize the current window
3. set the horizontal position and width to their original values

There is a visual artifact when doing so - the window is seen to maximize and 
then return to its original width.

--

___
Python tracker 

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



[issue2506] Add mechanism to disable optimizations

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

My PR 13600 works as expected.

I simplified attached continue.py: see attached traceme.py.

Output with optimizations
---
$ ./python traceme.py  
  6   0 LOAD_CONST   1 (0)
  2 STORE_FAST   0 (a)

  7   4 LOAD_GLOBAL  0 (range)
  6 LOAD_CONST   2 (3)
  8 LOAD_CONST   3 (4)
 10 CALL_FUNCTION2
 12 GET_ITER
>>   14 FOR_ITER30 (to 46)
 16 STORE_FAST   1 (n)

  8  18 LOAD_FAST1 (n)
 20 LOAD_CONST   4 (2)
 22 BINARY_MODULO
 24 POP_JUMP_IF_FALSE   14

  9  26 LOAD_FAST1 (n)
 28 LOAD_CONST   2 (3)
 30 BINARY_MODULO
 32 POP_JUMP_IF_FALSE   14

 10  34 LOAD_FAST0 (a)
 36 LOAD_CONST   5 (1)
 38 INPLACE_ADD
 40 STORE_FAST   0 (a)

 11  42 JUMP_ABSOLUTE   14
 44 JUMP_ABSOLUTE   14
>>   46 LOAD_CONST   0 (None)
 48 RETURN_VALUE
 --- modulename: traceme, funcname: func
traceme.py(6): a = 0
traceme.py(7): for n in range(3, 4):
traceme.py(8): if n % 2:
traceme.py(9): if n % 3:
traceme.py(7): for n in range(3, 4):
---

Output without optimizations (-X noopt):
---
$ ./python -X noopt traceme.py  
  6   0 LOAD_CONST   1 (0)
  2 STORE_FAST   0 (a)

  7   4 LOAD_GLOBAL  0 (range)
  6 LOAD_CONST   2 (3)
  8 LOAD_CONST   3 (4)
 10 CALL_FUNCTION2
 12 GET_ITER
>>   14 FOR_ITER30 (to 46)
 16 STORE_FAST   1 (n)

  8  18 LOAD_FAST1 (n)
 20 LOAD_CONST   4 (2)
 22 BINARY_MODULO
 24 POP_JUMP_IF_FALSE   44

  9  26 LOAD_FAST1 (n)
 28 LOAD_CONST   2 (3)
 30 BINARY_MODULO
 32 POP_JUMP_IF_FALSE   42

 10  34 LOAD_FAST0 (a)
 36 LOAD_CONST   5 (1)
 38 INPLACE_ADD
 40 STORE_FAST   0 (a)

 11 >>   42 JUMP_ABSOLUTE   14
>>   44 JUMP_ABSOLUTE   14
>>   46 LOAD_CONST   0 (None)
 48 RETURN_VALUE
 --- modulename: traceme, funcname: func
traceme.py(6): a = 0
traceme.py(7): for n in range(3, 4):
traceme.py(8): if n % 2:
traceme.py(9): if n % 3:
traceme.py(11): continue
traceme.py(7): for n in range(3, 4):
---


The difference on the trace is that using -X noopt, "traceme.py(11):
 continue" line is traced as expected.

The difference on the bytecode is that jumps are no longer optimized using -X 
noopt:

* Optimized:

  "32 POP_JUMP_IF_FALSE   14"

* Not optimized:

  "32 POP_JUMP_IF_FALSE   42"
  ">>   42 JUMP_ABSOLUTE   14"

The peephole optimizer replaces a jump to an unconditional jump with a jump 
directly to the target of the unconditional jump.

I documented peephole optimizations in my reimplementation in pure Python:
https://bytecode.readthedocs.io/en/latest/peephole.html#optimizations
(I'm not sure that it's up to date, but it should give you an idea of which 
kinds of optimizations are implemented.)

--
Added file: https://bugs.python.org/file48371/traceme.py

___
Python tracker 

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



[issue37075] Error message improvement for AsyncMock

2019-05-28 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

* assert_has_awaits has a comma in between the error message string used in 
AssertionError and hence error is raised as a tuple instead of a string.

import asyncio
from unittest.mock import AsyncMock, call

async def main():
a = AsyncMock()
await a(1)
a.assert_has_awaits([call(2)])

asyncio.run(main())

Traceback (most recent call last):
  File "/tmp/foo.py", line 9, in 
asyncio.run(main())
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/runners.py", 
line 43, in run
return loop.run_until_complete(main)
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/base_events.py",
 line 608, in run_until_complete
return future.result()
  File "/tmp/foo.py", line 7, in main
a.assert_has_awaits([call(2)])
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 2164, in assert_has_awaits
raise AssertionError(
AssertionError: ('Awaits not found.\nExpected: [call(2)]\n', 'Actual: 
[call(1)]')

It should be printed as a single string as below :

AssertionError: Awaits not found.
Expected: [call(2)]
Actual: [call(1)]

* assert_awaited_with uses _format_mock_failure_message which has "call" 
hardcoded but most of the error messages in AsyncMock use "await". 
assert_awaited_with error seems little confusing as it's same as 
assert_called_with. This is mostly a consistency nit as in below where call to 
a(2) is made but it's not awaited that should be noted in the message. The fix 
is simple which would be to make the string 'call' as a parameter that defaults 
to 'call' and needs to be passed as 'await' from assert_awaited_with error 
formatting. This would make "expected call not found" as "expected await not 
found" in below program.

import asyncio
from unittest.mock import AsyncMock, call

async def main():
a = AsyncMock()
await a(1)
a(2)
a.assert_awaited_with(2)

asyncio.run(main())

./python.exe /tmp/foo.py
/tmp/foo.py:7: RuntimeWarning: coroutine 'AsyncMockMixin._mock_call' was never 
awaited
  a(2)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
  File "/tmp/foo.py", line 10, in 
asyncio.run(main())
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/runners.py", 
line 43, in run
return loop.run_until_complete(main)
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/base_events.py",
 line 608, in run_until_complete
return future.result()
  File "/tmp/foo.py", line 8, in main
a.assert_awaited_with(2)
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 2118, in assert_awaited_with
raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: mock(2)
Actual: mock(1)

I will raise a PR for the above shortly.

--
components: Library (Lib)
messages: 343753
nosy: asvetlov, lisroach, xtreak
priority: normal
severity: normal
status: open
title: Error message improvement for AsyncMock
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



[issue37075] Error message improvement for AsyncMock

2019-05-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue29883] asyncio: Windows Proactor Event Loop UDP Support

2019-05-28 Thread miss-islington


miss-islington  added the comment:


New changeset bafd4b5ac83b6cc0b7455290a04c4bfad34bdc90 by Miss Islington (bot) 
(Andrew Svetlov) in branch 'master':
bpo-29883: Asyncio proactor udp (GH-13440)
https://github.com/python/cpython/commit/bafd4b5ac83b6cc0b7455290a04c4bfad34bdc90


--
nosy: +miss-islington

___
Python tracker 

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



[issue29883] asyncio: Windows Proactor Event Loop UDP Support

2019-05-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue37074] os.stat() does not work for NUL and CON

2019-05-28 Thread Michele Angrisano


Michele Angrisano  added the comment:

I've tried to reproduce this behavior on my Mac with python3.8 and python 3.7 
but I couldn't.

If 'nul' doesn't exist, it raises a FileNotFound exception as it should do.
If 'nul' exists, it shows me the right output.
Same behavior with 'con'.

--
nosy: +mangrisano

___
Python tracker 

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



[issue37076] _thread.start_new_thread(): call sys.unraisablehook() to handle uncaught exceptions

2019-05-28 Thread STINNER Victor


New submission from STINNER Victor :

Python 3.8 now has 3 hooks for uncaught exceptions:

* sys.excepthook()
* sys.unraisablehook()
* threading.excepthook()

_thread.start_new_thread() calls none of these hooks, but directly logs the 
exception.

I propose to modify it to reuse sys.unraisablehook(): see attached PR.

--

Using threading.excepthook() would be another option, but 
_thread.start_new_thread() is usually wrapped in threading.Thread.run() which 
already uses threading.excepthook(). It might be surprising to see two bugs 
from the same thread using threading.excepthook().

Moreover, right now, _thread is the "low-level" API to access threads: it 
doesn't acces threading. I'm not comfortable by adding an inter-dependency 
between _thread (low-level) and threading (high-level).

If threading.Thread.run() is correctly written, it should not raise an 
exception. In the worst case, threading.excepthook should handle the exception. 
_thread.start_new_thread() should never get an exception raised by threading if 
threading.excepthook does correctly its job.

--
components: Library (Lib)
messages: 343756
nosy: vstinner
priority: normal
severity: normal
status: open
title: _thread.start_new_thread(): call sys.unraisablehook() to handle uncaught 
exceptions
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



[issue37076] _thread.start_new_thread(): call sys.unraisablehook() to handle uncaught exceptions

2019-05-28 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue35279] asyncio uses too many threads by default

2019-05-28 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue37076] _thread.start_new_thread(): call sys.unraisablehook() to handle uncaught exceptions

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

With PR 13617, the function which raised the exception can be retrieved using 
unraisable.object.

If we used threading.excepthook, I don't see how we could pass this function 
into threading.ExceptHookArgs: ExceptHookArgs.thread is expected to be a 
threading.Thread object.

--

___
Python tracker 

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



[issue1230540] Add threading.excepthook() to handle uncaught exceptions raised by Thread.run()

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

> If we want to support low-level threads created by start_new_thread() we 
> should call excepthook() from t_bootstrap instead of Thread._bootstrap_inner. 
> Otherwise implementing excepthook() as a Thread method would be more 
> convenient.

I created bpo-37076: "_thread.start_new_thread(): call sys.unraisablehook() to 
handle uncaught exceptions".

--

___
Python tracker 

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



[issue36900] Use _PyCoreConfig rather than global configuration variables

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9ea277a788eabec102e8fe613b7f1e27995d5918 by Victor Stinner in 
branch 'master':
bpo-36900: Fix compilation on HP-UX (GH-13614)
https://github.com/python/cpython/commit/9ea277a788eabec102e8fe613b7f1e27995d5918


--

___
Python tracker 

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



[issue37076] _thread.start_new_thread(): call sys.unraisablehook() to handle uncaught exceptions

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

This issue is a follow-up of:

* bpo-36829: Add sys.unraisablehook() to custom how "unraisable exceptions" are 
logged
* bpo-1230540: Add threading.excepthook() to handle uncaught exceptions raised 
by Thread.run()


Discussions around _thread.start_new_thead() exception:

Antoine Pitrou:
"""
>From the doc: Handle uncaught :func:``Thread.run`` exception.

What if some C extension wants to report uncaught exceptions in C-created 
threads? Does it have to create a dummy Thread object?

For example, how about threads created by _thread.start_new_thread?
"""

https://github.com/python/cpython/pull/13515#issuecomment-495935350


Serhiy Storchaka:
"If we want to support low-level threads created by start_new_thread() we 
should call [threading.]excepthook() from t_bootstrap instead of 
Thread._bootstrap_inner. Otherwise implementing excepthook() as a Thread method 
would be more convenient."

https://bugs.python.org/issue1230540#msg343748

--

___
Python tracker 

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



[issue37072] PyNode_Compile() crashes in Python 3.8.

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

I mark this issue as a release blocker.

--
nosy: +lukasz.langa, vstinner
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



[issue29883] asyncio: Windows Proactor Event Loop UDP Support

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

I planned to ask you (Adam and Andrew) to merge the PR even if it's not 
finished, just to make sure that UDP support will land into Python 3.8. But 
Andrew finished the PR, yahoo!

Thanks you very much Adam Meily and Andrew Svetlov! Sorry, I planned to do what 
Andrew did: "finish" the PR, but I was just too busy on other things :-(

Well done, I see that you fixed max_size, pause/resume protocol, etc.

asyncio on Windows will be much better experience with IOCP by default, CTRL+c 
support, UDP support, etc.

--

___
Python tracker 

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



[issue29883] asyncio: Windows Proactor Event Loop UDP Support

2019-05-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

You are welcome, Victor!

Thank you very much, Adam!

--

___
Python tracker 

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



[issue36339] test_ttk_guionly: test_traversal() fails randomly on AMD64 Windows8.1 Refleaks 2.7

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

New failure:

https://buildbot.python.org/all/#/builders/33/builds/600

..test test_ttk_guionly failed -- Traceback (most recent call last):
  File 
"D:\buildarea\2.7.ware-win81-release.refleak\build\lib\lib-tk\test\test_ttk\test_widgets.py",
 line 1096, in test_traversal
self.assertEqual(self.nb.select(), str(self.child2))
AssertionError: '.78592616L' != '.78590040L'

test_widget_state (test_ttk.test_widgets.WidgetTest) ... ok

==
FAIL: test_traversal (test_ttk.test_widgets.NotebookTest)
--
Traceback (most recent call last):
  File 
"D:\buildarea\2.7.ware-win81-release.refleak\build\lib\lib-tk\test\test_ttk\test_widgets.py",
 line 1096, in test_traversal
self.assertEqual(self.nb.select(), str(self.child2))
AssertionError: '.78592616L' != '.78590040L'

--

___
Python tracker 

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



[issue36829] Add sys.unraisablehook() to custom how "unraisable exceptions" are logged

2019-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13521
pull_request: https://github.com/python/cpython/pull/13620

___
Python tracker 

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



[issue37077] Threading: add builtin TID attribute to Thread objects for AIX

2019-05-28 Thread Michael Felt


New submission from Michael Felt :

As issue36084 is already closed - opening a new issue for the PR to add this 
support for AIX.

--
messages: 343765
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: Threading: add builtin TID attribute to Thread objects for AIX
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



[issue36305] Inconsistent behavior of pathlib.WindowsPath with drive paths

2019-05-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35279] asyncio uses too many threads by default

2019-05-28 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 9a7e5b1b42abcedb895b1ce49d83fe067d01835c by Inada Naoki in branch 
'master':
bpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618)
https://github.com/python/cpython/commit/9a7e5b1b42abcedb895b1ce49d83fe067d01835c


--

___
Python tracker 

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



[issue35279] asyncio uses too many threads by default

2019-05-28 Thread Inada Naoki


Change by Inada Naoki :


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



[issue21131] test_faulthandler.test_register_chain fails on 64bit ppc/arm with kernel >= 3.10

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

+pthread_attr_t attrs;
+pthread_attr_init(&attrs);
+(void)pthread_attr_getstacksize(&attrs, &stack.ss_size);

PyThread_start_new_thread() of thread_pthread.h already contains logic to get a 
"good" stack size. I would prefer to reuse this code.

See also _pythread_nt_set_stacksize() of thread_nt.h.

Maybe we need a private function to get the default stack size?

See also PyThread_get_stacksize() and _thread.stack_size().

--

___
Python tracker 

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



[issue37078] norton login

2019-05-28 Thread suraj


New submission from suraj :

Norton Login - Manage Your Norton Subscription, Setup Norton, Norton Sign in 
etc at Norton.com/setup and Manage Norton Services using Norton Account Here!

http://getnortonlogin.com/";>norton login

--
files: Untitled design.png
messages: 343768
nosy: norton
priority: normal
severity: normal
status: open
title: norton login
Added file: https://bugs.python.org/file48372/Untitled design.png

___
Python tracker 

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



[issue21131] test_faulthandler.test_register_chain fails on 64bit ppc/arm with kernel >= 3.10

2019-05-28 Thread Peter Edwards


Peter Edwards  added the comment:

Ok - let me submit a pull request with your suggestions

On Tue, 28 May 2019 at 13:08, STINNER Victor  wrote:

>
> STINNER Victor  added the comment:
>
> +pthread_attr_t attrs;
> +pthread_attr_init(&attrs);
> +(void)pthread_attr_getstacksize(&attrs, &stack.ss_size);
>
> PyThread_start_new_thread() of thread_pthread.h already contains logic to
> get a "good" stack size. I would prefer to reuse this code.
>
> See also _pythread_nt_set_stacksize() of thread_nt.h.
>
> Maybe we need a private function to get the default stack size?
>
> See also PyThread_get_stacksize() and _thread.stack_size().
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue36922] Implement Py_TPFLAGS_METHOD_DESCRIPTOR

2019-05-28 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset eb65e2443ac21739baf6d373abc7b4638b9d6927 by Petr Viktorin (Jeroen 
Demeyer) in branch 'master':
bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)
https://github.com/python/cpython/commit/eb65e2443ac21739baf6d373abc7b4638b9d6927


--

___
Python tracker 

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



[issue36922] Implement Py_TPFLAGS_METHOD_DESCRIPTOR

2019-05-28 Thread Petr Viktorin


Change by Petr Viktorin :


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



[issue34626] PEP 384's PyType_Spec and PyType_Slot are not documented

2019-05-28 Thread Petr Viktorin


Change by Petr Viktorin :


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



[issue35246] asyncio.create_subprocess_exec doesn't accept pathlib.Path like subprocess does

2019-05-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Aha, I see. You are right.
Let's drop checks for cmd/program/args types but left to subprocess do these 
checks.
This approach avoiding complex checking/converting logic in asyncio itself and 
reduces code duplication.

--

___
Python tracker 

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



[issue37078] spam

2019-05-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
stage:  -> resolved
status: open -> closed
title: norton login -> spam

___
Python tracker 

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



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

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

As soon as the "fork" start method "just works" on Linux, I'm not sure why you 
want to use "spawn" by default on Linux.

I don't buy the "consistency" argument here. I'm not surprised that such "low 
level" module like multiprocessing behaves differently depending on the 
platform to get the "native" and most efficient way to spawn subprocesses.

In general, fork is bad, but it's also convenient and people rely on it to 
prepare data in a main process and then "duplicate" the process to inherit 
cooked data.

If someone wants to more away from fork by default, I would suggest to *first* 
enhance multiprocessing documentation to list issues caused by fork(), and 
maybe also described when fork is safe (never doesn't sound like a good answer, 
since so far, I'm not aware of tons of bug reports on Linux caused by fork :-)).

--

___
Python tracker 

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



[issue32299] unittest.mock.patch.dict.__enter__ should return the dict

2019-05-28 Thread Cheryl Sabella


Cheryl Sabella  added the comment:


New changeset 04530812e90e45a37ed84e83505d63db7edc1262 by Cheryl Sabella (Mario 
Corchero) in branch 'master':
bpo-32299: Return patched dict when using patch.dict as a context manager 
(GH-11062)
https://github.com/python/cpython/commit/04530812e90e45a37ed84e83505d63db7edc1262


--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 05f16416d99dc9fc76fef11e56f16593e7a5955e by Victor Stinner 
(Zackery Spytz) in branch 'master':
bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)
https://github.com/python/cpython/commit/05f16416d99dc9fc76fef11e56f16593e7a5955e


--

___
Python tracker 

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



[issue34364] problem with traceback for syntax error in f-string

2019-05-28 Thread Denis S. Otkidach


Change by Denis S. Otkidach :


--
nosy: +ods

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13522
pull_request: https://github.com/python/cpython/pull/13622

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.7, Python 3.8 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue32299] unittest.mock.patch.dict.__enter__ should return the dict

2019-05-28 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@Allen Li, thank you for the report.  And thank you, @Vadim Tsander for the 
original pull request and @mariocj89 for reviving this.  Also, thank you 
@eric.araujo for the review and approval.  This has been merged!

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



[issue36686] Docs: asyncio.loop.subprocess_exec documentation is confusing, it's not clear how to inherit stdin, stdout or stderr in the subprocess

2019-05-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.9

___
Python tracker 

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



[issue37078] spam

2019-05-28 Thread SilentGhost


Change by SilentGhost :


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

___
Python tracker 

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



[issue37078] spam

2019-05-28 Thread SilentGhost


Change by SilentGhost :


--
nosy:  -norton

___
Python tracker 

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



[issue37078] spam

2019-05-28 Thread SilentGhost


Change by SilentGhost :


Removed file: https://bugs.python.org/file48372/Untitled design.png

___
Python tracker 

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



[issue36709] Asyncio SSL keep-alive connections raise errors after loop close.

2019-05-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

>From my understanding, the correct code should close all transports and wait 
>for their connection_lost() callbacks before closing the loop.

--

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread miss-islington


miss-islington  added the comment:


New changeset e7ddf586ae5b7a3b975103b09c8202226d77f421 by Miss Islington (bot) 
in branch '3.7':
bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)
https://github.com/python/cpython/commit/e7ddf586ae5b7a3b975103b09c8202226d77f421


--
nosy: +miss-islington

___
Python tracker 

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



[issue37077] Threading: add builtin TID attribute to Thread objects for AIX

2019-05-28 Thread Michael Felt


Change by Michael Felt :


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

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13524
pull_request: https://github.com/python/cpython/pull/13625

___
Python tracker 

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



[issue36829] Add sys.unraisablehook() to custom how "unraisable exceptions" are logged

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a85a1d337d26a65036e427341d15e3979f7e9ced by Victor Stinner in 
branch 'master':
bpo-36829: sys.excepthook and sys.unraisablehook flush (GH-13620)
https://github.com/python/cpython/commit/a85a1d337d26a65036e427341d15e3979f7e9ced


--

___
Python tracker 

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



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

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 17a5588740b3d126d546ad1a13bdac4e028e6d50 by Victor Stinner in 
branch 'master':
bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603)
https://github.com/python/cpython/commit/17a5588740b3d126d546ad1a13bdac4e028e6d50


--

___
Python tracker 

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



[issue36709] Asyncio SSL keep-alive connections raise errors after loop close.

2019-05-28 Thread Tom Christie


Tom Christie  added the comment:

> From my understanding, the correct code should close all transports and wait 
> for their connection_lost() callbacks before closing the loop.

Ideally, yes, although we should be able to expect that an SSL connection that 
hasn't been gracefully closed wouldn't loudly error on teardown like that.

In standard sync code, the equivelent would running something like this...

```python
session = requests.Session()
session.get('https://example.com/')
```

We wouldn't expect a traceback to be raised on exiting. (Even though the user 
*hasn't* explicitly closed the session, and even though a keep alive SSL 
connection will be open at the point of exit.)

--

___
Python tracker 

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



[issue37074] os.stat() does not work for NUL and CON

2019-05-28 Thread Eryk Sun


Eryk Sun  added the comment:

Opening "CON" (i.e. r"\\.\CON") fails with ERROR_INVALID_PARAMETER (87) because 
it has to be opened with either GENERIC_READ or GENERIC_WRITE data access in 
order to map it to either the console input buffer or active screen buffer. The 
CreateFileW call in stat() necessarily requests no data access.

Calling stat on "NUL" (among others such as "CONIN$", "//./C:", and 
"//./PhysicalDrive0") fails with ERROR_INVALID_FUNCTION (1) -- or possibly 
ERROR_INVALID_PARAMETER or ERROR_NOT_SUPPORTED (50), depending on the device. 
stat() calls GetFileInformationByHandle. This requests FileFsVolumeInformation 
and FileAllInformation, which commonly fail as unsupported or invalid requests 
for devices other than filesystem devices. Even volume and raw disk devices 
fail a FileAllInformation request. 

If we have a valid file handle, we can get the file type via 
GetFileType(hFile), as _Py_fstat_noraise does in Python/fileutils.c. If opening 
a handle fails with ERROR_INVALID_PARAMETER for a path that resolves to 
r"\\.\CON" or r"\\?\CON" via GetFullPathNameW, we can simply set st_mode to 
_S_IFCHR and return.

For example:

if (hFile == INVALID_HANDLE_VALUE) {
DWORD lastError = GetLastError();
if (lastError == ERROR_INVALID_PARAMETER) {
WCHAR fullPath[8];
if (GetFullPathNameW(path, sizeof(fullPath),
fullPath, NULL) == 7 && (
_wcsicmp(fullPath, L".\\CON") == 0 ||
_wcsicmp(fullPath, L"?\\CON") == 0)) {
memset(result, 0, sizeof(*result));
result->st_mode = _S_IFCHR;
return 0;
}
}
/*
Existing error handling code.
*/
} else {
DWORD type = GetFileType(hFile);
if (type != FILE_TYPE_DISK) {
CloseHandle(hFile);
if (type == FILE_TYPE_UNKNOWN && GetLastError() != 0) {
return -1;
}
memset(result, 0, sizeof(*result));
if (type == FILE_TYPE_CHAR) { /* e.g. "//./NUL" */
result->st_mode = _S_IFCHR;
} else if (type == FILE_TYPE_PIPE) { /* e.g. "//./PIPE/Spam" */
result->st_mode = _S_IFIFO;
}
return 0;
} else if (!GetFileInformationByHandle(hFile, &info)) {
DWORD lastError = GetLastError();
CloseHandle(hFile);
/* e.g. "//./C:" or "//./PhysicalDrive0" */
if (lastError == ERROR_INVALID_FUNCTION ||
lastError == ERROR_INVALID_PARAMETER ||
lastError == ERROR_NOT_SUPPORTED) {
memset(result, 0, sizeof(*result));
result->st_mode = _S_IFREG;
return 0;
}
return -1;
}
}

--
nosy: +eryksun

___
Python tracker 

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



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

2019-05-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +13525
pull_request: https://github.com/python/cpython/pull/13626

___
Python tracker 

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



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

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, I pushed a minimum fix to make sure that it lands in Python 3.8 beta1. 
Please check if the documentation if properly updated :-)

We will still have time after beta1 to revisit the question of making spawn the 
default on more/all platforms.

I wrote PR 13626 to change also Python 3.7. Once this one will be merged, I 
will also write a PR for Python 2.7.

--

___
Python tracker 

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



[issue37079] PEM cadata causes ssl.SSLError: nested ans1 error

2019-05-28 Thread Jizhou Yang


Change by Jizhou Yang :


--
assignee: christian.heimes
components: SSL
nosy: Jizhou Yang, christian.heimes
priority: normal
severity: normal
status: open
title: PEM cadata causes ssl.SSLError: nested ans1 error
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue37074] os.stat() does not work for NUL and CON

2019-05-28 Thread Eryk Sun


Eryk Sun  added the comment:

> GetFullPathNameW(path, sizeof(fullPath),

That should be sizeof(fullPath) / sizeof(WCHAR), or use Py_ARRAY_LENGTH, or 
just hard code 8. That's probably not the only mistake. But this is just an 
example to discuss the details and alternatives.

--

___
Python tracker 

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



[issue36305] Inconsistent behavior of pathlib.WindowsPath with drive paths

2019-05-28 Thread Maor Kleinberger


Maor Kleinberger  added the comment:

> Is this related to the weird paths I am seeing when getting different output 
> in venv compared to without venv

This is probably not related, sounds like something caused by the venv 
implementation.

On a different note, how do I get my PR reviewed? 
(https://github.com/python/cpython/pull/12361)

--

___
Python tracker 

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



[issue37079] PEM cadata causes ssl.SSLError: nested asn1 error

2019-05-28 Thread Jizhou Yang


New submission from Jizhou Yang :

Loading cadata in PEM format results in a nested asn1 error. Workaround is to 
convert cadata to unicode.

Minimum code for reproducing the issue:
>>>import ssl
>>> with open('ca.crt') as f:
... ca_crt = f.read()
...
>>> c = ssl.create_default_context()
>>> c.load_verify_locations(cadata=ca_crt)
Traceback (most recent call last):
  File "", line 1, in 
ssl.SSLError: nested asn1 error (_ssl.c:2902)

With workaround to make it work:
>>>import ssl
>>> with open('ca.crt') as f:
... ca_crt = f.read()
...
>>> c = ssl.create_default_context()
>>> c.load_verify_locations(cadata=unicode(ca_crt))

The issue is annoying as the documentation explicitly states cadata to be 
"either an ASCII string of one or more PEM-encoded certificates...". 
Furthermore the unicode function is not present in Python 3.x, making the 
workaround version-dependent.

--
title: PEM cadata causes ssl.SSLError: nested ans1 error -> PEM cadata causes 
ssl.SSLError: nested asn1 error
Added file: https://bugs.python.org/file48373/ca.crt

___
Python tracker 

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



[issue35975] Put back the ability to parse files where async/await aren't keywords

2019-05-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sorry for the oversight. Do you need help fixing that?

--

___
Python tracker 

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



[issue37079] PEM cadata causes ssl.SSLError: nested asn1 error

2019-05-28 Thread Christian Heimes


Christian Heimes  added the comment:

The documentation refers to ASCII string as Python 3-style ASCII text object. 
In Python 2, that's the unicode data type. The feature was backported from 
Python 3. I guess the documentation was directly taken from Python 3's 
documentation and not updated to reflect Python 2's quirky str type.

You can use the io module to get the proper text type on Python 2 and 3.

import io
with io.open('ca.crt') as f:
ca_crt = f.read()

--
resolution:  -> not a bug
status: open -> pending
type: crash -> behavior

___
Python tracker 

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



[issue36933] sys.set_coroutine_wrapper documented as to be removed in 3.8 (still there)

2019-05-28 Thread Matthias Bussonnier


Change by Matthias Bussonnier :


--
pull_requests: +13526
pull_request: https://github.com/python/cpython/pull/13627

___
Python tracker 

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



[issue37076] _thread.start_new_thread(): call sys.unraisablehook() to handle uncaught exceptions

2019-05-28 Thread Christoph Reiter


Christoph Reiter  added the comment:

> _thread.start_new_thread() calls none of these hooks, but directly logs the 
> exception.

It calls sys.excepthook() currently:

import _thread
import threading
import sys

done = False
def hook(*args):
global done
print(threading.current_thread())
done = True
sys.excepthook = hook

def worker():
raise Exception
_thread.start_new_thread(worker, tuple())
while not done:
pass

--
nosy: +lazka

___
Python tracker 

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



[issue33407] Implement Py_DEPRECATED() macro for Visual Studio

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3c8724fc60163f4f3c3b0d531c84cc7b36783f82 by Victor Stinner 
(Zackery Spytz) in branch 'master':
bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)
https://github.com/python/cpython/commit/3c8724fc60163f4f3c3b0d531c84cc7b36783f82


--

___
Python tracker 

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



[issue33407] Implement Py_DEPRECATED() macro for Visual Studio

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Zackery Spytz for the fix!

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



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

bpo-33407 added MSVC support for Py_DEPRECATED().

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 80dfe990162e7a2dd99524829beecd449a973e9e by Victor Stinner in 
branch '2.7':
bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606) (GH-13625)
https://github.com/python/cpython/commit/80dfe990162e7a2dd99524829beecd449a973e9e


--

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Zackery Spytz for the fix. It's now applied to 2.7, 3.7 and master 
branches.

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



[issue35246] asyncio.create_subprocess_exec doesn't accept pathlib.Path like subprocess does

2019-05-28 Thread lilydjwg


Change by lilydjwg :


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

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread STINNER Victor


STINNER Victor  added the comment:

Oh. The test fails on Python 2.7 on Windows:

https://buildbot.python.org/all/#/builders/26/builds/287

ERROR: test_wrap_lenfunc_bad_cast (test.test_descr.OperatorsTest)
--
Traceback (most recent call last):
  File 
"C:\buildbot.python.org\2.7.kloth-win64vs9\build\lib\test\test_descr.py", line 
407, in test_wrap_lenfunc_bad_cast
self.assertEqual(xrange(sys.maxsize).__len__(), sys.maxsize)
OverflowError: Python int too large to convert to C long

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



[issue37080] Cannot compile Python3.7.3 on Alt-F (ARM)

2019-05-28 Thread Jarl Gullberg


New submission from Jarl Gullberg :

I am currently trying to compile the latest stable release of Python (3.7.3 at 
the time of writing) on a small ARM device (a DNS-323A1 NAS), running Alt-F (a 
custom linux-based firmware) using GCC 4.3.3. Unfortunately, I've hit a major 
snag that I just can't seem to get past.

In short, the compilation goes well until the [sharedmods] stage, where it 
encounters an error related to readline and the module not having been compiled 
with -fPIC. I've included a truncated log (taken from a second make invocation 
after the first failed) that displays the issue.

This is the ./configure invocation I've used:
'--prefix=/usr' '--enable-shared' '--with-system-expat' '--with-system-ffi' 
'--with-ensurepip=yes' '--enable-optimizations' '--enable-ipv6' 'CFLAGS=-fPIC' 
'CXXFLAGS=-fPIC'

Any assistance would be much appreciated.

--
components: Build
files: make.log
messages: 343796
nosy: Jarl Gullberg
priority: normal
severity: normal
status: open
title: Cannot compile Python3.7.3 on Alt-F (ARM)
type: compile error
versions: Python 3.7
Added file: https://bugs.python.org/file48374/make.log

___
Python tracker 

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



[issue37081] Test with OpenSSL 1.1.1c

2019-05-28 Thread Christian Heimes


New submission from Christian Heimes :

OpenSSL 1.1.1c is out, 
https://github.com/openssl/openssl/blob/OpenSSL_1_1_1c/CHANGES

--
assignee: christian.heimes
components: SSL, Tests
messages: 343797
nosy: christian.heimes
priority: high
severity: normal
status: open
title: Test with OpenSSL 1.1.1c
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2019-05-28 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue35621] asyncio.create_subprocess_exec() only works with main event loop

2019-05-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



  1   2   >