[issue35656] More matchers in unittest.mock

2019-01-11 Thread Petter S


Petter S  added the comment:

I am of the opposite opinion. :-) 

> if I know roughly what the float should be why would I not want to test it 
> for exactness?

When testing algorithms, it is often the case that the answer should be 
mathematically exactly 2, but due to floating-point inexactness it becomes, 
say, 1.97 in practice. If I then test for exactly 1.97 the test 
becomes very brittle and sensitive for e.g. order of multiplications.

Testing floating point numbers with a relative error is essential in many 
application.

--

___
Python tracker 

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



[issue35715] ProcessPool workers hold onto return value of last task in memory

2019-01-11 Thread David Chevell


New submission from David Chevell :

ProcessPoolExecutor workers will hold onto the return value of their last task 
in memory until the next task is received. Since the return value has already 
been propagated to the parent process's `Future` or else effectively discarded, 
this is holding onto objects unnecessarily.

Simple case to reproduce:

import concurrent.futures
import time

executor = concurrent.futures.ProcessPoolExecutor(max_workers=1)

def big_val():
return [{1:1} for i in range(1, 100)]

executor.submit(big_val)

# Observe the memory usage of the process worker during the sleep interval
time.sleep(10)


This should be easily fixed by having the worker explicitly `del r` after 
calling `_sendback_result` as it already does this for `call_item`

--
components: Library (Lib)
messages: 333444
nosy: dchevell
priority: normal
severity: normal
status: open
title: ProcessPool workers hold onto return value of last task in memory
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



[issue35715] ProcessPool workers hold onto return value of last task in memory

2019-01-11 Thread David Chevell


Change by David Chevell :


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

___
Python tracker 

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



[issue35715] ProcessPool workers hold onto return value of last task in memory

2019-01-11 Thread David Chevell


Change by David Chevell :


--
keywords: +patch, patch, patch, patch
pull_requests: +11075, 11076, 11077, 11078
stage:  -> patch review

___
Python tracker 

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



[issue35715] ProcessPool workers hold onto return value of last task in memory

2019-01-11 Thread David Chevell


Change by David Chevell :


--
keywords: +patch, patch, patch
pull_requests: +11075, 11076, 11077
stage:  -> patch review

___
Python tracker 

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



[issue35715] ProcessPool workers hold onto return value of last task in memory

2019-01-11 Thread David Chevell


Change by David Chevell :


--
keywords: +patch, patch
pull_requests: +11075, 11076
stage:  -> patch review

___
Python tracker 

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



[issue33817] PyString_FromFormatV() fails to build empty strings

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue33817] PyString_FromFormatV() fails to build empty strings

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch, patch
pull_requests: +11079, 11080
stage:  -> patch review

___
Python tracker 

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



[issue33817] PyString_FromFormatV() fails to build empty strings

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch, patch, patch
pull_requests: +11079, 11080, 11081
stage:  -> patch review

___
Python tracker 

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



[issue33817] PyString_FromFormatV() fails to build empty strings

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11082

___
Python tracker 

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



[issue33817] PyString_FromFormatV() fails to build empty strings

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11082, 11083, 11084

___
Python tracker 

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



[issue33817] PyString_FromFormatV() fails to build empty strings

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11082, 11083

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Ricardo Fraile


New submission from Ricardo Fraile :

Add macOS to CLOCK_MONOTONIC_RAW description because it is already available 
since 10.12.

--
assignee: docs@python
components: Documentation
files: 001.patch
keywords: patch
messages: 333445
nosy: docs@python, rfrail3, vstinner
priority: normal
severity: normal
status: open
title: CLOCK_MONOTONIC_RAW available on macOS
type: enhancement
Added file: https://bugs.python.org/file48041/001.patch

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Some examples:

$ ./python -m timeit "format('abc')"
Unpatched:  500 loops, best of 5: 65 nsec per loop
Patched:500 loops, best of 5: 42.4 nsec per loop

$ ./python -m timeit "'abc'.replace('x', 'y')"
Unpatched:  500 loops, best of 5: 101 nsec per loop
Patched:500 loops, best of 5: 63.8 nsec per loop

$ ./python -m timeit "'abc'.ljust(5)"
Unpatched:  200 loops, best of 5: 120 nsec per loop
Patched:500 loops, best of 5: 94.4 nsec per loop

$ ./python -m timeit "(1, 2, 3).index(2)"
Unpatched:  200 loops, best of 5: 100 nsec per loop
Patched:500 loops, best of 5: 62.4 nsec per loop

$ ./python -m timeit -s "a = [1, 2, 3]" "a.index(2)"
Unpatched:  200 loops, best of 5: 93.8 nsec per loop
Patched:500 loops, best of 5: 70.1 nsec per loop

./python -m timeit -s "import math" "math.pow(0.5, 2.0)"
Unpatched:  200 loops, best of 5: 112 nsec per loop
Patched:500 loops, best of 5: 82.3 nsec per loop

--

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread STINNER Victor


Change by STINNER Victor :


--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Ronald, Ned: What is the macOS version used to build Python binaries 
distributed on python.org? Do we get the constant on macOS 10.12 if binaries 
are built on macOS 10.11 for example?

I guess that people building Python from source like hombrew will get the 
constant.

Joannah: Can you please convert attached patch into a pull request? Please 
mention Ricardo Fraile as co-author of the change (mention his name in the 
commit message). Such change doesn't need to be mentioned in the changelog (no 
NEWS entry needed).

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2019-01-11 Thread Sergey Shashkov


Sergey Shashkov  added the comment:

This patch actually fixes the problem:

https://bugs.python.org/issue35588
https://github.com/python/cpython/commit/3a374e0c5abe805667b71ffaaa7614781101ff4c




from fractions import Fraction
import operator

class Goo:
__radd__, __rdivmod__, __rfloordiv__, __rmod__, __rmul__, __rpow__, 
__rsub__, __rtruediv__ = [lambda a, b: 'ok'] * 8

for func in operator.add, operator.sub, operator.mul, operator.truediv, 
operator.pow, operator.mod, operator.floordiv, divmod:
print(func.__name__, func(Fraction(1), Goo()))

--
nosy:  -mark.dickinson, oscarbenjamin, vstinner
pull_requests: +11085
resolution:  -> fixed
stage:  -> patch review
status: open -> closed

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

$ ./python -m timeit "format('abc')"
Unpatched:  500 loops, best of 5: 65 nsec per loop
Patched:500 loops, best of 5: 42.4 nsec per loop

-23 ns on 65 ns: this is very significant! I spent like 6 months to implement 
"FASTCALL" to avoid a single tuple to pass positional arguments and it was only 
20 ns faster per call. Additional 23 ns make the code way faster compared than 
Python without FASTCALL! I estimate something like 80 ns => 42 ns: 2x faster!

$ ./python -m timeit "'abc'.replace('x', 'y')"
Unpatched:  500 loops, best of 5: 101 nsec per loop
Patched:500 loops, best of 5: 63.8 nsec per loop

-38 ns on 101 ns: that's even more significant! Wow, that's very impressive!

Please merge your PR, I want it now :-D

Can you maybe add a vague sentence in the Optimizations section of What's New 
in Python 3.8 ? Something like: "Parsing positional arguments in builtin 
functions has been made more efficient."? I'm not sure if "builtin" is the 
proper term here. Functions using Argument Clinic to parse their arguments?

--

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

I added _Py_CheckFunctionResult() to every C calls. This function calls 
PyErr_Occurred() after a function call. This change has been made in Python 
3.5: bpo-23571. I made this change because it was very difficult to identify 
bugs when an exception was raised but the bug was only spotted "later". Some 
exceptions were ignored by mistakes.

I also added a *lot* of assertions like the following one, but only when Python 
is built in debug mode:

#ifdef Py_DEBUG
/* type_call() must not be called with an exception set,
   because it may clear it (directly or indirectly) and so the
   caller loses its exception */
assert(!PyErr_Occurred());
#endif

commit 4a7cc8847276df27c8f52987cda619ca279687c2
Author: Victor Stinner 
Date:   Fri Mar 6 23:35:27 2015 +0100

Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() now
raise a SystemError if a function returns a result and raises an exception.
The SystemError is chained to the previous exception.

Refactor also PyObject_Call() and PyCFunction_Call() to make them more 
readable.

Remove some checks which became useless (duplicate checks).

Change reviewed by Serhiy Storchaka.

commit efde146b0c42f2643f96d00896c99a90d501fb69
Author: Victor Stinner 
Date:   Sat Mar 21 15:04:43 2015 +0100

Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
which returned an invalid result (result+error or no result without error) 
in
the exception message.

Add also unit test to check that the exception contains the name of the
function.

Special case: the final _PyEval_EvalFrameEx() check doesn't mention the
function since it didn't execute a single function but a whole frame.

--

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

I'm a supporter to add *more* checks to the debug build but also provide a 
Python runtime compiled in debug mode which would be ABI compatible (no need to 
rebuild C extensions).

See my large project:

   https://pythoncapi.readthedocs.io/

Especially:

   https://pythoncapi.readthedocs.io/runtimes.html#debug-build

It would avoid any overhead at runtime for the regular runtime (compiled in 
release mode).

Only we would have such "debug runtime" available, I even plan to remove 
runtime checks from the release build :-)

https://pythoncapi.readthedocs.io/optimization_ideas.html#remove-debug-checks

--

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
pull_requests: +11086
stage:  -> patch review

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
pull_requests: +11086, 11087
stage:  -> patch review

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
pull_requests: +11086, 11087, 11088
stage:  -> patch review

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@vstinner I have created the PR for this.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I suppose that my computer is a bit faster than your, so your 20 ns can be only 
15 ns or 10 ns on my computer. Run microbenchmarks on your computer to get a 
scale.

It may be possible to save yet few nanoseconds if inline a fast path for 
_PyArg_CheckPositional(), but I'm going to try this later.

This change is a step in a sequence. I will add a What's New note after 
finishing so much steps as possible. The next large step is to optimize 
argument parsing for functions with keyword parameters.

--

___
Python tracker 

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



[issue14614] PyTuple_SET_ITEM could check bounds in debug mode

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Since bpo-35337 has been rejected, I also close this issue.

--
resolution:  -> wont fix
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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Is it possible to run custom builds or benchmark of this once merged on 
speed.python.org ? I hope this give will be a noticeable dip in the benchmark 
graphs.

--
nosy: +xtreak

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

@Ricardo: Can you please give you email address? It's to credit you in the 
commit message. (You don't have to, it's up to you to share it or not :-))

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

I can trigger a benchmark run on speed.python.org once the change is merged.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Added Stefan because the new C API could be used in Cython after stabilizing. 
We should more cooperate with Cython team and provide a (semi-)official stable 
API for using in Cython.

I do not expect large affect on most tests, since this optimization affects 
only a part of functions, and can be noticeable only for very fast function 
calls.

--
nosy: +scode

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Ricardo Fraile


Ricardo Fraile  added the comment:

@vstinner here you have rfra...@rfraile.eu :)

--

___
Python tracker 

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



[issue32146] multiprocessing freeze_support needed outside win32

2019-01-11 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

The key here would be to replace function execution with module execution and 
command-line arguments.

So instead of:

  python -c 'from multiprocessing.forkserver import main; main(ARG1, ARG2...)'

you would do:

  python -m multiprocessing.forkserver ARG1 ARG2 

Then it should become easy to extract the concatenated command lines.

(and if that works, please do the same for semaphore_tracker ;-))

--
versions: +Python 3.8 -Python 3.6

___
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-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If you are fine with this change Gregory, do you mind to withdraw your request 
and remove the DO-NOT-MERGE label on GitHub?

As for DeprecationWarning vs SyntaxWarning:

1. It looks as misuse of DeprecationWarning. We do not plan to remove this 
feature in future. Emitting it will send a false signal to users. And 
SyntaxWarning was added such kind of warning: syntactically valid code that for 
sure is an error.

2. Seems there is no differences between DeprecationWarning and SyntaxWarning 
if they are emitted at compile time. They will be shown by default in all 
cases, in the main script and in modules.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Stefan Behnel


Change by Stefan Behnel :


--
nosy: +scoder -scode

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@Ricardo, Thanks, commit message updated.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Stefan Behnel


Stefan Behnel  added the comment:

It might be worth inlining a fast path of "_PyArg_CheckPositional()" that only 
tests "nargs < min || nargs > max" (even via a macro), and then branches to the 
full error checking and reporting code only if that fails. Determining the 
concrete exception to raise is not time critical, but the good case is. Also, 
that would immediately collapse into "nargs != minmax" for the cases where "min 
== max", i.e. we expect an exact number of arguments.

And yes, a function that raises the expected exception with the expected error 
message for a hand full of common cases would be nice. :)

--

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fd7d539be3ce1cc098a4f104b7a7816ca00add16 by Victor Stinner 
(Joannah Nanjekye) in branch 'master':
bpo-35716: Update time.CLOCK_MONOTONIC_RAW doc (GH-11517)
https://github.com/python/cpython/commit/fd7d539be3ce1cc098a4f104b7a7816ca00add16


--

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11089

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11089, 11090

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11089, 11090, 11091

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread miss-islington


miss-islington  added the comment:


New changeset 8a5b1aa98f97923c39734b508aead152a5a1c911 by Miss Islington (bot) 
in branch '3.7':
bpo-35716: Update time.CLOCK_MONOTONIC_RAW doc (GH-11517)
https://github.com/python/cpython/commit/8a5b1aa98f97923c39734b508aead152a5a1c911


--
nosy: +miss-islington

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Joannah Nanjekye for the PR. I rewrote the commit message to format 
properly the co-authored-by tag. The doc has been updated in 3.7 and master.

Ricardo Fraile: *Please*. Don't use this clock :-) It must not be used except 
if you really understand well what you are doing :-)

https://www.python.org/dev/peps/pep-0418/#clock-monotonic-clock-monotonic-raw-clock-boottime

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



[issue32710] test_asyncio: ProactorEventLoopTests sendfile tests leak references on Windows

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5485085b324a45307c1ff4ec7d85b5998d7d5e0d by Victor Stinner in 
branch 'master':
bpo-32710: Fix _overlapped.Overlapped memory leaks (GH-11489)
https://github.com/python/cpython/commit/5485085b324a45307c1ff4ec7d85b5998d7d5e0d


--

___
Python tracker 

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



[issue32710] test_asyncio: ProactorEventLoopTests sendfile tests leak references on Windows

2019-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11092

___
Python tracker 

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



[issue32710] test_asyncio: ProactorEventLoopTests sendfile tests leak references on Windows

2019-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11092, 11093

___
Python tracker 

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



[issue32710] test_asyncio: ProactorEventLoopTests sendfile tests leak references on Windows

2019-01-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11092, 11093, 11094

___
Python tracker 

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



[issue24746] doctest 'fancy diff' formats incorrectly strip trailing whitespace

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

All Refleaks buildots are back to green, thanks ;-)

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 4fa9591025b6a098f3d6402e5413ee6740ede6c5 by Serhiy Storchaka in 
branch 'master':
bpo-35582: Argument Clinic: inline parsing code for positional parameters. 
(GH-11313)
https://github.com/python/cpython/commit/4fa9591025b6a098f3d6402e5413ee6740ede6c5


--

___
Python tracker 

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



[issue32710] test_asyncio: ProactorEventLoopTests sendfile tests leak references on Windows

2019-01-11 Thread miss-islington


miss-islington  added the comment:


New changeset 059997d78ed1a1a5a364b1846ac972c98c704927 by Miss Islington (bot) 
in branch '3.7':
bpo-32710: Fix _overlapped.Overlapped memory leaks (GH-11489)
https://github.com/python/cpython/commit/059997d78ed1a1a5a364b1846ac972c98c704927


--

___
Python tracker 

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



[issue34838] Improve arg clinic code generation for cases with type checking

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 9659 is mostly superseded by issue35582. But it may contain other changes. 
Ammar, do you mind to create a new PR or merge the old PR with the current 
master?

--

___
Python tracker 

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



[issue32710] test_asyncio: ProactorEventLoopTests sendfile tests leak references on Windows

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, _overlapped.Overlapped should now have a few less memory leaks :-)

--

___
Python tracker 

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



[issue35716] CLOCK_MONOTONIC_RAW available on macOS

2019-01-11 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Victor, the binaries are build on the macOS version mentioned in the download. 
That is, the modern 64-bit installers are build on macOS 10.9 with the 10.9 
SDK, the older 32/64-bit intel installers are build on macOS 10.6 with the 10.6 
SDK.

With some work it should be possible to build the 64-bit installer on newer 
macOS releases, but that requires some work to ensure the code deals well with 
weakly linked symbols.  I've added such support in the past for older macOS 
releases, so this is definitely doable.  I'd love to work on this, but don't 
know when I'll have time to do so.

BTW. I'm pretty sure there's an issue about this, but cannot find it at the 
moment.

--

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread STINNER Victor


New submission from STINNER Victor :

sys._getframe(2) fails in the following example:

code = "from enum import Enum; Enum('Animal', 'ANT BEE CAT DOG')"
code = compile(code, "", "exec")
global_ns = {}
local_ls = {}
exec(code, global_ns, local_ls)

Error with Python 3.7.2 (Fedora 29):

Traceback (most recent call last):
  File "x.py", line 5, in 
exec(code, global_ns, local_ls)
  File "", line 1, in 
  File "/usr/lib64/python3.7/enum.py", line 311, in __call__
return cls._create_(value, names, module=module, qualname=qualname, 
type=type, start=start)
  File "/usr/lib64/python3.7/enum.py", line 429, in _create_
module = sys._getframe(2).f_globals['__name__']
KeyError: '__name__'

--
components: Library (Lib)
messages: 333474
nosy: barry, eli.bendersky, ethan.furman, vstinner
priority: normal
severity: normal
status: open
title: enum.Enum error on sys._getframe(2)
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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

The bug has been reported in my perf project:
https://github.com/vstinner/perf/issues/49

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11095, 11096

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11095, 11096, 11097

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11095

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

I converted msg333446 into attached bench.py using perf. Results on my laptop:

vstinner@apu$ ./python -m perf compare_to ref.json inlined.json --table -G
+-+-+--+
| Benchmark   | ref | inlined  |
+=+=+==+
| format('abc')   | 74.4 ns | 43.7 ns: 1.70x faster (-41%) |
+-+-+--+
| 'abc'.replace('x', 'y') | 93.0 ns | 57.5 ns: 1.62x faster (-38%) |
+-+-+--+
| (1, 2, 3).index(2)  | 92.5 ns | 59.2 ns: 1.56x faster (-36%) |
+-+-+--+
| a.index(2)  | 93.6 ns | 59.9 ns: 1.56x faster (-36%) |
+-+-+--+
| 'abc'.ljust(5)  | 124 ns  | 86.0 ns: 1.44x faster (-30%) |
+-+-+--+
| math.pow(0.5, 2.0)  | 121 ns  | 88.1 ns: 1.37x faster (-27%) |
+-+-+--+

The speedup on my laptop is between 30.7 and 38.0 ns per function call, on 
these specific functions.

1.7x faster on format() is very welcome, well done Serhiy!

Note: You need the just released perf 1.6.0 version to run this benchmark ;-)

--
Added file: https://bugs.python.org/file48042/bench.py

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Ethan Furman  added the comment:

Looks like the following code:

if module is None:
try:
module = sys._getframe(2).f_globals['__name__']
except (AttributeError, ValueError) as exc:
pass

needs to have `KeyError` added to the `except` line.

--
assignee:  -> ethan.furman
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

> I can trigger a benchmark run on speed.python.org once the change is merged.

Aha, it seems like Serhiy has more optimizations to come: PR #11520.

@Serhiy: tell me when you are done, so I can trigger a new benchmark run.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 11520 additionally replaces PyArg_UnpackTuple() and _PyArg_UnpackStack() 
with _PyArg_CheckPositional() and inlined code in Argument Clinic.

Some examples for PR 11520:

$ ./python -m timeit "'abc'.strip()"
Unpatched:  500 loops, best of 5: 51.2 nsec per loop
Patched:500 loops, best of 5: 45.8 nsec per loop

$ ./python -m timeit -s "d = {'a': 1}" "d.get('a')"
Unpatched:  500 loops, best of 5: 55 nsec per loop
Patched:500 loops, best of 5: 51.1 nsec per loop

$ ./python -m timeit "divmod(5, 2)"
Unpatched:  500 loops, best of 5: 87 nsec per loop
Patched:500 loops, best of 5: 80.6 nsec per loop

$ ./python -m timeit "hasattr(1, 'numerator')"
Unpatched:  500 loops, best of 5: 62.4 nsec per loop
Patched:500 loops, best of 5: 54.8 nsec per loop

$ ./python -m timeit "isinstance(1, int)"
Unpatched:  500 loops, best of 5: 62.7 nsec per loop
Patched:500 loops, best of 5: 54.1 nsec per loop

$ ./python -m timeit -s "from math import gcd" "gcd(6, 10)"
Unpatched:  200 loops, best of 5: 99.6 nsec per loop
Patched:500 loops, best of 5: 89.9 nsec per loop

$ ./python -m timeit -s "from operator import add" "add(1, 2)"
Unpatched:  500 loops, best of 5: 40.7 nsec per loop
Patched:1000 loops, best of 5: 32.6 nsec per loop

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

$ ./python -m timeit -s "from operator import add" "add(1, 2)"
Unpatched:  500 loops, best of 5: 40.7 nsec per loop
Patched:1000 loops, best of 5: 32.6 nsec per loop

We should stop you, or the timing will become negative if you continue!

--

___
Python tracker 

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



[issue35718] Cannot initialize the "force" command-option

2019-01-11 Thread Opher Shachar


New submission from Opher Shachar :

When creating a custom Command (or sub-classing one) we cannot initialize in 
"initialize_options()" the "force" option to 1, because Command.__init__ resets 
it to None after the call to self.initialize_options().

--
components: Distutils
messages: 333481
nosy: Opher Shachar, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Cannot initialize the "force" command-option
type: behavior
versions: Python 2.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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2a39d251f07d4c620e3b9a1848e3d1eb3067be64 by Serhiy Storchaka in 
branch 'master':
bpo-35582: Argument Clinic: Optimize the "all boring objects" case. (GH-11520)
https://github.com/python/cpython/commit/2a39d251f07d4c620e3b9a1848e3d1eb3067be64


--

___
Python tracker 

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



[issue35712] Make NotImplemented unusable in boolean context

2019-01-11 Thread Guido van Rossum


Guido van Rossum  added the comment:

I agree.

On Thu, Jan 10, 2019 at 11:24 PM Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> This is a common mistake. Even the default implementation of object.__ne__
> had a bug, fixed only 4 years ago in issue21408. There were several errors
> in stdlib. I am sure there is a lot of occurrences of this errors in a
> third party code.
>
> So I like this idea. This can help to fix hidden errors in existing code.
> But I share also Josh's concerns.
>
> There is related common mistake. In C code, the result of
> PyObject_IsTrue() often is treated as just a boolean, without checking for
> errors. Fortunately, in the current CPython code it is handled properly,
> but I am sure this error still is occurred in third-party extensions.
>
> When these two errors (using NotImplemented in the boolean context and
> ignoring the error in PyObject_IsTrue() in the C code) meet, this can lead
> to manifestation of more weird bugs than treating NotImplemented as true:
> from a crash in debug build to raising an exception in the following
> unrelated code.
>
> I suggest to start emitting a DeprecationWarning or a FutureWarning in
> NotImplemented.__bool__.
>
> --
> nosy: +gvanrossum, serhiy.storchaka
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2019-01-11 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

The off-by-one error in a test added for an unrelated issue (#17467) makes me 
think @michael.foord just made a mistake in the test.

> mock_open docs mentions about using a customized mock for complex cases
I think it's more for complex things like fetching data using a callback for 
example, this seems like a normal use case for mock_open(). Even more so, 
leaving the behavior as it is now may lead someone to think there is a bug in 
its code.

I opened a new PR to fix this issue: 
https://github.com/python/cpython/pull/11521

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


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

___
Python tracker 

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



[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
keywords: +patch, patch
pull_requests: +11098, 11099
stage:  -> patch review

___
Python tracker 

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



[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
keywords: +patch, patch, patch
pull_requests: +11098, 11099, 11100
stage:  -> patch review

___
Python tracker 

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



[issue27015] subprocess.CalledProcessError's repr changes based on kwargs, and doesn't unpickle

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Ethan Furman  added the comment:

Marking this as "easy".  It needs a test showing the failing behavior, then the 
fix.

--
keywords: +easy

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11104

___
Python tracker 

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



[issue17467] Enhancement: give mock_open readline() and readlines() methods

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
pull_requests: +11101

___
Python tracker 

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



[issue17467] Enhancement: give mock_open readline() and readlines() methods

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
pull_requests: +11101, 11102

___
Python tracker 

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



[issue17467] Enhancement: give mock_open readline() and readlines() methods

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
pull_requests: +11101, 11102, 11103

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11104, 11105

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11104, 11105, 11106

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
keywords: +patch
pull_requests: +11107
stage: test needed -> patch review

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi, PR https://github.com/python/cpython/pull/11521 should fix the issue.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 11524 performs the same kind of changes as PR 11520, but for handwritten 
code (only if this causes noticeable speed up). Also iter() is now use the fast 
call convention.

$ ./python -m timeit "iter(())"
Unpatched:  500 loops, best of 5: 82.8 nsec per loop
Patched:500 loops, best of 5: 56.3 nsec per loop

$ ./python -m timeit -s "it = iter([])" "next(it, None)"
Unpatched:  500 loops, best of 5: 54.1 nsec per loop
Patched:500 loops, best of 5: 44.9 nsec per loop

$ ./python -m timeit "getattr(1, 'numerator')"
Unpatched:  500 loops, best of 5: 63.6 nsec per loop
Patched:500 loops, best of 5: 57.5 nsec per loop

$ ./python -m timeit -s "from operator import attrgetter; f = 
attrgetter('numerator')" "f(1)"
Unpatched:  500 loops, best of 5: 64.1 nsec per loop
Patched:500 loops, best of 5: 56.8 nsec per loop

$ ./python -m timeit -s "from operator import methodcaller; f = 
methodcaller('conjugate')" "f(1)"
Unpatched:  500 loops, best of 5: 79.5 nsec per loop
Patched:500 loops, best of 5: 74.1 nsec per loop

It is possible to speed up also many math methods and maybe some contextvar and 
hamt methods, but this is for other issues.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Stefan Behnel


Stefan Behnel  added the comment:

Nice! Well done, Serhiy!

--

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Ethan Furman  added the comment:

That PR does not go with this issue.  ;)

--

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

> Hi, PR https://github.com/python/cpython/pull/11521 should fix the issue.

It's PR 11523.

--

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests:  -11107

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

$ ./python -m timeit "iter(())"
Unpatched:  500 loops, best of 5: 82.8 nsec per loop
Patched:500 loops, best of 5: 56.3 nsec per loop

That's quite significant. Oh, it's because you converted builtin_iter() from 
METH_VARARGS to METH_FASTCALL at the same time. Interesting.

--

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread STINNER Victor


STINNER Victor  added the comment:

> That PR does not go with this issue.  ;)

It does. You removed the link to PR 11523 which is a fix for this issue.

--

___
Python tracker 

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



[issue35582] Argument Clinic: inline parsing code for functions with only positional parameters

2019-01-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Just inlining the arg tuple unpacking in iter() give only 10% speed up. I would 
not apply this optimization for such small difference. But with converting it 
to fast call it looks more interesting.

--

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +11108

___
Python tracker 

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



[issue34838] Improve arg clinic code generation for cases with type checking

2019-01-11 Thread Ammar Askar


Ammar Askar  added the comment:

Sounds good, I'll take a look at the changes and update the PR accordingly.

--

___
Python tracker 

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



[issue35718] Cannot initialize the "force" command-option

2019-01-11 Thread Opher Shachar


Change by Opher Shachar :


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

___
Python tracker 

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



[issue35718] Cannot initialize the "force" command-option

2019-01-11 Thread Opher Shachar


Change by Opher Shachar :


--
keywords: +patch, patch
pull_requests: +11109, 0
stage:  -> patch review

___
Python tracker 

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



[issue35718] Cannot initialize the "force" command-option

2019-01-11 Thread Opher Shachar


Change by Opher Shachar :


--
keywords: +patch, patch, patch
pull_requests: +11109, 0, 2
stage:  -> patch review

___
Python tracker 

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



[issue35718] Cannot initialize the "force" command-option

2019-01-11 Thread Opher Shachar


Change by Opher Shachar :


--
keywords: +patch, patch, patch, patch
pull_requests: +11109, 0, 1, 2
stage:  -> patch review

___
Python tracker 

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



[issue35718] Cannot initialize the "force" command-option

2019-01-11 Thread Éric Araujo

Éric Araujo  added the comment:

Could you tell how you found the problem, i.e. what are you trying to do?

--

___
Python tracker 

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



[issue34569] test__xxsubinterpreters.ShareableTypeTests._assert_values fails on AIX - 32-bit mode

2019-01-11 Thread Eric Snow


Eric Snow  added the comment:


New changeset a909460a09cca79bd051c45b02e650862a57dbd9 by Eric Snow (Michael 
Felt) in branch 'master':
bpo-34569: Fix subinterpreter 32-bit  ABI, pystate.c/_new_long_object() 
(gh-9127)
https://github.com/python/cpython/commit/a909460a09cca79bd051c45b02e650862a57dbd9


--

___
Python tracker 

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



[issue35719] Optimize multi-argument math functions

2019-01-11 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The proposed PR makes multi-argument functions in the math module atan2(), 
copysign(), remainder() and hypot() to use the fast call convention and inline 
arguments tuple unpacking.

Results:

$ ./python -m timeit -s "from math import atan2" "atan2(1.0, 1.0)"
Unpatched:  500 loops, best of 5: 79.5 nsec per loop
Patched:500 loops, best of 5: 66.1 nsec per loop

$ ./python -m timeit -s "from math import copysign" "copysign(1.0, 1.0)"
Unpatched:  500 loops, best of 5: 90.3 nsec per loop
Patched:1000 loops, best of 5: 35.9 nsec per loop

$ ./python -m timeit -s "from math import remainder" "remainder(1.0, 1.0)"
Unpatched:  500 loops, best of 5: 69.5 nsec per loop
Patched:500 loops, best of 5: 44.5 nsec per loop

$ ./python -m timeit -s "from math import hypot" "hypot(1.0, 1.0)"
Unpatched:  500 loops, best of 5: 63.6 nsec per loop
Patched:500 loops, best of 5: 47.4 nsec per loop

--
components: Extension Modules
messages: 333497
nosy: mark.dickinson, rhettinger, serhiy.storchaka, stutzbach, vstinner
priority: normal
severity: normal
status: open
title: Optimize multi-argument math functions
type: performance
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



[issue34569] test__xxsubinterpreters.ShareableTypeTests._assert_values fails on AIX - 32-bit mode

2019-01-11 Thread Eric Snow


Eric Snow  added the comment:

Thanks, Michael.

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



[issue35719] Optimize multi-argument math functions

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue35719] Optimize multi-argument math functions

2019-01-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch, patch
pull_requests: +3, 4
stage:  -> patch review

___
Python tracker 

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



  1   2   >