[issue34756] Few changes in sys.breakpointhook()

2018-09-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I will drop cleanup changes if they don't look good to you.

--

___
Python tracker 

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



[issue34735] Modules/timemodule.c: Memory leak in time_strftime()

2018-09-21 Thread miss-islington


miss-islington  added the comment:


New changeset f37496e893d743dbd01c802c8e8cdc16498a1604 by Miss Islington (bot) 
in branch '3.6':
bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
https://github.com/python/cpython/commit/f37496e893d743dbd01c802c8e8cdc16498a1604


--
nosy: +miss-islington

___
Python tracker 

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



[issue34735] Modules/timemodule.c: Memory leak in time_strftime()

2018-09-21 Thread miss-islington


miss-islington  added the comment:


New changeset 975f3cb1f25406a9be019906227d53b23852f415 by Miss Islington (bot) 
in branch '3.7':
bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
https://github.com/python/cpython/commit/975f3cb1f25406a9be019906227d53b23852f415


--

___
Python tracker 

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



[issue34670] Add set_post_handshake_auth for TLS 1.3

2018-09-21 Thread Christian Heimes


Christian Heimes  added the comment:

Please note that SSL_verify_client_post_handshake() doesn't perform any IO by 
itself.

A typical scenario for HTTP looks like this (actual flow may vary):

* client
  * send ``HTTP GET /path``
* server
  * recv
  * verify_client_post_handshake
  * send HTTP Connection Upgrade (emits CertRequest message)
* client
  * recv
  * send upgrade confirmation (emits Certificate, CertificateVerify, Finish 
message)
* server
  * recv
  * verify certificate
  * send payload or error (may emit TLS alert for unknown, invalid, or missing 
cert)
* client
  * recv (receive TLS alert or server response)

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue29013] zipfile: inconsistent doc for ZIP64 file size

2018-09-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This would look good too.

To be accurate, zipfile will create ZIP files that use the ZIP64 extensions 
when:

* It contains more than 65535 files.

* It is larger than 2 GiB. More accurate, when either the offset or the size of 
the central directory is larger than 2 GiB, so in theory it is possible to 
exceed the total size of 2 GiB without using ZIP64.

* The original size of any file is larger than 2 GiB.

I'm not sure we should describe the behavior in all details.

--

___
Python tracker 

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



[issue34760] Regression in abc in combination with issubclass

2018-09-21 Thread Christoph Glaubitz


New submission from Christoph Glaubitz :

I'm not sure if this is a bug, or a known breaking change. I didn't find 
anything related in the changelog, except for a rewrite of abc. But hovever, I 
want this to be documented.

In 3.7.0:

import abc
def f():
pass

class A(metaclass=abc.ABCMeta):
pass

issubclass(f, A)

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.7/abc.py", line 143, in __subclasscheck__
return _abc_subclasscheck(cls, subclass)
TypeError: issubclass() arg 1 must be a class


python up to 3.6 (including 2.7) happily return false.

Found real world usage in osc-lib
* 
https://github.com/openstack/osc-lib/blob/46e2fb0a58fc06cfce1bb535f432405767d6b78b/osc_lib/utils/__init__.py#L495
* https://storyboard.openstack.org/#!/story/2003322

--
messages: 325975
nosy: glaubich
priority: normal
severity: normal
status: open
title: Regression in abc in combination with issubclass
type: behavior
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



[issue34761] str(super()) != super().__str__()

2018-09-21 Thread Guillaume Dominici


New submission from Guillaume Dominici :

The super proxy does not seem to forward call to .__str__() when the call 
occurs via str() function.
It may be an expected behavior, but it looks unexpected to me.

Minimal reproduction (tested on Python 3.6, but I believe may newer versions 
have similar behavior):

class Parent():
  def __str__(self):
return "Parent"

class Child(Parent):
  def foo(self):
s = super(Child, self)
print(s.__str__())
print(str(s))


c = Child()
c.foo()

# Output :
### Parent
### , >

--
messages: 325976
nosy: Guillaume Dominici
priority: normal
severity: normal
status: open
title: str(super()) != super().__str__()
type: behavior
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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Christoph Glaubitz


Christoph Glaubitz  added the comment:

Maybe this is just how it should have been working the entire time, and osc is 
just holding it wrong.

Since:

class B:
pass

issubclass(f, B)

Traceback (most recent call last):
  File "", line 1, in 
TypeError: issubclass() arg 1 must be a class

... but:

issubclass(B, A)
False

--
title: Regression in abc in combination with issubclass -> Regression in abc in 
combination with passing a function to issubclass

___
Python tracker 

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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue34761] str(super()) != super().__str__()

2018-09-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is an expected behavior.

>From https://docs.python.org/3/library/functions.html#super:

Return a proxy object that delegates method calls to a parent or sibling 
class of type.

super() delegates explicit method calls. You shouldn't expect that it will 
delegate special methods called indirectly. For example, super() + 2 doesn't 
call super().__add__(2), and float(super()) doesn't call super().__float__().

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue34755] Few minor optimizations in _asynciomodule.c

2018-09-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue34735] Modules/timemodule.c: Memory leak in time_strftime()

2018-09-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

This was a conscious decision (i.e we decided that the old inconsistency is a 
bug). See https://bugs.python.org/issue33018 for previous discussion. What is 
your use case? If it is critical, we can reconsider this.

--

___
Python tracker 

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



[issue29013] zipfile: inconsistent doc for ZIP64 file size

2018-09-21 Thread Monte Davidoff


Monte Davidoff  added the comment:

I agree it may be better if we don't describe all the details of ZIP64. How 
about this rewording for the second change, so we don't have to give all the 
details?

(2) In the description of the zipfile.ZipFile class, change:

"If allowZip64 is True (the default) zipfile will create ZIP files that use the 
ZIP64 extensions when the zipfile is larger than 4 GiB."

to:

"If allowZip64 is True (the default) zipfile will create ZIP files that use the 
ZIP64 extensions when necessary, for example, when the zipfile is larger than 2 
GiB."

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
nosy: +izbyshev

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Eric V. Smith


Eric V. Smith  added the comment:

I agree with Raymond and Tim here: while it's inevitably true that there are 
many possible hash collisions, we'd need to see where the current algorithm 
caused real problems in real code. Pointing out a few examples where there was 
a collision isn't very helpful.

So, jdemeyer, if it's possible to show (or describe) to us an example of a 
problem you had, such that we could repeat it, that would be helpful (and 
necessary) to evaluate any proposed changes.  What were the inputs to hash() 
that caused a problem, and how did that problem manifest itself?

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> So, jdemeyer, if it's possible to show (or describe) to us an example of a 
> problem you had, such that we could repeat it, that would be helpful (and 
> necessary) to evaluate any proposed changes.  What were the inputs to hash() 
> that caused a problem, and how did that problem manifest itself?

In all honesty, I don't remember. This was a while ago and at that time I 
didn't care enough to put up a CPython bug report. Still, this is a collision 
for tuples of short length (3) containing small integers (0 and -2). Why do you 
find that contrived?

What prompted me to report this bug now anyway is that I discovered bad hashing 
practices for other classes too. For example, meth_hash in 
Objects/methodobject.c simply XORs two hashes and XOR tends to suffer from 
catastrophic cancellation. So I was hoping to fix tuple hashing as an example 
for other hash functions to follow.

--

___
Python tracker 

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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Christoph Glaubitz


Christoph Glaubitz  added the comment:

I just realized this while trying to use the openstack command line tools on 
python3.7. After reading issue33018 and the fact that even in python2

class B:
pass

def f():
pass

issubclass(f, B)

Traceback (most recent call last):
  File "", line 1, in 
TypeError: issubclass() arg 1 must be a class

... I am sure, the new behavior is the correct one. I would be totally fine 
with closing this issue, and hoping not too many code depend on the strange old 
behavior :)

--

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-09-21 Thread Nick Coghlan


Nick Coghlan  added the comment:

Correct - it won't change anything from 3.7.0, and even the original 
discrepancies relative to PEP 538 only affect applications that:

1. Are embedding a CPython runtime
2. *Aren't* already ensuring that they're running in a locale other than the C 
locale
3. Aren't able to set PYTHONCOERCECLOCALE=0 or LC_ALL=C in the environment 
prior to calling Py_Initialize() or Py_Main() in order to disable the locale 
coercion

(Because of the high quality of Victor's work on the UTF-8 mode implementation, 
it's practically impossible to externally distinguish between the behaviour of 
late coercion and the intended early coercion in the CPython CLI itself)

--
priority: release blocker -> normal

___
Python tracker 

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



[issue27903] Avoid ResourceWarnings from platform._dist_try_harder

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue27121] imghdr does not support jpg files with Lavc bytes

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue26767] Inconsistant error messages for failed attribute modification

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue26452] Wrong line number attributed to comprehension expressions

2018-09-21 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think there have been some improvements merged with 
https://bugs.python.org/issue12458 . I am not sure if the patch covers more 
cases. I ran the tests attached in the patch and some of them cause 
RuntimeError in master.

# bpo26452.py

def f():
return [j
for i in range(3)
if i]

f()

# Master 

./python.exe
Python 3.8.0a0 (heads/master:c510c6b8b6, Sep 21 2018, 11:10:24)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

./python.exe ../backups/bpo26452.py
Traceback (most recent call last):
  File "../backups/bpo26452.py", line 6, in 
f()
  File "../backups/bpo26452.py", line 2, in f
return [j
  File "../backups/bpo26452.py", line 2, in 
return [j
NameError: name 'j' is not defined


# Python 3.7

python3.7 ../backups/bpo26452.py
Traceback (most recent call last):
  File "../backups/bpo26452.py", line 6, in 
f()
  File "../backups/bpo26452.py", line 3, in f
for i in range(3)
  File "../backups/bpo26452.py", line 4, in 
if i]
NameError: name 'j' is not defined

# Tests

./python.exe ../backups/test26452.py
..F
==
FAIL: test_operators (__main__.TestPEP380Operation)
--
Traceback (most recent call last):
  File "../backups/test26452.py", line 21, in expect_line
f()
  File "../backups/test26452.py", line 98, in f
-
RuntimeError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../backups/test26452.py", line 100, in test_operators
self.expect_line(f, 3) # want 2
  File "../backups/test26452.py", line 26, in expect_line
self.assertEqual(relative_line, expected_relative_line)
AssertionError: 2 != 3

--
Ran 3 tests in 0.001s

FAILED (failures=1)


Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue26495] super() does not work in nested functions, genexps, listcomps, and gives misleading exceptions

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue26214] textwrap should minimize number of breaks in extra long words

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue24997] mock.call_args compares as equal and not equal

2018-09-21 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems this is not reproducible at least on Python 3.6.4 and Master branch.

# bpo24997.py

from unittest.mock import *

m = Mock()
m(1,2)
m.call_args
print("1 ", m.call_args == call(1,2))
print("2 ", m.call_args != call(1,2))


# Master

./python.exe
Python 3.8.0a0 (heads/master:c510c6b8b6, Sep 21 2018, 11:10:24)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
./python.exe ../backups/bpo24997.py
1  True
2  False

# Python 3.6.4

python3.6 ../backups/bpo24997.py
1  True
2  False


Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue25240] Stack overflow in reprlib causes a core dump

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue24828] Segfault when using store-context AST node in a load context

2018-09-21 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the script. The crash is still reproducible as of now with at least 
python 2.7.14 . I need to check on the latest 2.7 branch yet.

On python 3 it produces an error as below : 

Traceback (most recent call last):
  File "../backups/bpo24828.py", line 6, in 
code = compile(m, '', mode='exec')
ValueError: expression must have Load context but has Store instead

Crash report on Mac OS

MacOS/Python
Identifier:Python
Version:   2.7.14 (2.7.14)
Code Type: X86-64 (Native)
Parent Process:zsh [13087]
Responsible:   iTerm2 [230]
User ID:   501

Date/Time: 2018-09-21 18:13:27.072 +0530
OS Version:Mac OS X 10.10.4 (14E46)
Report Version:11
Anonymous UUID:BCB9DD4C-B310-CA87-7308-42F6715FDA83

Sleep/Wake UUID:   FA788657-D625-40D6-8701-16E042836F5F

Time Awake Since Boot: 24000 seconds
Time Since Wake:   14000 seconds

Crashed Thread:0  Dispatch queue: com.apple.main-thread

Exception Type:EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:   KERN_INVALID_ADDRESS at 0x

VM Regions Near 0:
--> 
__TEXT 0001075be000-0001075c [8K] r-x/rwx 
SM=COW  
/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.python.python   0x0001075fc8bb 
dict_set_item_by_hash_or_entry + 14
1   org.python.python   0x00010764fa63 PyEval_EvalFrameEx + 
14664
2   org.python.python   0x00010764bf29 PyEval_EvalCodeEx + 
1583
3   org.python.python   0x00010764b8f4 PyEval_EvalCode + 54
4   org.python.python   0x000107647fdc builtin_eval + 570
5   org.python.python   0x0001076527c8 PyEval_EvalFrameEx + 
26285
6   org.python.python   0x00010764bf29 PyEval_EvalCodeEx + 
1583
7   org.python.python   0x00010764b8f4 PyEval_EvalCode + 54
8   org.python.python   0x00010766f05d run_mod + 53
9   org.python.python   0x00010766f100 PyRun_FileExFlags + 
133
10  org.python.python   0x00010766ec4f 
PyRun_SimpleFileExFlags + 698
11  org.python.python   0x0001076805f9 Py_Main + 3137
12  libdyld.dylib   0x7fff9354a5c9 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0xc6079cb3d3de86bb  rbx: 0x0001077d3168  rcx: 0x  
rdx: 0xc6079cb3d3de86bb
  rdi: 0x0001077d3168  rsi: 0x0001078f4a08  rbp: 0x7fff586410d0  
rsp: 0x7fff586410c0
   r8: 0x   r9: 0x  r10: 0x0001  
r11: 0x0024e797
  r12: 0x000107871a00  r13: 0x000107871b70  r14: 0x0008  
r15: 0x0001078f4a08
  rip: 0x0001075fc8bb  rfl: 0x00010206  cr2: 0x


Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue25312] Cryptic error message if incorrect spec is set on a callable mock

2018-09-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
keywords: +patch
pull_requests: +8884
stage: resolved -> patch review

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Ned Deily


Change by Ned Deily :


--
nosy:  -ned.deily

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
nosy: +sir-sigurd

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-09-21 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue34722] Non-deterministic bytecode generation

2018-09-21 Thread Peter Ebden


Change by Peter Ebden :


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

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2018-09-21 Thread Vincent Jugé

Vincent Jugé  added the comment:

Dear all,

After me and my colleagues worked on the first paper you mention, I recently 
created another merge-based sorting algorithm, which I called "Adaptive Shivers 
Sort". This is a close variant of the Augmented Shivers Sort presented by Buss 
& Knop in their article
https://arxiv.org/abs/1801.04641

Like Munro & Wild's Powersort and Peeksort, this algorithm has an optimal 
worst-case running time (up to a linear additive constant) when measured with 
the merge cost model that is used in all the articles you cite in this 
discussion. It also maintains a stack of size log_2(n).
I could not prove such an optimality result for Buss & Knop Augmented Shivers 
Sort.

Custom tests that I had performed suggest that this algorithm is, in practice, 
as efficient as Munro & Wild's algorithms, and also does not suffer from 
critically bad cases.

Moreover, like Buss & Knop's 2-merge, and unlike Munro & Wild's Powersort and 
Peeksort, this algorithm has the advantage of having a structure that is very 
similar to that of Timsort, which may be an advantage in your situation.

That is why, upon reading your discussion, I refurbished my notes about 
Adaptive Shivers Sort, which you may find here:
http://igm.univ-mlv.fr/~juge/papers/shivers_arxiv.pdf

These notes include a description of the algorithm and a worst-time complexity 
analysis. If extending my analysis of this algorithm or investigating tuning 
details were of interest for you, I would be happy to help.

Best regards,

Vincent Jugé

--
nosy: +vincent.juge

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


New submission from Yury Selivanov :

Unfortunately, the current C API for PEP 567 has a flaw: it uses non-PyObject 
pointers.  

This causes problems with integrating with tools like Cython, where PyObject is 
special and a lot of machinery recognizes it and manages refcounts correctly.

It also goes against the recent push to improve C API; one of the things we 
want to fix is to eliminate non-PyObject pointer types from public APIs 
entirely.

Because this C API is new (landed in 3.7.0) I think it might make sense to 
change it in 3.7.1.  I *think* this is a relatively safe (albeit annoying) 
change:

1. I don't expect that a lot of people use this new C API.  I googled recently 
if anyone uses contextvars at all, and found that some people are using the 
Python API.  The only user of C API that I'm aware of is uvloop, which I'll be 
happy to fix.

2. My current understanding is that this change won't break existing extensions 
compiled against Python 3.7.0, as it's just a change in pointers' types.

3. For example, clang spits out the following *warning* if it sees mismatched 
pointer types (and still compiles the extension):

   warning: incompatible pointer types passing 'PyContextVar *' (aka
  'struct _pycontextvarobject *') to parameter of type 'PyObject *' (aka 
'struct _object *')
  [-Wincompatible-pointer-types]

4. This would make it slightly harder to create extension that supports both 
3.7.0 and 3.7.1 and compiles without warnings.  (It's possible to avoid 
warnings by adding some #ifdefs macro).

If we don't change this API now, we'll likely have to either live with it, or 
face a very slow deprecation period.

--
components: Interpreter Core
messages: 325989
nosy: ned.deily, yselivanov
priority: normal
severity: normal
status: open
title: Change contextvars C API to use PyObject
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


Change by Yury Selivanov :


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

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:

Just to add to this issue: I originally realized that something is wrong with 
the design when we had a super hard to track memory leak in uvloop, caused by 
Cython being unable to automatically manage increfs/decrefs for PyContext* 
pointers.  So I do believe this is a serious pitfall.

Adding Guido to the nosy list as he accepted the PEP and IMO still has a say in 
this.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread STINNER Victor


STINNER Victor  added the comment:

IMHO it's not too late to change the public C API in Python 3.7.1, since it's a 
very new API, I don't expect many users, and I only expect compiler warnings 
nor hard error if existing code pass PyContextVar* instead of PyObject*.

I agree that it's way better to use PyObject* rather than specific 
PyContextVar*. The C API should not leak implementation details ;-)

--
nosy: +vstinner

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread 草木建

New submission from 草木建 :

This is very easy issue.

丗 meanning is 30.(丗 is 0x4E17)
"丗".isnumeric() must returns true.
but "丗".isnumeric()  returns  False.

--
components: Unicode
messages: 325992
nosy: ezio.melotti, vstinner, 草木建
priority: normal
severity: normal
status: open
title: Python lacks 0x4E17
type: behavior
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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

Let’s change it ASAP. It’s still up to Ned whether to hold up 3.7.1, if he
won’t it should go into 3.7.2.

On Fri, Sep 21, 2018 at 8:28 AM STINNER Victor 
wrote:

>
> STINNER Victor  added the comment:
>
> IMHO it's not too late to change the public C API in Python 3.7.1, since
> it's a very new API, I don't expect many users, and I only expect compiler
> warnings nor hard error if existing code pass PyContextVar* instead of
> PyObject*.
>
> I agree that it's way better to use PyObject* rather than specific
> PyContextVar*. The C API should not leak implementation details ;-)
>
> --
> nosy: +vstinner
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-21 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

The documentation for locals ( 
https://docs.python.org/3/library/functions.html#locals ) specifically states:

Note: The contents of this dictionary should not be modified; changes may not 
affect the values of local and free variables used by the interpreter. 

The docstring for locals is similar, making it clear that any correlation 
between the returned dict and the state of locals if *either* is subsequently 
modified is implementation dependent, subject to change without back-compat 
concerns; even if we made this change, we've given ourselves the freedom to 
undo it at any time, which makes it useless to anyone who might try to rely on 
it.

The fact that even locals()["a"] = 1 happens to work is an implementation 
detail AFAICT; normally, locals() is and should remain read-only (or at least, 
modifications don't actually affect the local scope aside from the dict 
returned by locals()).

I'm worried that making _EnumDict inherit from collections.abc.MutableMapping 
in general would slow down Enums (at the very least creation, I'm not clear on 
whether _EnumDict remains, hidden behind the mappingproxy, for future lookups 
on the class), since MutableMapping would introduce a Python layer of overhead 
to most calls.

I'm also just not inclined to encourage the common assumption that locals() 
returns a dict where mutating it actually works, since it usually doesn't.

--
nosy: +josh.r

___
Python tracker 

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



[issue34764] Improve documentation example for using iter() with sentinel value

2018-09-21 Thread ChrisRands


New submission from ChrisRands :

This arose from this SO question: 
https://stackoverflow.com/questions/52446415/line-in-iterfp-readline-rather-than-line-in-fp
 

The example given in the docs:

with open('mydata.txt') as fp:
for line in iter(fp.readline, ''):
process_line(line)

Is exactly equivalent to the following because an empty string is only returned 
by readline at the EOF:

with open('mydata.txt') as fp:
for line in fp:
process_line(line)

The empty string '' sentinel value could be changed to another value to provide 
a possibly more meaningful example where the 2nd code snippet would not always 
produce the same result?

--
assignee: docs@python
components: Documentation
messages: 325995
nosy: ChrisRands, docs@python
priority: normal
severity: normal
status: open
title: Improve documentation example for using iter() with sentinel value

___
Python tracker 

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



[issue34765] Update install-sh

2018-09-21 Thread Charalampos Stratakis


New submission from Charalampos Stratakis :

The install-sh file that python uses for autotools is horribly outdated. Last 
update was 16 years ago and it's being copied from automake's source code.

Updating it to modern standards could potentially fix issues for systems that 
use autotools, but it has the downside of having some backwards incompatible 
changes e.g. [0][1] (or you can search at their NEWS file [2]) which could 
break some previous applied workarounds.

As things stand, there is no bug at the moment and autotools just work so would 
a PR for updating install-sh to a newer version be considered? 

[0] 
http://git.savannah.gnu.org/cgit/automake.git/commit/lib/install-sh?id=84a98180dd37a32891800fb9aafdf685bab74252
[1] 
http://git.savannah.gnu.org/cgit/automake.git/commit/lib/install-sh?id=bd44db1abdeea3643ba0387de24af7539da644e4
[2] http://git.savannah.gnu.org/cgit/automake.git/tree/NEWS

--
components: Build
messages: 325996
nosy: cstratak
priority: normal
severity: normal
status: open
title: Update install-sh
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue34766] BaseProxy cache should be cleaned when Manager client is reconnected

2018-09-21 Thread Yongnan Wu


Change by Yongnan Wu :


--
components: Library (Lib)
nosy: wynfred
priority: normal
severity: normal
status: open
title: BaseProxy cache should be cleaned when Manager client is reconnected
type: behavior
versions: Python 2.7, 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



[issue34767] Optimize asyncio.Lock

2018-09-21 Thread Yury Selivanov


New submission from Yury Selivanov :

There's no point in always creating a deque() for waiters in Lock.__init__.  
Not all locks end up using waiters.

--
components: asyncio
messages: 325997
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Optimize asyncio.Lock
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue34765] Update install-sh

2018-09-21 Thread Zachary Ware


Zachary Ware  added the comment:

If there's no actual bug, it certainly does not need to be done on maintenance 
branches.

--
nosy: +zach.ware
versions:  -Python 2.7, 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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur that the sooner the change is applied, the better it will be for 
everyone.  We'll need to make a prominent notice in the release notes though.

--
nosy: +rhettinger

___
Python tracker 

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



[issue33649] asyncio docs overhaul

2018-09-21 Thread Yury Selivanov


Change by Yury Selivanov :


--
pull_requests: +

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread STINNER Victor


STINNER Victor  added the comment:

> We'll need to make a prominent notice in the release notes though.

Something can be added at:
https://docs.python.org/dev/whatsnew/3.7.html#notable-changes-in-python-3-7-1

--

___
Python tracker 

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



[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-21 Thread Antony Lee


Antony Lee  added the comment:

> encourage the common assumption that locals() returns a dict where mutating 
> it actually works, since it usually doesn't.

It does at global and class scope, not at function scope.

FWIW, PEP558 (admittedly not accepted yet) proposes to modify the documentation 
for the semantics of locals() at class-scope to match the actual behavior 
(https://www.python.org/dev/peps/pep-0558/#class-scope):

At class scope [...] changes to the returned mapping must change the values 
bound to local variable names in the execution environment.

> I'm worried that making _EnumDict inherit from collections.abc.MutableMapping 
> in general would slow down Enums (at the very least creation, I'm not clear 
> on whether _EnumDict remains, hidden behind the mappingproxy, for future 
> lookups on the class), since MutableMapping would introduce a Python layer of 
> overhead to most calls.

"Normal" calls won't: __setitem__ / __getitem__ stays what they are, they were 
implemented in Python and stay implemented in Python.  Whoever calls update() 
will go through an extra Python layer, but there's not much you can do about 
that.

Alternatively, if you *really* don't want to support the MutableMapping API, at 
least it should be disabled (e.g. by adding stub implementations of update(), 
etc. that throw NotImplementedError).  Again performance-wise this would only 
affect those who try to call these methods.

As a side note, I would be curious to see any realistic code where the 
performance of enum creation turns out to be critical.  I don't think(?) the 
_EnumDict stays afterwards, at least PEP558 (which supposedly corresponds to 
the actual current behavior) also states "The mapping returned by locals() will 
not be used as the actual class namespace underlying the defined class (the 
class creation process will copy the contents to a fresh dictionary that is 
only accessible by going through the class machinery)."

--

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:

>> We'll need to make a prominent notice in the release notes though.

> Something can be added at:
https://docs.python.org/dev/whatsnew/3.7.html#notable-changes-in-python-3-7-1

Yeah, thank you for suggestion, I'll do that.  I'll also update the PEP, docs 
in other places, and try to spread the word.

Now I'm just waiting for Ned to confirm if this goes into 3.7.1 or 3.7.2.  It's 
his say.

--

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Eric Snow


Eric Snow  added the comment:

> one of the things we want to fix is to eliminate non-PyObject
> pointer types from public APIs entirely.

A notable exception is Py_buffer. [1]  As well, cross-interpreter data must not 
be PyObject, though that isn't much of an issue (yet). :)  At some point it may 
make sense to make _PyCrossInterpreterData [2] part of the public C-API.  
However, we can cross *that* bridge later. :)

Using PyObject for contextvars makes sense (for the reasons you described) as 
long as they won't be shared between interpreters.  I'm not super familiar with 
the contextvars C-API, but it looks like cross-interpreter issues are *not* a 
factor.  If that's the case then there's nothing further to discuss. :)

[1] https://docs.python.org/3/c-api/buffer.html#buffer-structure
[2] 
https://github.com/python/cpython/blob/master/Include/internal/pystate.h#L137

--
nosy: +eric.snow

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +lemburg

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:

> > one of the things we want to fix is to eliminate non-PyObject
> pointer types from public APIs entirely.

> A notable exception is Py_buffer. [1]

Right, because Py_buffer isn't a PyObject at all :)

> Using PyObject for contextvars makes sense (for the reasons you described) as 
> long as they won't be shared between interpreters.

Yeah, PyContext, PyContextVar, and PyContextToken aren't supposed to be shared 
between sub-interpreters directly.  Context is essentially a mapping of Context 
Variables to arbitrary Python Objects, so sharing it transparently isn't 
possible.

--

___
Python tracker 

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



[issue34760] Regression in abc in combination with passing a function to issubclass

2018-09-21 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

OK, lets close this for now. We will see if there are any other situations.

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

As someone who does AST manipulation (Quixote PTL template support), I'm 
interested in this patch. I think what is proposed sounds like a good change.  
I.e. having the extra node types is not useful and makes the compiler harder to 
understand.  Providing subclasses for backwards compatibility would be nice.  I 
will test my Quixote package with Serhiy's patch.

--
nosy: +nascheme

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Stefan Behnel


Stefan Behnel  added the comment:

> because Py_buffer isn't a PyObject at all :)

It owns a PyObject reference to the buffer owner, though.

--
nosy: +scoder

___
Python tracker 

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



[issue34766] BaseProxy cache should be cleaned when Manager client is reconnected

2018-09-21 Thread Yongnan Wu


Change by Yongnan Wu :


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

___
Python tracker 

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



[issue34761] str(super()) != super().__str__()

2018-09-21 Thread Eric Snow


Eric Snow  added the comment:

As Serhiy said, this is the correct behavior.  Nearly all builtin operations 
are made using the appropriate "dunder" method from the object's type (not 
looked up on the object itself).  So the following (based on your example) are 
equivalent:

  s = super(Child, self)
  print(type(s).__str__(s))
  print(str(s))

In contrast, explicitly calling __str__() on the instance involves lookup 
there, so the following are equivalent:

  s = super(Child, self)
  print(s.__str__())
  print(type(s).__getattribute__(s, '__str__')())

You can read more about "dunder" (AKA "special") methods and how they are 
looked up in the docs. [1][2][3]

I'm going to close this issue, but if you think there's anything further we can 
do in the documentation to avoid confusion then please let us know.


[1] https://docs.python.org/3/reference/datamodel.html#special-lookup
[2] https://docs.python.org/3/reference/datamodel.html#special-method-names
[3] 
https://docs.python.org/3/library/inspect.html#fetching-attributes-statically

--
nosy: +eric.snow
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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Ned Deily


Ned Deily  added the comment:

Since we've already delayed 3.7.1rc cutoff for a few days, let's get it into 
3.7.1 if you have the time, Yury.

--

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

We use the Unicode database for these methods. Could you please check whether 
the database marks the character as numeric ?

If yes, we may need to check the database generation.

Otherwise, there isn't much we can do, since we use the Unicode database as 
reference.

Thanks
-- 
Marc-Andre Lemburg

Sent from my phone. 
See http://www.egenix.com/company/ for contact information
and impressum.

On 21 September 2018 18:38:05 GMT+02:00, Serhiy Storchaka 
 wrote:
> 
> Change by Serhiy Storchaka :
> 
> 
> --
> nosy: +lemburg
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Matthew Barnett

Matthew Barnett  added the comment:

Unicode 11.0.0 has 卅 (U+5345) as being numeric and having the value 30.

What's the difference between that and U+4E17?

I notice that they look at lot alike. Are they different variants, perhaps 
traditional vs simplified?

--

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Matthew Barnett


Change by Matthew Barnett :


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

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Matthew Barnett


Change by Matthew Barnett :


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

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Matthew Barnett


Change by Matthew Barnett :


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

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread Matthew Barnett


Change by Matthew Barnett :


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

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

I should also make it clear that the collision hash((1,0,0)) == hash((1,-2,-2)) 
that I reported is due to the algorithm, it's not due to some bad luck that 2 
numbers happen to be the same. There are also many more similar hash collisions 
for tuples (all involving negative numbers) due to the same underlying 
mathematical reason.

I still don't understand why you don't consider it a problem. It may be a tiny 
problem, not really affecting the correct functioning of CPython. But, if we 
can fix this tiny problem, why shouldn't we?

--

___
Python tracker 

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



[issue34764] Improve documentation example for using iter() with sentinel value

2018-09-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur that the readline() example is problematic.  While it succeeds in 
showing how iter() works, the example itself is not the best way to solve that 
particular problem.

Here are two possible substitute examples.

1) Simple example that focuses primarily on the behavior of iter() and required 
little extra knowledge:


>>> from random import randint
>>> def roll_dice():
return randint(1, 6) + randint(1, 6)

>>> # roll until a seven is seen
>>> list(iter(roll_dice, 7))
>>> list(iter(roll_dice, 7))
[10, 6, 5, 6, 8]

2) Practical application reading binary files in fixed-width blocks for 
processing with the structure module.  This also teaches how to partial() to 
produce an arity-zero callable suitable for use with iter().

>>> Read fixed-width blocks from a database binary file
>>> from functools import partial
>>> with open('mydata.db', 'rb') as f:
for block in iter(partial(f.read, 64)):
print(parse_struct(block))

--
nosy: +rhettinger

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not one to judge the effectiveness of a new hash algorithm. But my personal 
concern here is making something else worse: an unintended consequence. IMO the 
bar for changing this would be very high, and at the least it would need to be 
addressing a known, not theoretical, problem.

That said, I'll let the experts debate your proposed change.

--

___
Python tracker 

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



[issue34623] _elementtree.c doesn't call XML_SetHashSalt()

2018-09-21 Thread Christian Heimes


Christian Heimes  added the comment:

CVE-2018-14647 was assigned to this issue.

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

ISTM the collision of "hash((1,0,0)) == hash((1,-2,-2))" also stems from 
integers hashing to themselves and that twos-complement arithmetic relation, -x 
== ~x+1.  Further, that example specifically exploits that "hash(-1) == 
hash(-2)" due to how error codes.  In a way, tuple hashing is incidental.

Occasional collisions aren't really a big deal -- it is normal for dicts to 
have some collisions and to resolve them.  I would be more concerned is 
non-contrived datasets had many elements that gave exactly the same hash value 
resulting in a pile-up in one place.

FWIW, the current algorithm also has some advantages that we don't want to 
lose. In particular, the combination of the int hash and tuple hash are good at 
producing distinct values for non-negative numbers:

>>> from itertools import product
>>> len(set(map(hash, product(range(100), repeat=4
1

The current hash is in the pretty-darned-good category and so we should be 
disinclined to change battle-tested code that is known to work well across a 
broad range of use cases.

--

___
Python tracker 

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



[issue34768] Add documentation for the purpose of __init__.py in packages

2018-09-21 Thread Benito Kestelman


New submission from Benito Kestelman :

I just learned how to make my own package in python and upload it to pypi. I 
mainly used the documentation here: 
https://packaging.python.org/tutorials/packaging-projects/

Other than the toy example, there is no explanation of __init__.py, its 
purpose, or what I should put in it to get my code to work. 

It took me a lot of time and guessing to figure it out, and I had to look at 
several projects on Github to see how others did it. I found a couple that 
looked correct because they were concise, but others looked horrendous - one 
was several thousand lines long. 

A clear explanation of how to use __init__.py when making a package would be 
extremely helpful.

--
assignee: docs@python
components: Documentation
messages: 326020
nosy: bkestelman, docs@python
priority: normal
severity: normal
status: open
title: Add documentation for the purpose of __init__.py in packages

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 2ec872b31e25cee1f983fe07991fb53f3fd1cbac by Yury Selivanov in 
branch 'master':
bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473)
https://github.com/python/cpython/commit/2ec872b31e25cee1f983fe07991fb53f3fd1cbac


--

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8890

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Further, that example specifically exploits that "hash(-1) == hash(-2)"

No, it does not. There is no hashing of -1 involved in the example 
hash((1,0,0)) == hash((1,-2,-2)).

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Tim Peters


Tim Peters  added the comment:

For me, it's largely because you make raw assertions with extreme confidence 
that the first thing you think of off the top of your head can't possibly make 
anything else worse.  When it turns out it does make some things worse, you're 
equally confident that the second thing you think of is (also) perfect.

So far we don't even have a real-world test case, let alone a coherent 
characterization of "the problem":

"""
all involving negative numbers) due to the same underlying mathematical reason.
"""

is a raw assertion, not a characterization.  The only "mathematical reason" you 
gave before is that "j odd implies j^(-2) == -j, so that m*(j^(-2)) == -m".  
Which is true, and a good observation, but doesn't generalize as-is beyond -2.

Stuff like this from the PR doesn't inspire confidence either:

"""
MULTIPLIER = (103)**3 + 2 = 1092729: the multiplier should be 
big enough and the original 20-bit number is too small for a 64-bit hash. So I 
took the third power. Unfortunately, this caused a sporadic failure of the 
testsuite on 32-bit systems. So I added 2 which solved that problem.
"""

Why do you claim the original was "too small"?  Too small for what purpose?  As 
before, we don't care whether Python hashes "act random".  Why, when raising it 
to the third power apparently didn't work, did you pull "2" out of a hat?  What 
was _the cause_ of the "sporadic failure" (whatever that means), and why did 
adding 2 fix it?  Why isn't there a single word in _the code_ about where the 
mystery numbers came from?:

You're creating at least as many mysteries as you're claiming to solve.

We're not going to change such heavily used code on a whim.

That said, you could have easily enough _demonstrated_ that there's potentially 
a real problem with a mix of small integers of both signs:

>>> from itertools import product
>>> cands = list(range(-10, -1)) + list(range(9))
>>> len(cands)
18
>>> _ ** 4
104976
>>> len(set(hash(t) for t in product(cands, repeat=4)))
35380

And that this isn't limited to -2 being in the mix (and noting that -1 wasn't 
in the mix to begin with):

>>> cands.remove(-2)
>>> len(cands) ** 4
83521
>>> len(set(hash(t) for t in product(cands, repeat=4)))
33323

If that's "the problem", then - sure - it _may_ be worth addressing.  Which we 
would normally do by looking for a minimal change to code that's been working 
well for over a decade, not by replacing the whole thing "just because".

BTW, continuing the last example:

>>> c1 = Counter(hash(t) for t in product(cands, repeat=4))
>>> Counter(c1.values())
Counter({1: 11539, 2: 10964, 4: 5332, 3: 2370, 8: 1576, 6: 1298, 5: 244})

So despite that there were many collisions, the max number of times any single 
hash code appeared was 8.  That's unfortunate, but not catastrophic.

Still, if a small change could repair that, fine by me.

--

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread miss-islington


miss-islington  added the comment:


New changeset 187f2dd256a917c20bf55954d019fd35fb46ab08 by Miss Islington (bot) 
in branch '3.7':
bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473)
https://github.com/python/cpython/commit/187f2dd256a917c20bf55954d019fd35fb46ab08


--
nosy: +miss-islington

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Tim Peters


Tim Peters  added the comment:

Oops!

"""
"j odd implies j^(-2) == -j, so that m*(j^(-2)) == -m"
"""

The tail end should say "m*(j^(-2)) == -m*j" instead.

--

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:

PEP update: 
https://github.com/python/peps/commit/977a94d1a79b71336568119eb689b277d2ffec80

--

___
Python tracker 

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



[issue34762] Change contextvars C API to use PyObject

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:

Fixed in master and 3.7.  Thanks!

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

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> FWIW, the current algorithm also has some advantages that we don't want to 
> lose. In particular, the combination of the int hash and tuple hash are good 
> at producing distinct values for non-negative numbers:

>>> from itertools import product
>>> len(set(map(hash, product(range(100), repeat=4
1

FWIW: the same is true for my new hash function

--

___
Python tracker 

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread STINNER Victor


STINNER Victor  added the comment:

Hum, I'm not sure that I understood correctly: does "isinstance(node, ast.Num)" 
still work with the patch? If yes, I see no reason to not merge the change ;-)

--

___
Python tracker 

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



[issue33649] asyncio docs overhaul

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset db1a80e97aa7217c561fb3627f70be1882de9534 by Yury Selivanov in 
branch 'master':
bpo-33649: Fix gather() docs; fix title; few other nits. (GH-9475)
https://github.com/python/cpython/commit/db1a80e97aa7217c561fb3627f70be1882de9534


--

___
Python tracker 

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



[issue33649] asyncio docs overhaul

2018-09-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8891

___
Python tracker 

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



[issue34267] find_python.bat doesn't find installed Python 3.7

2018-09-21 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Concerning the MULTIPLIER:

> Why do you claim the original was "too small"?  Too small for what purpose?

If the multiplier is too small, then the resulting hash values are small too. 
This causes collisions to appear for smaller numbers:

BEFORE:
>>> L = [(a,b) for a in range(2) for b in range(2**21)]
>>> len(L), len(set(hash(x) for x in L))
(4194304, 2097152)

AFTER:
>>> L = [(a,b) for a in range(2) for b in range(2**21)]
>>> len(L), len(set(hash(x) for x in L))
(4194304, 4194304)

Again, not a huge problem, but at least there is room for improvement.

> Why, when raising it to the third power apparently didn't work, did you pull 
> "2" out of a hat?  What was _the cause_ of the "sporadic failure" (whatever 
> that means)

With "sporadic failure", I mean a hash collision not due to the algorithm but 
due to two numbers which happen to be the same. This might not even affect 
actual usage, but it did cause the testsuite to fail on 32 bit machines (48 
collisions if I recall correctly while only 20 are allowed).

> and why did adding 2 fix it?

Because it's really just random chance. Some constants just happen to produce 
more collisions on the specific testsuite input. It should also be said that, 
due to the structure of that input, collisions are not independent. For 
example, if hash((a,b,c)) == hash((d,e,f)), then also hash((a,b,c,x)) == 
hash((d,e,f,x)) for example.

> Why isn't there a single word in _the code_ about where the mystery numbers 
> came from?

Ideally, it should be just a random number. I can fix that by using a "Nothing 
up my sleeve number".

--

___
Python tracker 

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



[issue33782] VSTS Windows-PR: internal error

2018-09-21 Thread Steve Dower


Change by Steve Dower :


--
resolution:  -> fixed
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



[issue33649] asyncio docs overhaul

2018-09-21 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset e45662c28bfc84aa3674463a2995e45da4d63793 by Yury Selivanov (Miss 
Islington (bot)) in branch '3.7':
bpo-33649: Fix gather() docs; fix title; few other nits. (GH-9475) (GH-9481)
https://github.com/python/cpython/commit/e45662c28bfc84aa3674463a2995e45da4d63793


--

___
Python tracker 

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



[issue34763] Python lacks 0x4E17

2018-09-21 Thread STINNER Victor


STINNER Victor  added the comment:

$ ./python
Python 3.8.0a0 (heads/master-dirty:06e7608207, Sep 20 2018, 01:52:01) 
>>> import unicodedata
>>> unicodedata.unidata_version
'11.0.0'
>>> unicodedata.numeric('\u5345')
30.0
>>> unicodedata.numeric('\u4E17')
ValueError: not a numeric character

--

___
Python tracker 

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



[issue34725] Py_GetProgramFullPath() odd behaviour in Windows

2018-09-21 Thread Steve Dower


Steve Dower  added the comment:

I meant returning the full name of the process is intentional. But you're right 
that overriding it should actually override it.

I found the prior bug at issue33180, but I'm closing it in favour of this one. 
I don't have fully fleshed out semantics in my mind for all the cases to handle 
here, but I hope that we soon reach a point of drastically simplifying getpath 
and can align the platforms better at that point.

Meanwhile I'll leave this open in case anyone wants to work on a targeted fix.

--

___
Python tracker 

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



[issue33180] Flag for unusable sys.executable

2018-09-21 Thread Steve Dower


Steve Dower  added the comment:

Closing in favour of issue34725

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



[issue32282] When using a Windows XP compatible toolset, `socketmodule.c` fails to build

2018-09-21 Thread Steve Dower


Steve Dower  added the comment:

I'm going to just close this without fixing 3.5. If there's demand, we can 
consider it, but at this stage it's so easy for people to migrate to 3.6 or 
later that I'm sure that's already been done.

--
resolution:  -> fixed
stage: backport 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



[issue32556] support bytes paths in nt _getdiskusage, _getvolumepathname, and _getfinalpathname

2018-09-21 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-09-21 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue32533] SSLSocket read/write thread-unsafety

2018-09-21 Thread Steve Dower


Steve Dower  added the comment:

Fixed, with a fix for the regression coming in issue34759

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

___
Python tracker 

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



[issue33091] ssl.SSLError: Invalid error code (_ssl.c:2217)

2018-09-21 Thread Steve Dower


Change by Steve Dower :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> SSLSocket read/write thread-unsafety

___
Python tracker 

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



  1   2   >