[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 24bff360c2aa6d52f7a40ef35a5d7e5660d13402 by Benjamin Peterson in 
branch '3.6':
gc types needs to be allocated as such (closes #29398)
https://github.com/python/cpython/commit/24bff360c2aa6d52f7a40ef35a5d7e5660d13402

New changeset 9e499c39bc298b0803033b0ccbc79481cc60054c by Benjamin Peterson in 
branch '3.6':
merge 3.5 (#29398)
https://github.com/python/cpython/commit/9e499c39bc298b0803033b0ccbc79481cc60054c


--

___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 24bff360c2aa6d52f7a40ef35a5d7e5660d13402 by Benjamin Peterson in 
branch 'master':
gc types needs to be allocated as such (closes #29398)
https://github.com/python/cpython/commit/24bff360c2aa6d52f7a40ef35a5d7e5660d13402

New changeset 9e499c39bc298b0803033b0ccbc79481cc60054c by Benjamin Peterson in 
branch 'master':
merge 3.5 (#29398)
https://github.com/python/cpython/commit/9e499c39bc298b0803033b0ccbc79481cc60054c

New changeset 123c453b3beb505a46d4708d811f7f52d1d5793c by Benjamin Peterson in 
branch 'master':
merge 3.6 (#29398)
https://github.com/python/cpython/commit/123c453b3beb505a46d4708d811f7f52d1d5793c


--

___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29398] memory corruption in xxlimited

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 24bff360c2aa6d52f7a40ef35a5d7e5660d13402 by Benjamin Peterson in 
branch '3.5':
gc types needs to be allocated as such (closes #29398)
https://github.com/python/cpython/commit/24bff360c2aa6d52f7a40ef35a5d7e5660d13402


--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread INADA Naoki

INADA Naoki added the comment:

I'm running pyperformance.

BTW, hashlib doesn't provide siphash24.  So can we simply replace siphash24 
with siphash13, like ruby?
https://github.com/ruby/ruby/commit/04c94f95d1a1c6a12f5412228a2bcdc00f5de3b2

--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Manuel Krebber

Manuel Krebber added the comment:

One question I was wondering about is whether those types should be checked by 
inspect.isroutine() as well.

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Christian Heimes

Christian Heimes added the comment:

PEP 456 defines an API to add more hashing algorithms and make the selection of 
hash algorithm a compile time option. We can easily add SipHash-1-3 and make it 
the default algorithm. Vendors then can select between FNV2, SipHash-1-3 and 
SipHash-2-4.

On another note should we add SipHash-2-4 and 1-3 PRF to the hashlib mode?

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread INADA Naoki

INADA Naoki added the comment:

$ ../python.default -m perf compare_to default.json patched4.json -G
Slower (2):
- scimark_sor: 479 ms +- 8 ms -> 485 ms +- 9 ms: 1.01x slower (+1%)
- genshi_xml: 196 ms +- 2 ms -> 196 ms +- 2 ms: 1.00x slower (+0%)

Faster (19):
- json_loads: 62.7 us +- 0.5 us -> 61.5 us +- 1.1 us: 1.02x faster (-2%)
- django_template: 402 ms +- 3 ms -> 395 ms +- 4 ms: 1.02x faster (-2%)
- logging_format: 36.6 us +- 0.5 us -> 36.1 us +- 0.4 us: 1.01x faster (-1%)
- xml_etree_generate: 277 ms +- 5 ms -> 274 ms +- 5 ms: 1.01x faster (-1%)
- sympy_str: 461 ms +- 5 ms -> 456 ms +- 3 ms: 1.01x faster (-1%)
- call_method_unknown: 16.6 ms +- 1.2 ms -> 16.4 ms +- 0.2 ms: 1.01x faster 
(-1%)
- raytrace: 1.31 sec +- 0.02 sec -> 1.30 sec +- 0.01 sec: 1.01x faster (-1%)
- python_startup_no_site: 9.81 ms +- 0.02 ms -> 9.74 ms +- 0.02 ms: 1.01x 
faster (-1%)
- python_startup: 16.2 ms +- 0.0 ms -> 16.1 ms +- 0.0 ms: 1.01x faster (-1%)
- logging_simple: 31.2 us +- 0.3 us -> 31.0 us +- 0.4 us: 1.01x faster (-1%)
- 2to3: 742 ms +- 4 ms -> 739 ms +- 4 ms: 1.00x faster (-0%)
- hexiom: 22.7 ms +- 0.2 ms -> 22.6 ms +- 0.2 ms: 1.00x faster (-0%)
- call_simple: 14.2 ms +- 0.5 ms -> 14.2 ms +- 0.2 ms: 1.00x faster (-0%)
- sympy_integrate: 46.2 ms +- 0.3 ms -> 46.1 ms +- 0.4 ms: 1.00x faster (-0%)
- regex_compile: 434 ms +- 4 ms -> 433 ms +- 4 ms: 1.00x faster (-0%)
- deltablue: 17.7 ms +- 0.2 ms -> 17.7 ms +- 0.2 ms: 1.00x faster (-0%)
- chaos: 299 ms +- 3 ms -> 299 ms +- 3 ms: 1.00x faster (-0%)
- call_method_slots: 14.6 ms +- 0.2 ms -> 14.6 ms +- 0.1 ms: 1.00x faster (-0%)
- regex_dna: 283 ms +- 3 ms -> 283 ms +- 2 ms: 1.00x faster (-0%)

Benchmark hidden because not significant (43)


I'm creating siphash13 from reference implementation to double check the output.

--
keywords: +patch
Added file: http://bugs.python.org/file46476/siphash13.patch

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread INADA Naoki

INADA Naoki added the comment:

> PEP 456 defines an API to add more hashing algorithms and make the selection 
> of hash algorithm a compile time option. We can easily add SipHash-1-3 and 
> make it the default algorithm. Vendors then can select between FNV2, 
> SipHash-1-3 and SipHash-2-4.

OK, I'll add siphash13, instead of replacing siphash24.

> On another note should we add SipHash-2-4 and 1-3 PRF to the hashlib mode?

siphash implementation uses 64bit unit.
I don't know how to implement partial update like: m.update(b'foo'); 
b.update(b'bar')

--

___
Python tracker 

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



[issue29397] linux/random.h present but cannot be compiled

2017-02-01 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Could you upload a copy of config.log?

Also added developers that play in random.h games

--
components: +Build
nosy: +Chi Hsuan Yen, benjamin.peterson, haypo

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Guido, I attach the full patch now, as you asked.

(Initially I was not sure about tests, but now I understand more these types, 
so that I added even few more tests than in original patch)

> Maybe we need to wait for the github migration to complete though?

I think it is OK to merge this now, but if it would be easier for you then it 
is not a problem to wait until GH migration is complete.

Manuel, I think that probably the answer is yes, but I would prefer a separate 
issue for the inspect module. You could open a new issue and mention this one 
as a dependency.

--
Added file: http://bugs.python.org/file46477/combined-patch-full-total.diff

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Christian Heimes

Christian Heimes added the comment:

I added SipHash13 as additional hash algorithm in 
https://github.com/tiran/cpython/tree/siphash13 . Still need to verify the 
finalizer.

For hashlib I'd need to move to a different implementation of SipHash. The 
implementation in pyhash.c is optimized for speed and has a fixed key.

--

___
Python tracker 

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



Re: [issue29410] Moving to SipHash-1-3

2017-02-01 Thread M.-A. Lemburg
On 01.02.2017 10:14, Christian Heimes wrote:
> 
> PEP 456 defines an API to add more hashing algorithms and make the selection 
> of hash algorithm a compile time option. We can easily add SipHash-1-3 and 
> make it the default algorithm. Vendors then can select between FNV2, 
> SipHash-1-3 and SipHash-2-4.

+1 on adding the 1-3 and making it the default; the faster
the better. Hash speed for strings needs to be excellent in Python
due to the many dict lookups we use in the interpreter.

Reading up a bit on the Rust thread and looking at this benchmark
which is mentioned in the thread:

https://imgur.com/5dKecOW

it seems as if it would make sense to not use a fixed
hash algorithm for all strings lengths, but instead a
hybrid one to increase performance for short strings
(which are used a lot in Python).

Is there a good hash algorithm with provides better
performance for short strings than siphash ?

> On another note should we add SipHash-2-4 and 1-3 PRF to the hashlib mode?

+1 as well.

-- 
Marc-Andre Lemburg
eGenix.com

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread INADA Naoki

INADA Naoki added the comment:

> it seems as if it would make sense to not use a fixed
> hash algorithm for all strings lengths, but instead a
> hybrid one to increase performance for short strings
> (which are used a lot in Python).
>
> Is there a good hash algorithm with provides better
> performance for short strings than siphash ?

There is undocumented option "Py_HASH_CUTOFF" to use DJBX33A for short string.

See https://github.com/python/cpython/blob/master/Include/pyhash.h#L98

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The performance of hash algorithm shouldn't affect general benchmarks since 
hash value is cached inside string object. Almost all dict lookups in critical 
parts are lookups with interned strings. But in corner cases the difference can 
be measurable. We should look not on results of macrobenchmarks, but find worst 
cases.

There is also an alignment issue with the implementation of SipHash-2-4 (and I 
suppose with SipHash-1-3). See issue28055.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 01.02.2017 10:50, INADA Naoki wrote:
> 
>> it seems as if it would make sense to not use a fixed
>> hash algorithm for all strings lengths, but instead a
>> hybrid one to increase performance for short strings
>> (which are used a lot in Python).
>>
>> Is there a good hash algorithm with provides better
>> performance for short strings than siphash ?
> 
> There is undocumented option "Py_HASH_CUTOFF" to use DJBX33A for short string.
> 
> See https://github.com/python/cpython/blob/master/Include/pyhash.h#L98

Thanks. I found a reference in the PEP 456:

"""
...
However a fast function like DJBX33A is not as secure as SipHash24. A
cutoff at about 5 to 7 bytes should provide a decent safety margin and
speed up at the same time. The PEP's reference implementation provides
such a cutoff with Py_HASH_CUTOFF . The optimization is disabled by
default for several reasons. For one the security implications are
unclear yet and should be thoroughly studied before the optimization is
enabled by default. Secondly the performance benefits vary. On 64 bit
Linux system with Intel Core i7 multiple runs of Python's benchmark
suite [pybench] show an average speedups between 3% and 5% for
benchmarks such as django_v2, mako and etree with a cutoff of 7.
Benchmarks with X86 binaries and Windows X86_64 builds on the same
machine are a bit slower with small string optimization.

The state of small string optimization will be assessed during the beta
phase of Python 3.4. The feature will either be enabled with appropriate
values or the code will be removed before beta 2 is released.
"""

The mentioned speedup sounds like enabling this by default
would make a lot of sense (keeping the compile time option of
setting Py_HASH_CUTOFF to 0).

Aside: I haven't been following this since the days I proposed the
collision counting method as solution to the vulnerability, which was
rejected at the time. It's interesting how much effort went into
trying to fix the string hashing in dicts over the years. Yet the
much easier to use integer key hash collisions have still not
been addressed.

--

___
Python tracker 

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



[issue29404] "TypeError: 'int' does not have the buffer interface" on memoryview over bytearray

2017-02-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +benjamin.peterson, skrah

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 01.02.2017 11:07, Serhiy Storchaka wrote:
> 
> The performance of hash algorithm shouldn't affect general benchmarks since 
> hash value is cached inside string object. Almost all dict lookups in 
> critical parts are lookups with interned strings. But in corner cases the 
> difference can be measurable. We should look not on results of 
> macrobenchmarks, but find worst cases.

Good point.

--

___
Python tracker 

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



[issue29402] Problem with Checkbutton and duplicate last name components

2017-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The variable option of the checkbutton widget specifies the name of a global 
variable to set to indicate whether or not this button is selected. It defaults 
to the name of the button within its parent (i.e. the last element of the 
button window's path name).

There are two workarounds: specify either name or variable arguments explicitly.

There can be similar issues with other widgets.

--
components: +Library (Lib), Tkinter

___
Python tracker 

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



[issue29411] Option --executable for entry_points

2017-02-01 Thread Michal Cyprian

New submission from Michal Cyprian:

1. python3 setup.py build --executable="/usr/bin/binary"
2. python3 setup.py install -O1 --skip-build

These two commands are typically used to build and install Python packages from 
sources. Let's assume there is a setup.py script of package foo, containing a 
script foo. The --executable option of build command (1) should set the shebang 
of the script foo to #!/usr/bin/binary. The problem is that this option doesn't 
work for scripts listed in setup.py as entry_points, which is the most common 
way of handling scripts these days.

The idea of the original design was probably to pass the value of --executable 
to the build_scripts command and set shebang there. However, this command is 
not executed if the package contains only entry_points.

The scripts listed as entry_points are processed during execution of the 
install command (2) (specifically, in the easy_install command), which is 
completely isolated from the build command (1) and doesn't have access to the 
value specified in the --executable option.

The only reasonable solution that came to my mind was to add the --executable 
option to the install command as well, pass it to the easy_install command and 
make the ScriptWriter class use this value.

I prepared a patch that fixes this issue in setuptools [1]. To make it work, a 
small patch [2] will have to be applied to distutils as well.
Would this or something similar be acceptable for distutils?

I've already sent this proposal to pypa-dev mailing list, they replied that 
patch will be useful. The patch [2] needs to go to distutils first, to make 
patch for setuptools work.


[1] 
https://github.com/mcyprian/python-setuptools/blob/system-python/add-executable-option.patch
[2] 
https://github.com/mcyprian/python-setuptools/blob/system-python/add-executable-option.patch

--
components: Distutils
messages: 286612
nosy: Michal Cyprian, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Option --executable for entry_points
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, 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



[issue27647] Update Windows build to Tcl/Tk 8.6.6

2017-02-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

AFAIK, the Windows x.y compiled release and installer is normally updated to 
the latest stable tcl/tk, about the time of beta 1, and never changed for 
bugfix releases.  2.7 was an exception because of its long life and because 
later 8.5.z releases has some critical bugfixes, such as working with European 
keyboards.

I believe the current OSX binary compiles _tkinter against tcl/tk 8.5, and we 
recommend replacing the Apple's old 8.5 with the latest 8.5 from ActiveState, 
and that people who instead install ActiveState 8.6 have to make or obtain a 
new Python binary that compiles _tkinter for 8.6. (Prior to Py3.6, there was 
also a Mac release for older Macs, and it was compiled for tcl/tk 8.4.)

We don't compile Python on *nix and there are multiple versions of tcl/tk in 
use.  I would prefer to have the latest tcl/tk at least for bugfixes, and a 
Python binary that can use if, even if tkinter does not give access to the 
latest tk features.

--

___
Python tracker 

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



[issue27647] Update Windows 2.7 build to Tcl/Tk 8.5.19

2017-02-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I changed title to match what might and, I think, should happen.

My take: x.y is normally followed within 2 years by x.(y+1), which on Windows 
includes the latest tcl/tk.  So, on Windows, anyone who wants the new tcl/tk 
can upgrade to the newer Python.  For 2.7, there will be no 2.8 with newer 
tcl/tk.  So we updated tcl/tk once already within 2.7 and it seems time to do 
so again.  If there are more 8.5 bugfixes before the last 2.7 release in 2020, 
we should do so a third time.

--
title: Update Windows build to Tcl/Tk 8.6.6 -> Update Windows 2.7 build to 
Tcl/Tk 8.5.19

___
Python tracker 

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



[issue27647] Update Windows 2.7 build to Tcl/Tk 8.5.19

2017-02-01 Thread Terry J. Reedy

Changes by Terry J. Reedy :


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



[issue27200] make doctest in CPython has failures

2017-02-01 Thread Marco Buttu

Marco Buttu added the comment:

Thank you Raymond for your time. I just want to note that  does not 
distrac the reader, because it is not show in the output. Furthermore, to 
doctest an example we do not need to add the prompt (>>>): we can use the 
testcode/testoutput Sphinx directives.

--

___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7b279c263708 by doko in branch '3.5':
Issue #29169: Fix NEWS entry.
https://hg.python.org/cpython/rev/7b279c263708

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread INADA Naoki

INADA Naoki added the comment:

Current Py_HASH_CUTOFF implementation seems weak.
```
switch(len) {
/* ((hash << 5) + hash) + *p == hash * 33 + *p */
case 7: hash = ((hash << 5) + hash) + *p++; /* fallthrough */
...
case 1: hash = ((hash << 5) + hash) + *p++; break;
default:
assert(0);
}
hash ^= len;
hash ^= (Py_uhash_t) _Py_HashSecret.djbx33a.suffix;
x = (Py_hash_t)hash;
```

HashSecret used at last.  Conflicting pair without secret conflict with secrets 
too.

```
>>> def djbx33a(bs):
... h = 5381
... for i in bs:
... h = h*33+i
... h ^= len(bs)
... h ^~ secret
... return h & 0x___
...
>>> for i in [0, 3, 7]: # range(8)
...   for j in [0, 4, 7]: # range(8)
... for k in [0, 5, 7]: # range(8)
...   print(i,j,k, djbx33a([7-i, 7-j+33*i, 7-k+33*j, 33*k]))
...
0 0 0 6381700318
0 0 5 6381700318
0 0 7 6381700318
0 4 0 6381700318
...
7 4 7 6381700318
7 7 0 6381700318
7 7 5 6381700318
7 7 7 6381700318
>>>
```

So there are 8^(Py_HASH_CUTOFF-1) conflicting sequence can be built.

Maybe, we should remove Py_HASH_CUTOFF completely?

--

___
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-02-01 Thread Christopher Schramm

Christopher Schramm added the comment:

This issue should have a much higher priority as it basically breaks Python 
embedding unless the user either does not re-initialize the interpreter or 
avoid the use of _datetime.strptime.

We're currently testing with a patch based on Christian and Alexander's idea 
but using m_free as using m_clear and Py_CLEAR neither makes sense to me nor 
did it work in conjunction with Py_Finalize when testing it. A version matching 
the current tip is attached. We did not run into any issues so far (and the 
only thing I can think of is clearing the static variable too often and thus 
causing some extra imports).

--
Added file: http://bugs.python.org/file46478/27400.patch

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Christian Heimes

Christian Heimes added the comment:

Py_HASH_CUTOFF was an experimental feature for low-performance platforms. On 
modern hardware the performance increase is marginal to non-existing. I planned 
to deprecate the feature in 3.6 but forgot. We can deprecate it now and remove 
it in either 3.7 or 3.8.

--

___
Python tracker 

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



[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Gareth Rees

Gareth Rees added the comment:

Is there any chance of making progress on this issue? Is there anything wrong 
with my patch? Did I omit any relevant point in my message of 2016-06-11 16:26? 
It would be nice if this were not left in limbo for another four years.

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 01.02.2017 13:03, INADA Naoki wrote:
> Maybe, we should remove Py_HASH_CUTOFF completely?

I think we ought to look for a better hash algorithm
for short strings, e.g. a CRC based one.

Some interesting investigations on this:
http://www.orthogonal.com.au/computers/hashstrings/
http://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed

PS: It may also be wise not to use the hash randomization
with these, since the secret would leak. Again, collision
counting comes to mind, since for short strings it is much
more important to have a good bucket distribution than
crypto security to protect hash secrets :-)

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Christian Heimes

Christian Heimes added the comment:

We can and should still use hash randomization for short strings, but a 
different key than for hash randomization for longer strings.

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread INADA Naoki

INADA Naoki added the comment:

Py_HASH_CUTOFF uses different secret from siphash already.
The problem is the secret doesn't affects to collision at all.

Attacker can produce large number of collision, without knowing the secret.

BTW, we have FNV already.  Let's survey about FNV-1 short string collisions.

--

___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread INADA Naoki

INADA Naoki added the comment:

https://emboss.github.io/blog/2012/12/14/breaking-murmur-hash-flooding-dos-reloaded/

Murmur may be safe for <16 byte too.

--

___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 7c1f136e83fe9a145f509b27417a8dd2a37ac27c by doko in branch '3.6':
Issue #29169: Fix NEWS entry.
https://github.com/python/cpython/commit/7c1f136e83fe9a145f509b27417a8dd2a37ac27c


--

___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
stage:  -> resolved

___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 7c1f136e83fe9a145f509b27417a8dd2a37ac27c by doko in branch '3.5':
Issue #29169: Fix NEWS entry.
https://github.com/python/cpython/commit/7c1f136e83fe9a145f509b27417a8dd2a37ac27c


--

___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 7c1f136e83fe9a145f509b27417a8dd2a37ac27c by doko in branch 
'master':
Issue #29169: Fix NEWS entry.
https://github.com/python/cpython/commit/7c1f136e83fe9a145f509b27417a8dd2a37ac27c


--

___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29169] update zlib to 1.2.11

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29410] Moving to SipHash-1-3

2017-02-01 Thread Christian Heimes

Christian Heimes added the comment:

Unless somebody is able to show a real-world example with a considerable 
performance boost (>5%), I'm strictly against any kind of special casing for 
short strings. I don't want to trade security for performance. You might be 
able to persuade me to go for a more complex system, when you can both proof 
security and performance boost.

--

___
Python tracker 

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



[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Summary of overt and implied votes:
Core Devs:
+1 Mark Dickenson
+1 Ethan Furman
?? Serhiy Storchaka
-1 Alexander Belopolsky (at first, but unclear after)

Other:
+1 Ryan Gonzales, quoting Guido about equivalence of ints and longs.

The sys.exit docstring says "If the status is an integer, it will be used as 
the system exit status."  In 2.7, 'integer' clearly includes longs.

Does anyone know the Windows equivalent of 'echo $?'?

Gareth, I think the problem is that this is a minor 2.7-only, non-security 
issue and therefore a low priority for most Core Devs.

--

___
Python tracker 

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



[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Gareth Rees

Gareth Rees added the comment:

In Windows, under cmd.exe, you can use %errorlevel%

--

___
Python tracker 

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



[issue29412] IndexError thrown on email.message.M

2017-02-01 Thread Joel Uckelman

New submission from Joel Uckelman:

Test case:

  import email
  import email.policy
 
  txt = '''From: juckel...@strozfriedberg.co.uk
  To: (Recipient list suppressed)
  Date: Thu, 22 Aug 2013 04:13:02 +
  Subject: ADSF-1082
 
  Hey!
  '''
 
  msg = email.message_from_string(txt)
  msg.get('to')
  msg = email.message_from_string(txt, policy=email.policy.default)
  msg.get('to')

The second msg.get() throws an IndexError:

  Traceback (most recent call last):
File "test.py", line 16, in 
  print(msg.get('to'))# throws IndexError
File "/usr/lib64/python3.5/email/message.py", line 472, in get
  return self.policy.header_fetch_parse(k, v)
File "/usr/lib64/python3.5/email/policy.py", line 153, in header_fetch_parse
  return self.header_factory(name, ''.join(value.splitlines()))
File "/usr/lib64/python3.5/email/headerregistry.py", line 586, in __call__
  return self[name](name, value)
File "/usr/lib64/python3.5/email/headerregistry.py", line 197, in __new__
  cls.parse(value, kwds)
File "/usr/lib64/python3.5/email/headerregistry.py", line 337, in parse
  kwds['parse_tree'] = address_list = cls.value_parser(value)
File "/usr/lib64/python3.5/email/headerregistry.py", line 328, in 
value_parser
  address_list, value = parser.get_address_list(value)
File "/usr/lib64/python3.5/email/_header_value_parser.py", line 2336, in 
get_address_list
  token, value = get_address(value)
File "/usr/lib64/python3.5/email/_header_value_parser.py", line 2313, in 
get_address
  token, value = get_group(value)
File "/usr/lib64/python3.5/email/_header_value_parser.py", line 2269, in 
get_group
  token, value = get_display_name(value)
File "/usr/lib64/python3.5/email/_header_value_parser.py", line 2095, in 
get_display_name
  token, value = get_phrase(value)
File "/usr/lib64/python3.5/email/_header_value_parser.py", line 1770, in 
get_phrase
  token, value = get_word(value)
File "/usr/lib64/python3.5/email/_header_value_parser.py", line 1745, in 
get_word
  if value[0]=='"':
  IndexError: string index out of range

The docs say that email.policy.default has raise_on_defect set to False, hence 
parse errors ought to be reported via EmailMessage.defects, not by throwing an 
exception.

--
components: email
messages: 286631
nosy: barry, r.david.murray, uckelman
priority: normal
severity: normal
status: open
title: IndexError thrown on email.message.M
type: behavior
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



[issue29412] IndexError thrown on email.message.EmailMessage.get

2017-02-01 Thread Joel Uckelman

Changes by Joel Uckelman :


--
title: IndexError thrown on email.message.M -> IndexError thrown on 
email.message.EmailMessage.get

___
Python tracker 

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



[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

2017-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Count me as +1. The patch LGTM.

See also issue28998.

--

___
Python tracker 

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



[issue29412] IndexError thrown on email.message.EmailMessage.get

2017-02-01 Thread R. David Murray

R. David Murray added the comment:

Does the patch from issue 27931 fix your problem as well?  I haven't looked 
closely enough to see if I think it should, I'm just hoping :)

--

___
Python tracker 

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



[issue27051] Create PIP gui

2017-02-01 Thread Nick Coghlan

Nick Coghlan added the comment:

Rather than "rejected" per se, I've closed this as "postponed" - I still think 
there's potential value in bundling a component management GUI in the future, 
but it should be *after* a project has established itself as the de facto 
introductory approach via PyPI.

--
resolution:  -> postponed
stage: test needed -> 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



[issue29412] IndexError thrown on email.message.EmailMessage.get

2017-02-01 Thread Joel Uckelman

Joel Uckelman added the comment:

No dice. I get the same exception with issue27931_v2.patch. I briefly looked at 
the other two, and don't expect those will help, either.

--

___
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-02-01 Thread Nick Coghlan

Nick Coghlan added the comment:

I've added Steve Dower to the nosy list, as he's done some work recently on 
making the Windows builds more embedding-friendly, and I believe at least some 
of that time may have been funded work.

Unfortunately, we don't currently have anyone I'm aware of that's being 
specifically paid to improve or maintain CPython's embedding support in 
general, so getting attention for these kinds of interpreter reinitialization 
bugs can be a bit hit-or-miss.

--
nosy: +steve.dower

___
Python tracker 

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



[issue24869] shlex lineno inaccurate with certain inputs

2017-02-01 Thread Gareth Rees

Gareth Rees added the comment:

Here's a patch that implements my proposal (1) -- under this patch, tokens read 
from an input stream belong to a subtype of str with startline and endline 
attributes giving the line numbers of the first and last character of the 
token. This allows the accurate reporting of error messages relating to a 
token. I updated the documentation and added a test case.

--
keywords: +patch
Added file: http://bugs.python.org/file46479/issue24869.patch

___
Python tracker 

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



[issue29412] IndexError thrown on email.message.Message.get

2017-02-01 Thread Joel Uckelman

Changes by Joel Uckelman :


--
title: IndexError thrown on email.message.EmailMessage.get -> IndexError thrown 
on email.message.Message.get

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 54fa95b19fae by Victor Stinner in branch 'default':
python-gdb.py supports method-wrapper
https://hg.python.org/cpython/rev/54fa95b19fae

--
nosy: +python-dev

___
Python tracker 

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



[issue29362] regrtest: don't fail immediately if a child does crash

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

Attached patch changes libregrtest to handle CHILD_ERROR as a normal result and 
continue the execution of following tests. As a result, it displays the test 
summary as usual on such crash.

--

Ammar Askar: Thanks for regrtest_crash.diff, but I prefer to execute other unit 
tests rather than exiting immediatly.

The --failfast option can be used with my patch to exit at the first crash or 
failure (with my patch, a crash is handled as a test failure).

--
Added file: http://bugs.python.org/file46480/regrtest_crashed.patch

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 30867b703933d6ba30bc5f609a1a2337925ead33 by Victor Stinner in 
branch 'master':
python-gdb.py supports method-wrapper
https://github.com/python/cpython/commit/30867b703933d6ba30bc5f609a1a2337925ead33


--

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
status: open -> closed

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ffd2e5f9256a by Victor Stinner in branch 'default':
Make test_gdb.test_wrapper_call() make reliable
https://hg.python.org/cpython/rev/ffd2e5f9256a

--

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
resolution:  -> fixed

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
stage:  -> resolved

___
Python tracker 

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



[issue29318] Optimize _PyFunction_FastCallDict() for **kwargs

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fcba9c9d987b by Victor Stinner in branch 'default':
Document that _PyFunction_FastCallDict() must copy kwargs
https://hg.python.org/cpython/rev/fcba9c9d987b

--
nosy: +python-dev

___
Python tracker 

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



[issue29318] Optimize _PyFunction_FastCallDict() for **kwargs

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

INADA Naoki: "Since mutating kw dict shouldn't affect caller's dict, caller and 
callee can't share the dict."

Oh, I knew that, it's not the first time that I propose to implement this 
optimization and that I got this answer !? So I added a comment for myself, to 
remind me not to propose this optimization anymore :-D

I close this issue.


Serhiy Storchaka: "In most cases kw is empty or very small. I doubt any 
optimization can have significant effect."

I have no opinion on Naoki's optimization idea.

Naoki: Feel free to implement your idea to measure the speedup, but please open 
a new issue for that if you consider that it's worth it.

FYI Naoki and me started to list ideas to optimize CPython 3.7:
http://faster-cpython.readthedocs.io/cpython37.html

--

___
Python tracker 

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



[issue29318] Optimize _PyFunction_FastCallDict() for **kwargs

2017-02-01 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue29311] Argument Clinic: convert dict methods

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

Thank you very much for the docstring enhancement Serhiy! I like your new 
docstrings.

It seems like all known issues are now fixed, so I close the issue. Thanks 
Naoki and Martin too for the reviews.

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



[issue29300] Modify the _struct module to use FASTCALL and Argument Clinic

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy: Would you mind to review my latest patch, struct_fastcall-6.patch? It 
should address all your remarks, except your proposal to write a converter for 
cache_struct(): see my previous comment about this idea. Thanks in advance ;)

--

___
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-02-01 Thread STINNER Victor

STINNER Victor added the comment:

Thanks again Serhiy for the better docstrings!

Known issues are now fixed, so I close the issue. Thanks for the review Naoki.

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



[issue29286] Use METH_FASTCALL in str methods

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

Recently, I saw complains that I push changes too fast without reviews. This 
issue is a good example. So let me elaborate myself a little bit on these 
changes.

I'm not really proud of the "Rename _PyArg_ParseStack to 
_PyArg_ParseStackAndKeywords" change. It should be called 
_PyArg_ParseStackAndKeywords() from the beginning, but when I designed 
FASTCALL, my plan was to only check arguments (positional and keyword 
arguments) in the callee, and remove checks in the caller. I expected that all 
functions will get positional + keyword arguments.

I didn't know that not accepting keywords but only positional arguments like in 
str.replace(), was a deliberate language design choice.

So yes, for functions accepting only positional arguments, _PyArg_ParseStack() 
+ _PyArg_NoStackKeywords() makes sense.

IMHO the implementation of the new _PyArg_ParseStack() and 
_PyArg_NoStackKeywords() functions was simple enough to avoid a review, they 
reuse existing code with minimum changes.

In general for FASTCALL, I only add private functions. I consider that it's ok 
to push code quickly, since the private property allows us to change these 
functions anytime.

Again, I consider that the "Argument Clinic: Use METH_FASTCALL for positionals" 
change is simple enough to avoid a review, I don't think that they are many 
ways to use FASTCALL for functions using positional-only parameters. I mean, I 
only see a single way to implement it. Again, if someone sees a new way to 
handle such parameters, we can change it anytime, Argument Clinic and FASTCALL 
are stil private.

More generally, FASTCALL requires a lot of tiny changes everywhere.

GitHub will allow to get reviews on long patch series. It will be easier to 
handle large changes.

--

___
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-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 758674087b12 by Victor Stinner in branch 'default':
Issue #29286: Rename private PyArg_UnpackStack_impl() to unpack_stack()
https://hg.python.org/cpython/rev/758674087b12

--

___
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-02-01 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka: "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."

Oh, sorry that you wrote almost the same code. Well, at least it means that we 
agree on the design :-)

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

Done.

--

___
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-02-01 Thread STINNER Victor

STINNER Victor added the comment:

str type still has a few methods using METH_VARARGS (slower than METH_FASTCALL):

* count()
* find()
* index()
* rfind()
* rindex()
* startswith()
* endswith()
* format()

Maybe I will propose a change later to convert these methods to Argument 
Clinic, but I consider that the initial issue "Currently, Argument Clinic 
doesn't use METH_FASTCALL for these methods, but METH_VARARGS" is now fixed, so 
I close the issue.

Thanks Naoki and Serhiy.

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



[issue29263] Implement LOAD_METHOD/CALL_METHOD for C functions

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

INADA Naoki: "Maybe, we should do: * Make clinic use more METH_FASTCALL * Use 
clinic more in builtin methods; before trying this optimization."

I created the issue #29286 "Use METH_FASTCALL in str methods" which is now 
fixed. I started to propose patches for other funnctions, types and modules.

Would you mind to rebase your loadmethod-fastcall.patch patch Naoki?

With my change 0b219348ec9e, I'm not sure that your change on 
methoddescr_call() is still needed.

I tried to rebase your change, but I failed to get the "1.10x faster" result. 
Maybe I did something wrong, maybe my change 0b219348ec9e already optimized 
method calls for C functions?

--

___
Python tracker 

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



[issue29260] Use designated initializers to define PyTypeObject types

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

The question was discussed on the python-dev mailing list:
[Python-Dev] Can we use "designated initializer" widely in core modules?
https://mail.python.org/pipermail/python-dev/2017-January/147154.html

I understood that it's ok to use them in new code, but not to convert existing 
code:

Guido van Rossum: "I'm against changing any existing code to use it -- such 
massive changes are high risk and low reward. Just do it for new fields or new 
types."
https://mail.python.org/pipermail/python-dev/2017-January/147175.html

So I close this issue.

Note: I rejected my changes to add new tp_fastnew, tp_fastinit and tp_fastcall 
slots, issues #29358 and #29259.

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



[issue29286] Use METH_FASTCALL in str methods

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 5910fd7231d34363798d2815be2f66909e638d1c by Victor Stinner in 
branch 'master':
Issue #29286: Rename private PyArg_UnpackStack_impl() to unpack_stack()
https://github.com/python/cpython/commit/5910fd7231d34363798d2815be2f66909e638d1c


--

___
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-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29318] Optimize _PyFunction_FastCallDict() for **kwargs

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 2c145e9eda756aa2001282d7c016e740dd00a2d7 by Victor Stinner in 
branch 'master':
Document that _PyFunction_FastCallDict() must copy kwargs
https://github.com/python/cpython/commit/2c145e9eda756aa2001282d7c016e740dd00a2d7


--

___
Python tracker 

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



[issue29318] Optimize _PyFunction_FastCallDict() for **kwargs

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
stage:  -> resolved

___
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-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 88835e6022a81d8107a296c9f6e5f16c7d39e27a by Victor Stinner in 
branch 'master':
Make test_gdb.test_wrapper_call() make reliable
https://github.com/python/cpython/commit/88835e6022a81d8107a296c9f6e5f16c7d39e27a


--

___
Python tracker 

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



[issue29318] Optimize _PyFunction_FastCallDict() for **kwargs

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
resolution: rejected -> fixed

___
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-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
stage:  -> resolved

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29318] Optimize _PyFunction_FastCallDict() for **kwargs

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

"The default branch is now as good as Python 3.4, in term of stack consumption, 
and Python 3.4 was the Python version which used the least stack memory 
according to my tests."

I consider that the initial issue is now fixed, so I close the issue.

Thanks Serhiy for the tests, reviews, ideas and obvious the bug report ;-) I 
never looked at the stack usage before.

--

___
Python tracker 

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



[issue29234] Disable inlining of _PyStack_AsTuple() to reduce the stack consumption

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

The initial issue has been fixed.

With the issue #28870 (msg285169): "The default branch is now as good as Python 
3.4, in term of stack consumption, and Python 3.4 was the Python version which 
used the least stack memory according to my tests."

Serhiy: As I wrote, for _PyStack_AsDict(), we need numbers to see if this 
function is inlined or not, and check its usage of the stack.

Since I consider that the stack usage is now low enough, I'm not interested to 
continue to investigate the stack usage. Feel free to continue the effort, but 
please open a new issue in this case.

I close the issue.

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



[issue29227] Reduce C stack consumption in function calls

2017-02-01 Thread STINNER Victor

STINNER Victor added the comment:

Victor: "I plan to run a benchmark when all my patches to reduce the stack 
consumption will be ready."

msg285200 of issue #28870: "I also ran the reliable performance benchmark suite 
with LTO+PGO. There is no significant performance change on these benchmarks 
(...)"

less_stack.patch:

-#define _PY_FASTCALL_SMALL_STACK 5
+#define _PY_FASTCALL_SMALL_STACK 3

With the issue #28870, reducing _PY_FASTCALL_SMALL_STACK value is no more 
needed. Larger _PY_FASTCALL_SMALL_STACK means better performances, so I prefer 
to keep the value 5 (arguments).

The main change, inline call_function(), was merged, so I close the issue.

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



[issue29300] Modify the _struct module to use FASTCALL and Argument Clinic

2017-02-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It looks to me that the type of the self parameter can be changed from 
PyObject* to PyStructObject*. This will make the patch larger but the final 
code simpler.

class Struct "PyStructObject *" "&PyStructType"

--

___
Python tracker 

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



  1   2   3   >