[issue29057] Compiler failure on Mac OS X - sys/random.h

2017-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Releasing 3.5.3 even though technically this is an open release blocker.  IIUC 
the fix is checked in, and fixed the issue for OS X.  We don't know whether or 
not it is also fixed on OpenBSD, because we don't know anybody running OpenBSD, 
and nobody contacted us regarding OpenBSD during the 3.5.3 RC period.  Anyway 
I'm declaring victory and moving on.  Maybe we can mark this bug closed?

--

___
Python tracker 

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



[issue29006] 2.7.13 _sqlite more prone to "database table is locked"

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 74a68d86569c by Benjamin Peterson in branch '2.7':
revert dd13098a5dc2 (#29006, #10513)
https://hg.python.org/cpython/rev/74a68d86569c

--

___
Python tracker 

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



[issue10513] sqlite3.InterfaceError after commit

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 74a68d86569c by Benjamin Peterson in branch '2.7':
revert dd13098a5dc2 (#29006, #10513)
https://hg.python.org/cpython/rev/74a68d86569c

--

___
Python tracker 

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



[issue26110] Speedup method calls 1.2x

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a6241b2073c6 by INADA Naoki in branch 'default':
Issue #26110: Add document for LOAD_METHOD and CALL_METHOD opcode.
https://hg.python.org/cpython/rev/a6241b2073c6

--

___
Python tracker 

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



[issue26110] Speedup method calls 1.2x

2017-01-16 Thread INADA Naoki

Changes by INADA Naoki :


--
status: open -> closed

___
Python tracker 

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



[issue29281] json.loads documentation missing "versionchanged" statement

2017-01-16 Thread Alexey Popravka

New submission from Alexey Popravka:

json.loads function was changed in Python 3.6 to accept
bytes and bytearrays, however documentation is missing
`versionchanged` block describing this changes.

--
assignee: docs@python
components: Documentation
messages: 285545
nosy: Alexey Popravka, docs@python
priority: normal
severity: normal
status: open
title: json.loads documentation missing "versionchanged" statement
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue29274] Change “tests cases” → “test cases”

2017-01-16 Thread Michael Foord

Michael Foord added the comment:

Yep, looks like an improvement to me!

--

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-16 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file46297/unicodeobject.c.v7.patch

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Juraj Sukop

New submission from Juraj Sukop:

Fused multiply-add (henceforth FMA) is an operation which calculates the 
product of two numbers and then the sum of the product and a third number with 
just one floating-point rounding. More concretely:

r = x*y + z

The value of `r` is the same as if the RHS was calculated with infinite 
precision and the rounded to a 32-bit single-precision or 64-bit 
double-precision floating-point number [1].

Even though one FMA CPU instruction might be calculated faster than the two 
separate instructions for multiply and add, its main advantage comes from the 
increased precision of numerical computations that involve the accumulation of 
products. Examples which benefit from using FMA are: dot product [2], 
compensated arithmetic [3], polynomial evaluation [4], matrix multiplication, 
Newton's method and many more [5].

C99 includes [6] `fma` function to `math.h` and emulates the calculation if the 
FMA instruction is not present on the host CPU [7]. PEP 7 states that "Python 
versions greater than or equal to 3.6 use C89 with several select C99 features" 
and that "Future C99 features may be added to this list in the future depending 
on compiler support" [8].

This proposal is then about adding new `fma` function with the following 
signature to `math` module:

math.fma(x, y, z)

'''Return a float representing the result of the operation `x*y + z` with 
single rounding error, as defined by the platform C library. The result is the 
same as if the operation was carried with infinite precision and rounded to a 
floating-point number.'''

Attached is a simple module for Python 3 demonstrating the fused multiply-add 
operation. On my machine, `example.py` prints:

40037.524591982365   horner_double
40037.48821639768horner_fma
40037.49486325783horner_compensated
40037.49486325783horner_decimal

[1] https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation
[2] S. Graillat, P. Langlois, N. Louvet. Accurate dot products with FMA. 2006
[3] S. Graillat, Accurate Floating Point Product and Exponentiation. 2007.
[4] S. Graillat, P. Langlois, N. Louvet. Improving the compensated Horner 
scheme with a Fused Multiply and Add. 2006
[5] J.-M. Muller, N. Brisebarre, F. de Dinechin, C.-P. Jeannerod, V. Lefèvre, 
G. Melquiond, N. Revol, D. Stehlé, S. Torres. Handbook of Floating-Point 
Arithmetic. 2010. Chapter 5
[6] ISO/IEC 9899:TC3, "7.12.13.1 The fma functions", Committee Draft - 
Septermber 7, 2007
[7] https://git.musl-libc.org/cgit/musl/tree/src/math/fma.c
[8] https://www.python.org/dev/peps/pep-0007/

--
components: Library (Lib)
messages: 285547
nosy: juraj.sukop
priority: normal
severity: normal
status: open
title: Fused multiply-add: proposal to add math.fma()
type: enhancement
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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Juraj Sukop

Changes by Juraj Sukop :


Added file: http://bugs.python.org/file46298/xmathmodule.c

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Juraj Sukop

Changes by Juraj Sukop :


Added file: http://bugs.python.org/file46299/example.py

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Juraj Sukop

Changes by Juraj Sukop :


Added file: http://bugs.python.org/file46300/setup.py

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue29262] Provide a way to check for *real* typing.Union instances

2017-01-16 Thread flying sheep

flying sheep added the comment:

Cool! This set of basic initial check will consist of all the is_* functions 
that were mentioned right?

FWIW I also think that this is the way to go, as it’s not obvious if the 
semantics should be “conforms to this type annotation” or “is a type annotation 
of that kind” or other variants.

In case this isn’t already too much future think: What should be the way 
forward from there? E.g. when working with Union[A, B], you will probably want 
to get “(A, B)”.

So will that mean more introspection functions (like 
union_types(Union[str,int]),
or public APIs for typings (e.g. a_union.__iter__() or a_union.types)?

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Thread on python-ideas:
https://mail.python.org/pipermail/python-ideas/2017-January/044300.html

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

What's the point of adding this in the math module rather than a more 
specialized library like Numpy?

--
nosy: +pitrou

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Juraj Sukop

Juraj Sukop added the comment:

I would say because it has wide applicability, especially considering the 
amount of code it adds. It is similar in spirit to `copysign` or `fsum` which 
are already there and C99 includes it anyway. For simpler things like dot 
product or polynomial evaluation importing Numpy might be too much of an 
dependency.

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't know. If I want to compute a dot product, the first thing I'll do is 
import Numpy and then use the `@` operator on Numpy arrays.

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The performance argument unlikely is applicable in this case. I suppose that an 
overhead of function call in Python make two operators faster than one function 
call.

Alternatives to fma() for exact computations are integer arithmetic (if all 
values can be scaled to integers), fractions and decimal numbers.

But since fma() is a part of C (C99), C++ (C++11) and POSIX (POSIX.1-2001) 
standards for long time, I don't have objections against including it in the 
math module.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM again.

--

___
Python tracker 

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



[issue29283] duplicate README in site-packages

2017-01-16 Thread jan matejek

New submission from jan matejek:

Lib/site-packages directory now contains README.txt in addition to README. Both 
files are identical. One of them should probably go away?

--
components: Installation
messages: 28
nosy: matejcik
priority: normal
severity: normal
status: open
title: duplicate README in site-packages
type: enhancement
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue1294959] Problems with /usr/lib64 builds.

2017-01-16 Thread jan matejek

jan matejek added the comment:

Attached is a patch that I'd like to propose for inclusion.

It introduces a new configure option "--with-custom-platlibdir=", which 
defaults to `basename $libdir`. This is converted to makefile variable 
"platlibdir", which is used in getpath.c to generate value of the lib_python 
variable.

sysconfig and distutils.sysconfig retrieve the variable from makefile (i 
learned about existence of _sysconfigdata so that is where the variable now 
lives) to correctly substitute in posix_prefix (and unix_prefix for distutils 
install) scheme.

Sysconfig is then used in pydoc and trace module, instead of locally 
calculating paths. Perhaps distutils.sysconfig should also use more of 
sysconfig instead of duplicating the functionality?

As it stands, the python stdlib is installed into /usr/$platlibdir, because I 
changed SCRIPTDIR to $libdir instead of $prefix/lib. Maybe this should be also 
separately configurable?
In any case, third-party modules get installed either into /usr/lib or 
/usr/$platlibdir depending on whether they are arch-independent or not. Hence 
the final modification in site.py that adds /usr/lib to search path on systems 
where $platlibdir != "lib".

This caused test_sysconfig to fail because it checks that posix_user and 
posix_prefix schemes generate "similar" paths. I have left the posix_user 
scheme alone, so all its paths are based on "lib", where the posix_prefix 
scheme uses $platlibdir. Maybe posix_user scheme should be modified as well?
Anyway, for now, I have accounted for the changes in the test.

What now?
(please don't make me write a PEP please don't make me write a PEP please don't 
make..)

--
versions: +Python 3.7
Added file: http://bugs.python.org/file46301/python-3.6.0-multilib-new.patch

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Mark Dickinson

Mark Dickinson added the comment:

> The performance argument unlikely is applicable in this case.

Agreed. This is mainly about accuracy, not speed: the FMA operation is a 
fundamental building block for floating-point arithmetic, is useful in some 
numerical algorithms, and essential in others (especially when doing things 
like double-double arithmetic). It would be valuable to have when prototyping 
numerical algorithms in pure Python.

Given that it's supported in C99 and on current Windows, I'm +1 on including it 
in the math module.

Note that implementing this it not quite as straightforward as simply wrapping 
the libm version, since we'll also want the correct exceptional behaviour, for 
consistency with the rest of the math module: i.e., we should be raising 
ValueError where the fma operation would signal the invalid FPE, and 
OverflowError where the fma operation would signal the overflow FPE.

--

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 27dc9a1c061e by INADA Naoki in branch 'default':
Issue #20180: convert unicode methods to AC.
https://hg.python.org/cpython/rev/27dc9a1c061e

--
nosy: +python-dev

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-16 Thread INADA Naoki

INADA Naoki added the comment:

Thank you, Martin and Serhiy.

As http://bugs.python.org/issue20180#msg247987 , remained module to converted
is transmogrify.h.

But docstrings of methods in transmogrify.h were moved to bytes_methods.c in 
issue26765.

May I close this issue for now?

--

___
Python tracker 

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



[issue27400] Datetime NoneType after calling Py_Finalize and Py_Initialize

2017-01-16 Thread Denny Weinberg

Denny Weinberg added the comment:

Any news here? 3.6.0 is also affected by this bug.

--

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Seems you haven't updated generated AC files.

--

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-16 Thread INADA Naoki

INADA Naoki added the comment:

Uhhh!  I'm sorry.

--

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 01b06ca45f64 by INADA Naoki in branch 'default':
Issue #20180: forgot to update AC output.
https://hg.python.org/cpython/rev/01b06ca45f64

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Mark Dickinson

Mark Dickinson added the comment:

An implementation note: IEEE 754-2008 leaves it to the implementation to decide 
whether FMA operations like:

0 * inf + nan

and

inf * 0 + nan

(where nan represents a quiet NaN and the inf and 0 can have arbitrary signs) 
signal the invalid operation FPE or not. (Ref: 7.2(c) in IEEE 754-2008.) 

I'd suggest that in this case we follow what Intel does in its x64 chips with 
FMA3 support.(according to ). If I'm reading the table in section 2.3 of the 
Intel Advanced Vector Extensions Programming Reference correctly, Intel does 
*not* signal the invalid operation FPE in this case. That is, we're following 
the usual rule of quiet NaN in => quiet NaN out with no exception. This does 
unfortunately conflict with the IBM decimal specification and Python's decimal 
module, where these operations *do* set the "invalid" flag (see the spec, and 
test fmax0809 in the decimal test set).

--
nosy: +skrah

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Isn't the behaviour of quiet NaNs kindof implementation-dependent already?

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Mark Dickinson

Mark Dickinson added the comment:

> Isn't the behaviour of quiet NaNs kindof implementation-dependent already?

Not as far as IEEE 754-2008 is concerned, and not as far as Python's math 
module is concerned, either: handling of special cases is, as far as I know, 
both consistent across platforms and compliant with IEEE 754. That's not true 
across Python as a whole, but it should be true for the math module.

If you find an exception to the above statement, please do open a bug report!

--

___
Python tracker 

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



[issue27659] Prohibit implicit C function declarations

2017-01-16 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Thanks for the comment and sorry for the mistake. Here's another updated patch.

In PEP7:

> Use 4-space indents and no tabs at all.

Does that apply to configuration files, too?

--
Added file: 
http://bugs.python.org/file46302/prohibit-implicit-function-declarations.patch

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

> Strange, I'm unable to reproduce the result on a different computer: (...)

Ah, the benchmark result change after a reboot. I reran the same benchmark 
(LTO+PGO on speed-python) after a reboot:
---
haypo@speed-python$ python3 -m perf compare_to 
~/test/2017-01-13_19-18-default-3486425ed82b.json ~/patchdir/patch.json  -G 
Slower (29):
- spectral_norm: 275 ms +- 4 ms -> 301 ms +- 16 ms: 1.09x slower (+9%)
- fannkuch: 1.10 sec +- 0.01 sec -> 1.16 sec +- 0.18 sec: 1.06x slower (+6%)
- scimark_monte_carlo: 282 ms +- 3 ms -> 298 ms +- 6 ms: 1.06x slower (+6%)
- sqlite_synth: 9.39 us +- 0.19 us -> 9.82 us +- 0.15 us: 1.05x slower (+5%)
- nqueens: 261 ms +- 2 ms -> 271 ms +- 2 ms: 1.04x slower (+4%)
- meteor_contest: 209 ms +- 1 ms -> 217 ms +- 2 ms: 1.04x slower (+4%)
- scimark_fft: 684 ms +- 22 ms -> 709 ms +- 9 ms: 1.04x slower (+4%)
- pickle_pure_python: 1.35 ms +- 0.01 ms -> 1.39 ms +- 0.02 ms: 1.03x slower 
(+3%)
- xml_etree_iterparse: 227 ms +- 5 ms -> 233 ms +- 6 ms: 1.03x slower (+3%)
- sympy_integrate: 49.3 ms +- 0.3 ms -> 50.5 ms +- 0.3 ms: 1.02x slower (+2%)
- genshi_text: 90.3 ms +- 1.0 ms -> 92.4 ms +- 1.1 ms: 1.02x slower (+2%)
- regex_dna: 283 ms +- 1 ms -> 289 ms +- 1 ms: 1.02x slower (+2%)
- telco: 22.3 ms +- 0.5 ms -> 22.6 ms +- 0.3 ms: 1.02x slower (+2%)
- chaos: 295 ms +- 3 ms -> 300 ms +- 3 ms: 1.02x slower (+2%)
- go: 598 ms +- 5 ms -> 607 ms +- 7 ms: 1.01x slower (+1%)
- json_dumps: 30.5 ms +- 0.4 ms -> 30.9 ms +- 0.5 ms: 1.01x slower (+1%)
- richards: 183 ms +- 4 ms -> 186 ms +- 5 ms: 1.01x slower (+1%)
- deltablue: 17.1 ms +- 0.5 ms -> 17.4 ms +- 0.3 ms: 1.01x slower (+1%)
- logging_format: 42.1 us +- 0.6 us -> 42.5 us +- 0.6 us: 1.01x slower (+1%)
- sympy_str: 511 ms +- 4 ms -> 515 ms +- 5 ms: 1.01x slower (+1%)
- 2to3: 760 ms +- 4 ms -> 766 ms +- 4 ms: 1.01x slower (+1%)
- regex_compile: 462 ms +- 4 ms -> 465 ms +- 5 ms: 1.01x slower (+1%)
- django_template: 447 ms +- 5 ms -> 450 ms +- 4 ms: 1.01x slower (+1%)
- logging_simple: 35.6 us +- 0.5 us -> 35.8 us +- 0.6 us: 1.01x slower (+1%)
- hexiom: 23.0 ms +- 0.2 ms -> 23.2 ms +- 0.1 ms: 1.01x slower (+1%)
- python_startup: 16.0 ms +- 0.1 ms -> 16.1 ms +- 0.1 ms: 1.00x slower (+0%)
- regex_effbot: 5.08 ms +- 0.03 ms -> 5.10 ms +- 0.09 ms: 1.00x slower (+0%)
- call_method: 13.8 ms +- 0.1 ms -> 13.9 ms +- 0.2 ms: 1.00x slower (+0%)
- python_startup_no_site: 9.36 ms +- 0.04 ms -> 9.37 ms +- 0.07 ms: 1.00x 
slower (+0%)

Faster (19):
- scimark_lu: 518 ms +- 18 ms -> 458 ms +- 25 ms: 1.13x faster (-11%)
- xml_etree_process: 242 ms +- 4 ms -> 234 ms +- 4 ms: 1.03x faster (-3%)
- unpickle: 36.0 us +- 0.5 us -> 35.0 us +- 0.5 us: 1.03x faster (-3%)
- chameleon: 30.6 ms +- 0.2 ms -> 29.8 ms +- 0.3 ms: 1.03x faster (-3%)
- nbody: 240 ms +- 2 ms -> 234 ms +- 2 ms: 1.02x faster (-2%)
- call_method_slots: 13.9 ms +- 0.2 ms -> 13.6 ms +- 0.4 ms: 1.02x faster (-2%)
- unpickle_pure_python: 924 us +- 8 us -> 904 us +- 9 us: 1.02x faster (-2%)
- xml_etree_generate: 289 ms +- 4 ms -> 283 ms +- 4 ms: 1.02x faster (-2%)
- mako: 43.2 ms +- 0.4 ms -> 42.3 ms +- 0.4 ms: 1.02x faster (-2%)
- pickle_dict: 65.5 us +- 4.1 us -> 64.4 us +- 0.9 us: 1.02x faster (-2%)
- call_simple: 12.8 ms +- 0.4 ms -> 12.6 ms +- 0.4 ms: 1.01x faster (-1%)
- xml_etree_parse: 294 ms +- 13 ms -> 291 ms +- 9 ms: 1.01x faster (-1%)
- pickle_list: 9.38 us +- 0.35 us -> 9.32 us +- 0.14 us: 1.01x faster (-1%)
- unpack_sequence: 118 ns +- 3 ns -> 118 ns +- 1 ns: 1.00x faster (-0%)
- sympy_expand: 1.14 sec +- 0.01 sec -> 1.13 sec +- 0.01 sec: 1.00x faster (-0%)
- sqlalchemy_declarative: 338 ms +- 3 ms -> 337 ms +- 3 ms: 1.00x faster (-0%)
- crypto_pyaes: 236 ms +- 2 ms -> 235 ms +- 1 ms: 1.00x faster (-0%)
- pidigits: 321 ms +- 1 ms -> 320 ms +- 1 ms: 1.00x faster (-0%)
- regex_v8: 45.6 ms +- 0.7 ms -> 45.6 ms +- 0.3 ms: 1.00x faster (-0%)

Benchmark hidden because not significant (16): call_method_unknown, 
dulwich_log, float, genshi_xml, html5lib, json_loads, logging_silent, pathlib, 
pickle, raytrace, scimark_sor, scimark_sparse_mat_mult, sqlalchemy_imperative, 
sympy_sum, tornado_http, unpickle_list
---

Lighter verbose with a threshold of 5%:
---
haypo@speed-python$ python3 -m perf compare_to 
~/test/2017-01-13_19-18-default-3486425ed82b.json ~/patchdir/patch.json  -G 
--min-speed=5
Slower (3):
- spectral_norm: 275 ms +- 4 ms -> 301 ms +- 16 ms: 1.09x slower (+9%)
- fannkuch: 1.10 sec +- 0.01 sec -> 1.16 sec +- 0.18 sec: 1.06x slower (+6%)
- scimark_monte_carlo: 282 ms +- 3 ms -> 298 ms +- 6 ms: 1.06x slower (+6%)

Faster (1):
- scimark_lu: 518 ms +- 18 ms -> 458 ms +- 25 ms: 1.13x faster (-11%)

Benchmark hidden because not significant (60): 2to3, call_method, ...
---

spectral_norm and scimark_lu are two unstable benchmarks. Sadly, it seems like 
the current patch is not really significant on benchmarks. But again, it 
doesn't optimize __call__() slot yet.

--

___
Python tracker 


[issue28911] Clarify the behaviour of assert_called_once_with

2017-01-16 Thread Michael Foord

Michael Foord added the comment:

I like the documentation improvement, thank you.

(The purpose of the method is to combine an assert about the arguments the 
method was called with and an assertion that it was only called once. To change 
the semantics would be both undesirable and backwards incompatible.)

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-16 Thread INADA Naoki

INADA Naoki added the comment:

Additionally, there are not enough METH_FASTCALL CFunctions.

I'm interested in performance difference between METH_VARARGS and 
METH_FASTCALL.  If METH_FASTCALL is significant faster than VARARGS,
we can convert some common methods from VARARGS to FASTCALL, by hand or
by AC.

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2ccdf2b3819d by Victor Stinner in branch 'default':
Optimize _PyCFunction_FastCallKeywords()
https://hg.python.org/cpython/rev/2ccdf2b3819d

--
nosy: +python-dev

___
Python tracker 

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



[issue29284] Include thread_name_prefix in the concurrent.futures.ThreadPoolExecutor example 17.4.2.1

2017-01-16 Thread John Taylor

New submission from John Taylor:

Please include how to use the thread_name_prefix method argument (new to Python 
3.6) in the example: 17.4.2.1. ThreadPoolExecutor Example

--
assignee: docs@python
components: Documentation
messages: 285572
nosy: docs@python, jftuga
priority: normal
severity: normal
status: open
title: Include thread_name_prefix  in the concurrent.futures.ThreadPoolExecutor 
example 17.4.2.1
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue29285] Unicode errors occur inside of multi-line comments

2017-01-16 Thread John Taylor

New submission from John Taylor:

I am using Python 3.5.2 on OS X 10.11.6.  The same error occurs with 3.5.2 on 
Windows 10.

When I run the attached code, I get this error:

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in 
position 23-24: truncated \u escape

I think unicode processing should be ignored inside of multiline comments.
Inside of my comments, I really want to use this text verbatim.

--
components: Interpreter Core
files: example.py
messages: 285573
nosy: jftuga
priority: normal
severity: normal
status: open
title: Unicode errors occur inside of multi-line comments
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file46303/example.py

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

The issue #29263 "Implement LOAD_METHOD/CALL_METHOD for C functions" should 
also optimize C methods even more.

--

___
Python tracker 

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



[issue29285] Unicode errors occur inside of multi-line comments

2017-01-16 Thread Zachary Ware

Zachary Ware added the comment:

Triple-quoted strings are strings, not multi-line comments, though people do 
abuse them for that purpose sometimes.  Changing this behavior would be a huge 
change for next to no benefit, so I'm closing the issue.

If you insist on using a triple-quoted string as a comment (which I repeat, it 
is not; comments are ignored by the compiler, while triple-quoted strings are 
treated just as any other string literal by the compiler), you can work around 
this by using a 'raw' string literal:

r"""
dir \\dept.example.com\user
"""

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread STINNER Victor

New submission from STINNER Victor:

Changes 27dc9a1c061e and 01b06ca45f64 converted the str (Unicode) methods to 
Argument Clinic, cool! But str methods taking more than one argument use 
positional-only arguments.

Currently, Argument Clinic doesn't use METH_FASTCALL for these methods, but 
METH_VARARGS.

There are two options:

* Allow passing arguments as keywoards: str.replace(old='a', new='b')
* Enhance Argument Clinic to use also METH_FASTCALL for functions using 
positional-only functions

The goal is to speedup method calls. Example with str.replace():

$ ./python-patch -m perf timeit '"a".replace("x", "y")' --duplicate=100 
--compare-to ./python-ref
python-ref: . 132 ns +- 1 ns
python-patch: . 102 ns +- 2 ns

Median +- std dev: [python-ref] 132 ns +- 1 ns -> [python-patch] 102 ns +- 2 
ns: 1.30x faster (-23%)

--
messages: 285574
nosy: haypo, inada.naoki, larry, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use METH_FASTCALL in str methods
type: performance
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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Background: see also the old issue #17170 closed as rejected: "string method 
lookup is too slow".

--

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread Yury Selivanov

Yury Selivanov added the comment:

> * Allow passing arguments as keywoards: str.replace(old='a', new='b')

I think Guido explicitly stated that he doesn't like the idea to always allow 
keyword arguments for all methods. I.e. `str.find('aaa')` just reads better 
than `str.find(needle='aaa')`. Essentially, the idea is that for most of the 
builtins that accept one or two arguments, positional-only parameters are 
better.

> * Enhance Argument Clinic to use also METH_FASTCALL for functions using 
> positional-only functions

So this is the option to go with.

--
nosy: +yselivanov

___
Python tracker 

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



[issue29230] Segfault in sqlite3

2017-01-16 Thread Daniel Fackrell

Daniel Fackrell added the comment:

I was using versions of python from pyenv, but they may have been using the 
system version of sqlite3. I recreated the virtualenv using python 2.7.13 
installed with Brew, and it doesn't crash.

sqlite3.sqlite_version went from 3.8.10.2 to 3.16.2, which seems like a rather 
large jump.

Thank you for your assistance on this! I'm still trying to find a good way to 
get pyenv to recognize and use the newer library, but I can handle that outside 
of this ticket unless you have some quick tips already handy for that.

--
status: pending -> open

___
Python tracker 

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



[issue29230] Segfault in sqlite3

2017-01-16 Thread Ned Deily

Ned Deily added the comment:

> I'm still trying to find a good way to get pyenv to recognize and use the 
> newer library

Thanks for confirming that the problem was due to the version of sqlite3 in 
use.  If you haven't already, suggest you open an issue on the pyenv project 
tracker or ask elsewhere.  Good luck!

https://github.com/yyuu/pyenv

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is python-patch?

--

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2017-01-16 Thread Mark Dickinson

Mark Dickinson added the comment:

Here's a pure Python reference implementation, with tests.

--
Added file: http://bugs.python.org/file46304/fma_reference.py

___
Python tracker 

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



[issue27659] Prohibit implicit C function declarations

2017-01-16 Thread Martin Panter

Martin Panter added the comment:

I would say it is more important to fit in with the surrounding style than 
mindlessly follow PEP 7. IMO the indentation in the configure script is a mess, 
but if we fix it up, it should probably be done separately to adding this extra 
flag.

--

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

> What is python-patch?

It's Python patched with attached unicode_allow_kw.patch: allow to pass 
parameters as keywords for Unicode methods.

--
keywords: +patch
Added file: http://bugs.python.org/file46305/unicode_allow_kw.patch

___
Python tracker 

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



[issue29287] IDLE needs syntax highlighting for f-strings

2017-01-16 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Follow the lead from Vim, MagicPython, and PyCharm.  Needs separate 
colorization to make the expression distinct from the rest of the string.  
Needs close-brace matching.  Would be desirable to have autocompletion as well. 
 

https://twitter.com/raymondh/status/819085176764366848

--
assignee: terry.reedy
components: IDLE
messages: 285585
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE needs syntax highlighting for f-strings
type: enhancement
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



[issue29288] Lookup Error while importing idna from a worker thread

2017-01-16 Thread Ilya Kulakov

New submission from Ilya Kulakov:

See this post: https://github.com/kennethreitz/requests/issues/3578

The current workaround for requests is to have a no-op import somewhere in the 
code.

However, that doesn't really work for us: our python and stdlib are bundled by 
pyqtdeploy as in Qt resources system and we frequently see this error. On 
certain machines. Workaround that seems to work more reliably is a no-op look 
up via ''.encode('ascii').decode('idna').

--
components: Library (Lib)
messages: 285586
nosy: Ilya.Kulakov
priority: normal
severity: normal
status: open
title: Lookup Error while importing idna from a worker thread
versions: Python 3.5

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread INADA Naoki

INADA Naoki added the comment:

Parsing positional arguments for METH_KEYWORDS and METH_FASTCALL can be faster 
by 
http://bugs.python.org/issue29029

--

___
Python tracker 

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



[issue29289] Convert OrderedDict methods to Argument Clinic

2017-01-16 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch converts methods using METH_VARARGS|METH_KEYWORDS calling 
convention to METH_FASTCALL using Argument Clinic. This calling convention is 
faster, and Argument Clinic provides better docstring.

See also issue #29263 "Implement LOAD_METHOD/CALL_METHOD for C functions" and 
issue #29286 "Use METH_FASTCALL in str methods".

--
components: Interpreter Core
files: odict_clinic.patch
keywords: patch
messages: 285588
nosy: eric.snow, haypo, inada.naoki
priority: normal
severity: normal
status: open
title: Convert OrderedDict methods to Argument Clinic
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46306/odict_clinic.patch

___
Python tracker 

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



[issue29289] Convert OrderedDict methods to Argument Clinic

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Converted methods:

* fromkeys() (@classmethod)
* setdefault()
* pop()
* popitem()
* move_to_end()

--

___
Python tracker 

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



[issue29029] Faster positional arguments parsing in PyArg_ParseTupleAndKeywords

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a36e60c5fee0 by Victor Stinner in branch 'default':
Rename keywords to kwargs in getargs.c
https://hg.python.org/cpython/rev/a36e60c5fee0

--
nosy: +python-dev

___
Python tracker 

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



[issue29029] Faster positional arguments parsing in PyArg_ParseTupleAndKeywords

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I missed this issue. Since I made minor cleanup recently, I took the 
liberty of rebasing your patch.

I also pushed your "keywords => kwargs" change, just to make the patch simpler 
to review.

--
nosy: +haypo
Added file: 
http://bugs.python.org/file46307/PyArg_ParseTupleAndKeywords-faster-positional-args-parse-2.patch

___
Python tracker 

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



[issue29029] Faster positional arguments parsing in PyArg_ParseTupleAndKeywords

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

> Unpatched:  Median +- std dev: 2.01 us +- 0.09 us
> Patched:Median +- std dev: 1.23 us +- 0.03 us

Oh wow, impressive speedup! As usual, good job Serhiy ;-)

PyArg_ParseTupleAndKeywords-faster-positional-args-parse-2.patch: LGTM! Can you 
please push it?

--

___
Python tracker 

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



[issue9216] FIPS support for hashlib

2017-01-16 Thread Robert Collins

Robert Collins added the comment:

A few thoughts;

usedforsecurity=xxx seems awkward: I wouldn't want, as a user of hashlib, to 
have to put that in literally every use I make of it.

If I understand the situation correctly, the goal is for both linters, and at 
runtime, identification of the intended purpose of a call to md5 - e.g. whether 
there are security implications in its use (as far as FIPS is concerned).

Perhaps having two separate implementations of the interfaces, one general 
purpose and one FIPS would be decent.

e.g. from hashlib.fips import sha1 
etc
etc
and hashlib.fips simply wouldn't contain md5.

Then the md5 thats in hashlib is by definition not FIPS ready and any code 
using it should be fixed.

--
nosy: +rbcollins

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread INADA Naoki

INADA Naoki added the comment:

This patch makes AC produces more FASTCALL instead of VARARGS.

When looking AC output, one downside is it produces many consts like:
+static const char * const _keywords[] = {"", "", "", "", "", NULL};

--
Added file: http://bugs.python.org/file46308/ac_more_fastcalls.patch

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

ac_more_fastcalls.patch: Hum, I guess that your change on _PyStack_UnpackDict() 
is related to a bug in the function prototype. The function is unable to report 
failure if args is NULL. It changed the API in the change 38ab8572fde2.

--

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d07fd6e6d449 by Victor Stinner in branch 'default':
Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywords
https://hg.python.org/cpython/rev/d07fd6e6d449

New changeset 01c57ef1b651 by Victor Stinner in branch 'default':
Add _PyArg_ParseStack() helper function
https://hg.python.org/cpython/rev/01c57ef1b651

New changeset 8bfec37ea86a by Victor Stinner in branch 'default':
Add _PyArg_NoStackKeywords() helper function
https://hg.python.org/cpython/rev/8bfec37ea86a

New changeset 38ab8572fde2 by Victor Stinner in branch 'default':
_PyStack_UnpackDict() now returns -1 on error
https://hg.python.org/cpython/rev/38ab8572fde2

New changeset de90f3d06bc9 by Victor Stinner in branch 'default':
Argument Clinic: Use METH_FASTCALL for positionals
https://hg.python.org/cpython/rev/de90f3d06bc9

New changeset dea8922751a1 by Victor Stinner in branch 'default':
Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
https://hg.python.org/cpython/rev/dea8922751a1

--
nosy: +python-dev

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Naoki> This patch makes AC produces more FASTCALL instead of VARARGS.

Oh, funny, I wrote the same patch :-) (almost)


> When looking AC output, one downside is it produces many consts like:
> +static const char * const _keywords[] = {"", "", "", "", "", NULL};

Yeah, I got the same result. I tried to hack a _PyArg_ParseStack() function 
which doesn't take keyword argments (no kwnames), but I lost my mind in 
parser_init().

So I decided to simply rebase my old patches from my random CPython fastcall 
forks to add a simple _PyArg_ParseStack(). My implementation doesn't use the 
super-fast _PyArg_Parser object, but at least it allows to use METH_FASTCALL. 
Compared to what we had previously (METH_VARARGS), it is an enhancement :-)

I prefer to move step by step, since each commit is already big enough. It's 
also easier for me to maintain my forks if I push more changes upstream.

So there is still room for improvement in _PyArg_ParseStack(), but I suggest to 
defer further optimizations to a new issue.

--

___
Python tracker 

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



[issue29289] Convert OrderedDict methods to Argument Clinic

2017-01-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This patch segfaults for me (Mac OS 10.12.2 with the default clang-800.0.42.1).

For now, pop() should be omitted.  The argument clinic doesn't cope well with 
optional arguments without a default value.  The generated help "pop(self, /, 
key, default=None)" doesn't really make since because the default is not None, 
it is a sentinel value.  The generated help incorrectly makes it look like 
OrderedDict.get() which actually does have a default=None.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3bf78c286daf by Victor Stinner in branch 'default':
Add _PyArg_UnpackStack() function helper
https://hg.python.org/cpython/rev/3bf78c286daf

New changeset 905e902bd47e by Victor Stinner in branch 'default':
Argument Clinic: Use METH_FASTCALL for boring positionals
https://hg.python.org/cpython/rev/905e902bd47e

New changeset 52acda52b353 by Victor Stinner in branch 'default':
Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
https://hg.python.org/cpython/rev/52acda52b353

--

___
Python tracker 

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



[issue29289] Convert OrderedDict methods to Argument Clinic

2017-01-16 Thread INADA Naoki

INADA Naoki added the comment:

LGTM, except pop().

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

> Additionally, there are not enough METH_FASTCALL CFunctions.

I pushed many changes tonight which convert many C functions to METH_FASTCALL.


> ..., by hand or by AC.

IMHO performance is a good motivation to convert code to Argument Clinic ;-) 
But sometimes, AC can be painful, so by hand is also acceptable ;-)

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 2:

* Add slot_tp_fastcall(): __call__() wrapper using the FASTCALL calling 
convention
* Add Py_TPFLAGS_HAVE_FASTCALL flag
* Remove completely the "cached args" optimization from property_descr_get()
* Rebase the patch serie on top of the default branch to benefit of recent 
changes related to FASTCALL

I'm not sure that the Py_TPFLAGS_HAVE_FASTCALL flag is used correctly. Maybe 
this new flag disabled optimizations in some cases, I didn't read carefully 
this part of the code.

--
Added file: http://bugs.python.org/file46309/tp_fastcall-2.patch

___
Python tracker 

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



[issue29289] Convert OrderedDict methods to Argument Clinic

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9f7d16266928 by Victor Stinner in branch 'default':
Convert some OrderedDict methods to Argument Clinic
https://hg.python.org/cpython/rev/9f7d16266928

--
nosy: +python-dev

___
Python tracker 

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



[issue29289] Convert OrderedDict methods to Argument Clinic

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Raymond: " The argument clinic doesn't cope well with optional arguments 
without a default value."

Right, it's a bug in AC. I will try to fix it later. In the meanwhile, I pushed 
the first uncontroversal part.

--

___
Python tracker 

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



[issue29289] Convert OrderedDict methods to Argument Clinic

2017-01-16 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I missed Naoki's comment on the review :-/ I got the notification of this 
review after I pushed the change. I will fix the docstring later.

--

___
Python tracker 

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



[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Steven D'Aprano

New submission from Steven D'Aprano:

argparse help incorrectly breaks long lines on U+u00A0 NO-BREAK SPACE.

The attached script has been run on Python 3.5.3rc1 in a terminal window 80 
columns wide, and it produces output::

usage: argparse_nobreak.py [-h] [--no-condensed]

optional arguments:
  -h, --help  show this help message and exit
  --no-condensed  Disable default font-style: condensed. Also disables 
"M+
  1M" condensed monospace.


I expected the last line should have broken just before the "M+ 1M", rather 
than in the middle.

See also #20491.

--
components: Library (Lib)
files: argparse_nobreak.py
messages: 285607
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: argparse breaks long lines on NO-BREAK SPACE
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file46310/argparse_nobreak.py

___
Python tracker 

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



[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Steven D'Aprano

Changes by Steven D'Aprano :


Removed file: http://bugs.python.org/file46310/argparse_nobreak.py

___
Python tracker 

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



[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Here's a slightly simpler demo, without the (fortunately harmless) typo.

--
Added file: http://bugs.python.org/file46311/argparse_nobreak.py

___
Python tracker 

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



[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Martin Panter

Martin Panter added the comment:

Maybe a duplicate of Issue 16623

--
nosy: +martin.panter

___
Python tracker 

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



[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Xiang Zhang

Xiang Zhang added the comment:

textwrap has been fixed in #20491 but this problem still exists. The reason 
seems to be that argparse replaces the non-break spaces with spaces:

before self.whitespace_matcher.sub
'Disable default font-style: condensed.  Also disables "M+\\xa01M" condensed 
monospace.'
after self.whitespace_matcher.sub
'Disable default font-style: condensed. Also disables "M+ 1M" condensed 
monospace.'

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Xiang Zhang

Xiang Zhang added the comment:

I think this is a regression when coming to 3.x. In 2.7, r'\s+' is by default 
in ASCII mode and won't match unicode non-breaking spaces. In 3.x it's by 
default unicode mode so non-breaking spaces are replaced by spaces. I think we 
can just use [ \t\n\r\f\v]+.

Since here are more active core devs I am going to close #16623 and move this 
forward here.

--
keywords: +patch
nosy: +paul.j3, roysmith, serhiy.storchaka
versions: +Python 3.6, Python 3.7
Added file: 
http://bugs.python.org/file46312/argparse-help-non-breaking-spaces.patch

___
Python tracker 

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



[issue16623] argparse help formatter does not honor non-breaking space

2017-01-16 Thread Xiang Zhang

Xiang Zhang added the comment:

#29290 reports the same problem as here.

--
nosy: +xiang.zhang
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
superseder:  -> argparse breaks long lines on NO-BREAK SPACE

___
Python tracker 

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



[issue16623] argparse help formatter does not honor non-breaking space

2017-01-16 Thread Xiang Zhang

Xiang Zhang added the comment:

Ahh, sorry. I made a mistake. It's not the same as 29290. This is about 2.7. 
Although #20491 is closed but 2.7 seems not patched. Nosy Serhiy.

--
nosy: +serhiy.storchaka
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
superseder: argparse breaks long lines on NO-BREAK SPACE -> 

___
Python tracker 

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



[issue29286] Use METH_FASTCALL in str methods

2017-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, I have wrote almost the same patch before going to sleep yesteday! ;)  But 
the building crashed (likely due to a bug in _PyStack_UnpackDict()) and it was 
too late to resolve this.

I would prefer to rename "l" to "nargs" in PyArg_UnpackStack_impl and don't use 
upper case and namespace prefix in static functions.

--

___
Python tracker 

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



[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2017-01-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry INADA but I think this is all a foolish and inconsequential optimization 
that complicates the code in a way that isn't worth it (saving only a 1/2 
millisecond in a single import. Also, we don't want the argument clinic code to 
start invading the pure python code which is used by other Python 
implementations.

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue29011] No entry Deque in typing.py

2017-01-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue29011] No entry Deque in typing.py

2017-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dfefbf6f6c73 by Raymond Hettinger in branch '3.5':
Issue #29011:  Fix an important omission by adding Deque to the typing module.
https://hg.python.org/cpython/rev/dfefbf6f6c73

--
nosy: +python-dev

___
Python tracker 

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



[issue16623] argparse help formatter does not honor non-breaking space

2017-01-16 Thread Mark Lawrence

Changes 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



[issue29029] Faster positional arguments parsing in PyArg_ParseTupleAndKeywords

2017-01-16 Thread INADA Naoki

INADA Naoki added the comment:

LGTM again.

--

___
Python tracker 

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