[issue31954] Don't prevent dict optimization by coupling with OrderedDict

2019-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

There are some more aggressive ideas.

When Eric created C version of OrderedDict, he intended to use it
for PEP 468.  Unlike pure Python implementation, PyDict_GetItem
returns value, not node of linked list.

But now, PEP 468 is implemented in regular dict.
How about raising DeprecationWarning when OrderedDict is passed to
PyDict_* APIs?

LRU implementation of functools is much more efficient than OrderedDict.
OrderedDict can be achieve same performance and efficiency when
node of linked list is stored in underlaying dict.

--
nosy: +eric.snow

___
Python tracker 

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



[issue36626] asyncio run_forever blocks indefinitely

2019-04-13 Thread Dan Timofte


New submission from Dan Timofte :

after starting run_forever if all scheduled tasks are consumed run_once will 
issue a KqueueSelector.select(None) which will block indefinitely :
https://www.freebsd.org/cgi/man.cgi?query=select=2=0=FreeBSD+12.0-RELEASE+and+Ports#DESCRIPTION

after this new tasks are not being processed, trying to stop event loop with 
stop() is not working.

this blocks immediatly : 
import asyncio
import sys
import signal


def cb_signal_handler(signum, frame):
asyncio.get_event_loop().stop()


def main():
signal.signal(signal.SIGINT, cb_signal_handler)

# asyncio.get_event_loop().create_task(asyncio.sleep(1))
asyncio.get_event_loop().run_forever()

main()

With asyncio.sleep uncomment it will block after 4 cycles.

--
components: asyncio, macOS
messages: 340182
nosy: asvetlov, dantimofte, ned.deily, ronaldoussoren, yselivanov
priority: normal
severity: normal
status: open
title: asyncio run_forever blocks indefinitely
versions: Python 3.7

___
Python tracker 

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



[issue36622] Inconsistent exponent notation formatting

2019-04-13 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems this has tests at 
https://github.com/python/cpython/blob/830b43d03cc47a27a22a50d777f23c8e60820867/Lib/test/test_decimal.py#L941
 . I also noticed the below. Considering this is the behavior from 2.7 is it a 
conscious design decision?

>>> '{:.5e}'.format(1.23457e+8)
'1.23457e+08'
>>> '{:.5e}'.format(decimal.Decimal(1.23457e+8))
'1.23457e+8'

--
nosy: +xtreak

___
Python tracker 

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



[issue22102] Zipfile generates Zipfile error in zip with 0 total number of disk in Zip64 end of central directory locator

2019-04-13 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +alanmcintyre, serhiy.storchaka, twouters
versions:  -Python 2.7, 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



[issue1402289] Allow mappings as globals (was: Fix dictionary subclass ...)

2019-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

13 years past from this proposed.  Is this still good feature for Python?

Personally, I dislike adding more dynamic flexibility to Python name space.

Python is very dynamic language, and it made difficult to make Python faster.
For example, PHP is not so dynamic as Python, and it is one of reasons why PHP 
VM is now much faster than Python VM.  They can easily do more optimization 
like function inlining statically.

I'm interested in optimizing Python.  But I'm not interested in adding more 
"slow path" we need to maintain forever.

--

___
Python tracker 

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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2019-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

Now PyGC_Head is 16byte on 64bit platform.
Maybe, should we just change obmalloc in Python 3.8?

How about 32bit platforms?
What can we do for Python 3.7 and 2.7?

--

___
Python tracker 

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



[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 7723d0545c3369e1b2601b207c250c70ce90b75e by Pablo Galindo in 
branch '3.7':
[3.7] bpo-36427: Document that PyEval_RestoreThread and PyGILState_Ensure can 
terminate the calling thread (GH-12541) (GH-12820)
https://github.com/python/cpython/commit/7723d0545c3369e1b2601b207c250c70ce90b75e


--

___
Python tracker 

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



[issue36593] isinstance check fails for Mock objects with spec executed under tracing function

2019-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks @xtreak for the analysis and the quick 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



[issue35967] Better platform.processor support

2019-04-13 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
pull_requests: +12749

___
Python tracker 

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



[issue35967] Better platform.processor support

2019-04-13 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

> I don't quite follow: since you are the author of the tool, you can of
course have your uname.py import platform and then apply one of the
above tricks.

I thought I'd tried that, but failed 
[ref](https://github.com/jaraco/cmdix/issues/1#issuecomment-462207845), which 
is why I committed [this 
change](https://github.com/jaraco/cmdix/commit/c53908b4b39771eed9f64fff5bed8af51baae4d0).

The problem is that, if `pkg_resources` is used to implement the entry point 
for the `uname` console script, or if any other library happens to call 
platform.*, such as in site.py, before the patch has been allowed to run, the 
invocation of `uname` itself ends up invoking `uname`, causing unlimited 
recursion. No amount of patching in the `uname` command implementation can help 
that.

> Your PR is missing tests, though, to support that it actually
returns the same values are before for a set of common platforms.

Yes, that sounds like a good plan. I'll add some tests that assert the values 
and then update the tests to match the current output, establish a baseline.

--

___
Python tracker 

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



[issue17267] datetime.time support for '+' and '-'

2019-04-13 Thread Martin Panter

Martin Panter  added the comment:

A real use case that I have had was with a protocol to activate a device with a 
daily schedule. The protocol takes start and end hours and minutes of the day. 
To test the device by activating it over the next few minutes, my ideal way 
would have taken the current time (according to the device controller) as a 
“time” object, and added a couple of minutes using “timedelta”. In the end I 
think I made my protocol API accept both “time” and “timedelta" objects, 
because I found “timedelta” more flexible for calculations, but the “time” 
class more natural in other cases.

The start and end times are local times, and daylight saving could come into 
play, but in reality I won’t be testing the device at 3 a.m. on a Sunday 
morning. If I did care, I would have to add my own logic with knowledge of the 
date and daylight saving, to raise an exception.

I agree with Alexander about supporting the difference between two “time” 
instances. The result should be a non-negative “timedelta”, at least zero, and 
strictly less than 24 h.

--
nosy: +martin.panter

___
Python tracker 

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



[issue24417] Type-specific documentation for __format__ methods

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue1402289] Allow mappings as globals (was: Fix dictionary subclass ...)

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
keywords:  -after moratorium
nosy: +inada.naoki
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue36625] Obsolete comments in docstrings in fractions module

2019-04-13 Thread Jakub Moliński

Change by Jakub Moliński :


--
keywords: +patch
pull_requests: +12747
stage:  -> patch review

___
Python tracker 

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



[issue36625] Obsolete comments in docstrings in fractions module

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue36625] Obsolete comments in docstrings in fractions module

2019-04-13 Thread Jakub Moliński

New submission from Jakub Moliński :

3 docstrings in fractions.Fraction contain comments referring to python 3.0. 

def __floor__(a):
"""Will be math.floor(a) in 3.0."""

def __ceil__(a):
"""Will be math.ceil(a) in 3.0."""

def __round__(self, ndigits=None):
"""Will be round(self, ndigits) in 3.0.

Rounds half toward even.
"""


To make it consistent with other docstrings in the module these should be 
changed to """math.floor(a)""", """math.ceil(a)""", and 
"""round(self, ndigits)

Rounds half toward even.
"""

--
assignee: docs@python
components: Documentation
messages: 340174
nosy: docs@python, jakub.molinski
priority: normal
severity: normal
status: open
title: Obsolete comments in docstrings in fractions module
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



[issue30519] [threading] Add daemon argument to Timer

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
title: Add daemon argument to Timer -> [threading] Add daemon argument to Timer

___
Python tracker 

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



[issue30519] Add daemon argument to Timer

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +pitrou
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue34850] Emit a syntax warning for "is" with a literal

2019-04-13 Thread Anthony Sottile


Anthony Sottile  added the comment:

Should this also produce warnings for `list` / `dict` / `set` literals?

```
$ python3.8
Python 3.8.0a3 (default, Mar 27 2019, 03:46:44) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x is []
False
>>> x is {}
False
>>> x is {1, 2}
False
```

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue36593] isinstance check fails for Mock objects with spec executed under tracing function

2019-04-13 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

An interesting thing is that there is GCC in CI that runs under coverage which 
also passed since this requires a Python tracing function before importing mock 
to trigger this as in the original report. Adding a simple tracer at the top of 
testmock.py file does cause an instance check failure without patch and passes 
with the merged patch.

$ ./python.exe Lib/unittest/test/testmock/testmock.py
...F.s..F...
==
FAIL: test_class_assignable (__main__.MockTest)
--
Traceback (most recent call last):
  File "Lib/unittest/test/testmock/testmock.py", line 1828, in 
test_class_assignable
self.assertIsInstance(mock, int)
AssertionError:  is not an instance of 

==
FAIL: test_spec_class (__main__.MockTest)
--
Traceback (most recent call last):
  File "Lib/unittest/test/testmock/testmock.py", line 775, in test_spec_class
self.assertIsInstance(mock, X)
AssertionError:  is not an instance of .X'>

--
Ran 112 tests in 3.834s

FAILED (failures=2, skipped=1)

--

___
Python tracker 

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



[issue36593] isinstance check fails for Mock objects with spec executed under tracing function

2019-04-13 Thread miss-islington


miss-islington  added the comment:


New changeset f3a9d722d77753f5110e35f46bd61732c0cb81c1 by Miss Islington (bot) 
in branch '3.7':
bpo-36593: Fix isinstance check for Mock objects with spec executed under 
tracing (GH-12790)
https://github.com/python/cpython/commit/f3a9d722d77753f5110e35f46bd61732c0cb81c1


--
nosy: +miss-islington

___
Python tracker 

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



[issue36593] isinstance check fails for Mock objects with spec executed under tracing function

2019-04-13 Thread miss-islington


Change by miss-islington :


--
keywords: +patch
pull_requests: +12746

___
Python tracker 

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



[issue36593] isinstance check fails for Mock objects with spec executed under tracing function

2019-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 830b43d03cc47a27a22a50d777f23c8e60820867 by Pablo Galindo 
(Xtreak) in branch 'master':
bpo-36593: Fix isinstance check for Mock objects with spec executed under 
tracing (GH-12790)
https://github.com/python/cpython/commit/830b43d03cc47a27a22a50d777f23c8e60820867


--

___
Python tracker 

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



[issue23768] assert on getting the representation of a thread in atexit function

2019-04-13 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
resolution:  -> out of date
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



[issue22991] test_gdb leaves the terminal in raw mode with gdb 7.8.1

2019-04-13 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
resolution:  -> out of date
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



[issue36608] Replace bundled pip and setuptools with a downloader in the ensurepip module

2019-04-13 Thread Pradyun Gedam


Pradyun Gedam  added the comment:

(Not sure how the Roundup handles email replies but I'm hoping this goes to
the right place)

I think it would be better if the downloading got invoked during the
interpreter build process -- to download the wheels and add them to the
final distribution. This lets us remove the wheels from the source
tree/version control and prevents needing to change the PEP for this change.

Functionally, I imagine having all the download logic in some sort of
ensurepip._bootstrap which has all the download logic and that getting
invoked in the build process. `python -m ensurepip` not hitting the
internet is a good invariant to keep.

On Fri, 12 Apr 2019 at 8:54 PM, Eric V. Smith 
wrote:

>
> Eric V. Smith  added the comment:
>
> And I don't mean to sound like a total downer. I just think it's important
> that we recognize all of the use cases.
>
> Thanks for your work on this.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue16079] list duplicate test names with patchcheck

2019-04-13 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

Upgrading the script to account for Python changes. This is now 
duplicate_code_names_3.py

$ ./python ./duplicate_code_names_3.py --ignore ignored_duplicates Lib/test
Duplicate method names:
Lib/test/test_dataclasses.py:1406 TestCase.test_helper_asdict_builtin_containers
Lib/test/test_dataclasses.py:1579 
TestCase.test_helper_astuple_builtin_containers
Lib/test/test_dataclasses.py:700 TestCase.test_not_tuple
Lib/test/test_dataclasses.py:3245 TestReplace.test_recursive_repr_two_attrs
Lib/test/test_genericclass.py:161 TestClassGetitem.test_class_getitem
Lib/test/test_gzip.py:764 TestCommandLine.test_compress_infile_outfile
Lib/test/test_heapq.py:376 TestErrorHandling.test_get_only
Lib/test/test_importlib/test_util.py:755 
PEP3147Tests.test_source_from_cache_path_like_arg
Lib/test/test_logging.py:328 BuiltinLevelsTest.test_regression_29220
Lib/test/test_sys_setprofile.py:363 
ProfileSimulatorTestCase.test_unbound_method_invalid_args
Lib/test/test_sys_setprofile.py:354 
ProfileSimulatorTestCase.test_unbound_method_no_args
Lib/test/test_utf8_mode.py:198 UTF8ModeTests.test_io_encoding

False positives have been removed from the output of the above command and so, 
all the above methods are effectively duplicates that must be fixed.

--
Added file: https://bugs.python.org/file48265/duplicate_code_names_3.py

___
Python tracker 

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



[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +12745

___
Python tracker 

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



[issue36585] test_posix.py fails due to unsupported RWF_HIPRI

2019-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue36427] Document that PyEval_RestoreThread and PyGILState_Ensure can terminate the calling thread

2019-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset fde9b33dfeedd4a4ed723b12d2330979dc684760 by Pablo Galindo in 
branch 'master':
bpo-36427: Document that PyEval_RestoreThread and PyGILState_Ensure can 
terminate the calling thread (GH-12541)
https://github.com/python/cpython/commit/fde9b33dfeedd4a4ed723b12d2330979dc684760


--

___
Python tracker 

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



[issue36585] test_posix.py fails due to unsupported RWF_HIPRI

2019-04-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12744

___
Python tracker 

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



[issue36623] Clean unused parser headers

2019-04-13 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue36623] Clean unused parser headers

2019-04-13 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset f2cf1e3e2892a6326949c2570f1bb6d6c95715fb by Pablo Galindo in 
branch 'master':
bpo-36623: Clean parser headers and include files (GH-12253)
https://github.com/python/cpython/commit/f2cf1e3e2892a6326949c2570f1bb6d6c95715fb


--

___
Python tracker 

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



[issue17013] Allow waiting on a mock

2019-04-13 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
keywords: +patch
pull_requests: +12743
stage: needs patch -> patch review

___
Python tracker 

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



[issue16254] Make PyUnicode_AsWideCharString() increase temporary

2019-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

fixed by #30863

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue17013] Allow waiting on a mock

2019-04-13 Thread Mario Corchero

Mario Corchero  added the comment:

Kooning great! I would Add a test for the following (I think both fails with 
the proposed impl):

- The mock is called BEFORE calling wait_until_called_with
- I call the mock with arguments and then I call wait for call without 
arguments.
- using keyword arguments 

Also, I don’t have a great solution for it but it might be worth prefixing 
time-out with something in the wait_untill_called_with. In situations where the 
mocked object has a timeout parameter (which is a common argument for 
multithreaded apps).

--

___
Python tracker 

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



[issue22102] Zipfile generates Zipfile error in zip with 0 total number of disk in Zip64 end of central directory locator

2019-04-13 Thread Ramsey Kant


Ramsey Kant  added the comment:

I would second this PR.  The Win32 API that creates ZIP64 files produces ZIP64 
files with the "diskno" as 0 and "disks" as 0 (instead of "1" as indicated by 
the spec).

--
nosy: +Ramsey Kant
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



[issue21110] Slowdown and high memory usage when adding a new module in embedded Python 3.4 on 64bit Windows

2019-04-13 Thread MrValdez


MrValdez  added the comment:

Its a shame the link is now gone. Its also been a long time that I don't 
remember all the details.

I still have my code from back when I found this bug. I can try to replicate it.

> We don't support compilers other than MSVC on Windows
> [...]
> rubenvb is not maintained.

I don't remember why I used rubenvb back then. I'll see if I can get MSVC 
working. Maybe this is the cause for the slow down.

--

___
Python tracker 

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



[issue36616] Optimize thread state handling in function call code

2019-04-13 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Mark, Petr, do you agree? I like the way how the reference implementation of 
PEP 590 improves the handling of profiling. However, that change really has 
little to do with PEP 590, it's something that we can do independently.

--

___
Python tracker 

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



[issue36624] cleanup the stdlib and tests with regard to sys.platform usage

2019-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

I tried to add constants to test.support once to identify operating systems, 
nbut I had to revert the change. I am not sure that there is any problem here. 
Leaving the code unchanged is also fine :-)

--
nosy: +vstinner

___
Python tracker 

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



[issue21110] Slowdown and high memory usage when adding a new module in embedded Python 3.4 on 64bit Windows

2019-04-13 Thread STINNER Victor


STINNER Victor  added the comment:

In case of doubt, I suggest to close the issue. If the issue strikes back,
it is trivial to reopen the issue or open a new one.

--

___
Python tracker 

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



[issue17013] Allow waiting on a mock

2019-04-13 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Mario for the feedback.

> I see you inherit from Mock, should it inherit from MagicMock?

yes, it can inherit from MagicMock to mock magic methods and to wait on their 
call.

I thought some more about waiting for function call with arguments. One idea 
would be to have a dictionary with args to function as key mapping to an event 
object and to set and wait on that event object. To have wait_until_called that 
is always listening on a per mock object and to have wait_until_called_with 
listening on event object specific to that argument. Below is a sample 
implementation and an example to show it working with wait_until_called and 
wait_until_called_with. wait_until_called_with is something difficult to model 
since it needs per call event object and also need to store relevant key 
mapping to event object that is currently args and doesn't support keyword 
arguments. But wait_until_called is little simpler waiting on a per mock event 
object.

I will open up a PR with some tests.


class WaitableMock(MagicMock):

def __init__(self, *args, **kwargs):
_safe_super(WaitableMock, self).__init__(*args, **kwargs)
self.event_class = kwargs.pop('event_class', threading.Event)
self.event = self.event_class()
self.expected_calls = {}

def _mock_call(self, *args, **kwargs):
ret_value  = _safe_super(WaitableMock, self)._mock_call(*args, **kwargs)

for call in self._mock_mock_calls:
event = self.expected_calls.get(call.args)
if event and not event.is_set():
event.set()

# Always set per mock event object to ensure the function is called for 
wait_until_called.
self.event.set()

return ret_value

def wait_until_called(self, timeout=1):
return self.event.wait(timeout=timeout)

def wait_until_called_with(self, *args, timeout=1):
# If there are args create a per argument list event object and if not 
wait for per mock event object.
if args:
if args not in self.expected_calls:
event = self.event_class()
self.expected_calls[args] = event
else:
event = self.expected_calls[args]
else:
event = self.event

return event.is_set() or event.wait(timeout=timeout)



# Sample program to wait on arguments, magic methods and validating wraps

import multiprocessing
import threading
import time
from unittest.mock import WaitableMock, patch, call

def call_after_sometime(func, *args, delay=1):
time.sleep(delay)
func(*args)

def wraps(*args):
return 1

def foo(*args):
pass

def bar(*args):
pass

with patch('__main__.foo', WaitableMock(event_class=threading.Event, 
wraps=wraps)):
with patch('__main__.bar', WaitableMock(event_class=threading.Event)):
# Test normal call
threading.Thread(target=call_after_sometime, args=(foo, 1), 
kwargs={'delay': 1}).start()
threading.Thread(target=call_after_sometime, args=(bar, 1), 
kwargs={'delay': 5}).start()
print("foo called ", foo.wait_until_called(timeout=2))
print("bar called ", bar.wait_until_called(timeout=2))
foo.assert_called_once()
bar.assert_not_called()

# Test wraps works
assert foo() == 1

# Test magic method
threading.Thread(target=call_after_sometime, args=(foo.__str__, ), 
kwargs={'delay': 1}).start()
print("foo.__str__ called ", foo.__str__.wait_until_called(timeout=2))
print("bar.__str__ called ", bar.__str__.wait_until_called(timeout=2))

foo.reset_mock()
bar.reset_mock()

# Test waiting for arguments
threading.Thread(target=call_after_sometime, args=(bar, 1), 
kwargs={'delay': 1}).start()
threading.Thread(target=call_after_sometime, args=(bar, 2), 
kwargs={'delay': 5}).start()
print("bar called with 1 ", bar.wait_until_called_with(1, timeout=2))
print("bar called with 2 ", bar.wait_until_called_with(2, timeout=2))
time.sleep(5)
print("bar called with 2 ", bar.wait_until_called_with(2))


$ ./python.exe ../backups/bpo17013_mock.py
foo called  True
bar called  False
foo.__str__ called  True
bar.__str__ called  False
bar called with 1  True
bar called with 2  False
bar called with 2  True

--

___
Python tracker 

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



[issue16254] Make PyUnicode_AsWideCharString() increase temporary

2019-04-13 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue17259] Document round half to even rule for floats

2019-04-13 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

It doesn't seem there have been other bugs reported related to this.  However, 
if it's still agreed that the documentation should be clarified, I think a link 
from `locale.format_string()` (note, format() has been deprecated, hence the 
change in the name) to the Format Specification Mini-Language might helpful.  
Also, Terry's suggestion in msg182706 specific to %f rounding could be added.

--
nosy: +cheryl.sabella
versions: +Python 3.7, Python 3.8 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue36588] change sys.platform() to just "aix" for AIX

2019-04-13 Thread Michael Felt


Michael Felt  added the comment:

On 12/04/2019 23:16, Michael Felt wrote:
> Agreed, in case of doubt - leave alone (never change a winning team).
>
> And, to make it a short reply - I'll get started, and we see where it
> leads us.

I opened issue36624 (https://bugs.python.org/issue36624) - before I
"take off", some comments/discussion on what is desirable and achievable
would be welcome.

--

___
Python tracker 

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



[issue36624] cleanup the stdlib and tests with regard to sys.platform usage

2019-04-13 Thread Michael Felt


New submission from Michael Felt :

Back in 2012 (issue12326 and issue12795), and just recently (issue36588) 
sys.platform has been modified (and documented) to not return the platform 
version.

Additionally, the recommendation is to use the form 
sys.platform.startswith() - to continue to be backwards compatible.

IMHO - looking forward - Python3.8 and later - we should not be using the 
recommendation for 'backwards-compatibility' in our code (so this PR will not 
be considered for back-porting) - in our stdlib, tests, and - should it occur - 
in "core" code. We should be testing for equality.

Further, imho, the change should not be sys.platform ==  but should 
be platform.system() == , or platform.system() in ('AIX', 'Darwin', 
'Linux') -- and adjust the list so that the most frequently used platform is 
tested first (e.g., performance-wise ('Linux', 'Darwin', 'AIX') would better 
reflect platform importance.

OR - should the change just continue to use sys.platform - even though this is 
a build-time value, not a run-time value.

I propose to do this in separate PR - one for each platform of AIX, Darwin and 
Linux.

(I would also add Windows, but that would be to replace the equivalence of 
sys.platform == 'win32' with platform.system() == 'Windows', and perhaps, 
os.name == 'nt' with platform.system() == 'Windows'. Reaction from other 
platforms dependent on os.name == 'nt' (cygwin?) would be helpful.)

Finally, while I do not want to rush this - I would like to try and target 
getting this complete in time for Python3.8

--
components: Library (Lib), Tests
messages: 340155
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: cleanup the stdlib and tests with regard to sys.platform usage
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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2019-04-13 Thread Cheryl Sabella


Cheryl Sabella  added the comment:


New changeset f8716c88f13f035c126fc1db499ae0ea309c7ece by Cheryl Sabella in 
branch 'master':
bpo-18610: Update wsgiref.validate docstring for wsgi.input read() (GH-11663)
https://github.com/python/cpython/commit/f8716c88f13f035c126fc1db499ae0ea309c7ece


--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue15035] array.array of UCS2 values

2019-04-13 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue15917] hg hook to detect unmerged changesets

2019-04-13 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> out of date
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



[issue17068] peephole optimization for constant strings

2019-04-13 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue17013] Allow waiting on a mock

2019-04-13 Thread Mario Corchero


Mario Corchero  added the comment:

I think this is REALLY interesting!, there are many situations where this has 
been useful, it would greatly improve multithreading testing in Python.

Q? I see you inherit from Mock, should it inherit from MagicMock?
I'd say send the PR and the discussion can happen there about the 
implementation, seems there is consensus in this thread.

I would find it OK to start with `wait_until_called` if you want and can be 
discussed in another issue/PR if you don't have the time/think it might not be 
worth.

--

___
Python tracker 

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



[issue36594] Undefined behavior due to incorrect usage of %p in format strings

2019-04-13 Thread Stefan Krah

Stefan Krah  added the comment:

gcc warns with -pedantic:

ptr.c: In function ‘main’:
ptr.c:5:13: warning: format ‘%p’ expects argument of type ‘void *’, but 
argument 2 has type ‘int *’ [-Wformat=]
 printf ("%p", );


It is pedantic indeed, I wonder if machines with different pointer sizes still 
exist.

--
nosy: +skrah

___
Python tracker 

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



[issue36594] Undefined behavior due to incorrect usage of %p in format strings

2019-04-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Are not all pointer types (except pointers to functions) automatically 
converted to/from void*.

--

___
Python tracker 

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



[issue31743] Proportional Width Font on Generated Python Docs PDFs

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +eric.araujo, ezio.melotti, mdk, willingc

___
Python tracker 

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



[issue36594] Undefined behavior due to incorrect usage of %p in format strings

2019-04-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue33922] [Windows] Document the launcher's -64 suffix

2019-04-13 Thread Cheryl Sabella


Change by Cheryl Sabella :


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



[issue2007] cookielib lacks FileCookieJar class for Internet Explorer

2019-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

I don't think adding MSIE support is not worth enough for now.

--
nosy: +inada.naoki
resolution:  -> out of date
stage: needs patch -> 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



[issue21110] Slowdown and high memory usage when adding a new module in embedded Python 3.4 on 64bit Windows

2019-04-13 Thread Inada Naoki


Inada Naoki  added the comment:

* rubenvb is not maintained.
* https://forums.embarcadero.com/message.jspa?messageID=581594 is dead link.
* When PY_SSIZE_T is not defined, we use intptr_t, not int.

Original issue report doesn't make sense to me.
But we can't confirm it for now.

--

___
Python tracker 

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



[issue35734] Remove unused _BaseV4._is_valid_netmask in ipaddress

2019-04-13 Thread Inada Naoki

Inada Naoki  added the comment:


New changeset e59ec1b05d3e1487ca7754530d3748446c9b7dfd by Inada Naoki (Rémi 
Lapeyre) in branch 'master':
bpo-35734: ipaddress: remove unused methods (GH-11591)
https://github.com/python/cpython/commit/e59ec1b05d3e1487ca7754530d3748446c9b7dfd


--
nosy: +inada.naoki

___
Python tracker 

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



[issue29980] OSError: multiple exceptions should preserve the exception type if it is common

2019-04-13 Thread Aymeric Augustin


Aymeric Augustin  added the comment:

A very similar issue came up here: 
https://github.com/aaugustin/websockets/issues/593

When raising an exception that gathers multiple sub-exceptions, it would be 
nice to be able to iterate the exception to access the sub-exceptions.

--
nosy: +aymeric.augustin

___
Python tracker 

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



[issue19113] duplicate test names in Lib/ctypes/test/test_functions.py

2019-04-13 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue17267] datetime.time support for '+' and '-'

2019-04-13 Thread Andreas Åkerlund

Change by Andreas Åkerlund :


--
nosy:  -thezulk

___
Python tracker 

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



[issue17013] Allow waiting on a mock

2019-04-13 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

Is there still sufficient interest in this? I gave an initial try at this based 
on my limited knowledge of mock and Antoine's idea. I created a new class 
WaitableMock that inherits from Mock and accepts an event_class with 
threading.Event as default and stores an event object. When call is made then 
via CallableMixin _mock_call is called which I have overridden to set the event 
object. I have wait_until_called that waits on this event object for a given 
timeout to return whether it's called or not. 

I am not sure of implementing wait_until_called_with since I set the event 
object for any call in _mock_call irrespective of argument and since the call 
params for which the event has to be set are passed to wait_until_called_with. 
Perhaps allow passing a call object to wait_until_called_with and and during 
_mock_call set event object only if the call is the same as one passed to 
wait_until_called_with ?

See also issue26467 to support asyncio with mock

Initial implementation 

class WaitableMock(Mock):

def __init__(self, *args, **kwargs):
event_class = kwargs.pop('event_class', threading.Event)
_safe_super(WaitableMock, self).__init__(*args, **kwargs)
self.event = event_class()

def _mock_call(self, *args, **kwargs):
_safe_super(WaitableMock, self)._mock_call(*args, **kwargs)
self.event.set()

def wait_until_called(self, timeout=1):
return self.event.wait(timeout=timeout)

Sample program : 

import multiprocessing
import threading
import time
from unittest.mock import WaitableMock, patch

def call_after_sometime(func, delay=1):
time.sleep(delay)
func()

def foo():
pass

def bar():
pass

with patch('__main__.foo', WaitableMock(event_class=threading.Event)):
with patch('__main__.bar', WaitableMock(event_class=threading.Event)):
threading.Thread(target=call_after_sometime, args=(foo, 1)).start()
threading.Thread(target=call_after_sometime, args=(bar, 5)).start()
print("foo called ", foo.wait_until_called(timeout=2)) # successful
print("bar called ", bar.wait_until_called(timeout=2)) # times out
foo.assert_called_once()
bar.assert_not_called()
# Wait for the bar's thread to complete to verify call is registered
time.sleep(5)
bar.assert_called_once()

# foo is called but waiting for call to bar times out and hence no calls to bar 
are registered though bar is eventually called in the end and the call is 
registered at the end of the program.

➜  cpython git:(master) ✗ time ./python.exe ../backups/bpo17013_mock.py
foo called  True
bar called  False
./python.exe ../backups/bpo17013_mock.py  0.40s user 0.05s system 7% cpu 5.765 
total

--
nosy: +cjw296, mariocj89, xtreak

___
Python tracker 

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