[issue34732] uuid returns version more than 5

2018-09-20 Thread jophine antony


jophine antony  added the comment:

I had raised a PR in github when i have created this ticket but forgot to add 
it here: https://github.com/python/cpython/pull/9413

--

___
Python tracker 

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



[issue34747] SSLSocket.context cannot be changed on non-connected sockets

2018-09-20 Thread Vincent Pelletier


New submission from Vincent Pelletier :

>From ssl.py, both on 2.7.15 and 3.6.6:
class SSLSocket(...):
...
@context.setter
def context(self, ctx):
self._context = ctx
self._sslobj.context = ctx

_sslobj is only set when socket is connected. While this is not a big issue for 
client sockets as user could just wrap the socket with correct context to begin 
with, and not a big issue for server sockets for the same reason, it is an 
issue for listening sockets: they are never connected, by definition, and do 
not care about _sslobj: upon accept() they only use self._context to wrap 
created socket.

Suggested fix:
@context.setter
def context(self, ctx):
self._context = ctx
if self._sslobj:
self._sslobj.context = ctx
(consistently with how _sslobj is evaluated as a boolean elsewhere in the same 
class)

Suggested workaround (ex: if this fix is not backported to 2.7):
try:
ssl_socket.context = new_context
except AttributeError:
pass
as _context is changed first, and it's all that matters.

--
messages: 325847
nosy: vincent-nexedi
priority: normal
severity: normal
status: open
title: SSLSocket.context cannot be changed on non-connected sockets
type: behavior
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue34659] Inconsistency between functools.reduce & itertools.accumulate

2018-09-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> As for pickling/copying, this task is technically difficult, 
> it but I don't see principal problems. 

I've added the pickle/copy support to the PR.

> is it worth to add it?

Tim was persuasive, so I've agreed to add the feature.  It may be little used 
but may help once in a while.

--

___
Python tracker 

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



[issue34694] Dismiss To Avoid Slave/Master wording cause it easier for non English spoken programmers

2018-09-20 Thread Gabriel Marko


Gabriel Marko  added the comment:

@Larry and Terry:

I want to stay out of this discussion or participation on Python development 
for the future as I've expressed it elsewhere 
(https://bugs.python.org/issue34660#msg325515). However, I want to address the 
unfair treatment of my person and what I consider to be a violation of CoC in 
the previous comment (https://bugs.python.org/issue34694#msg325802).

> We have been and will be attacked from extremists on both sides if consider 
> changes on a case-by-case basis, accepting some and rejecting others.
> We have been and will be attacked from extremists on both sides for 
> considering changes on a case-by-case basis, accepting some and rejecting 
> others.

Labeling people as "extremists" without justification is _ad hominem_ and can 
be considered to be a personal attack. The term "extremism" has strong negative 
connotations and it's often related to "calling for violent action". The 
comment doesn't make clear neither 1) who or what group of people is meant to 
be extremist here nor 2) what was considered to be extremist. 

In general _ad hominem_ arguments and attacking someones reputation are not 
part of civil and rational argumentation/discourse. As far as I understand this 
isn't compliant with the Code of Conduct either. 

> Marko called our actions 'madness' and here called us 'irresponsible'.

I find this unfair and a misrepresentation of what I wrote:

> I find this behavior from the Python core developers and representatives 
> simply irresponsible. (https://bugs.python.org/msg325499)

I explicitly referred to _behavior being irresponsible_ not the people. Even 
responsible people can have sometimes irresponsible decisions or behaviour. I 
also explained what I'd meant by "madness" (see here: 
https://bugs.python.org/issue34660#msg325503). And as I've already said 
elswhere:

> I can completely agree that I shouldn't/mustn't make sarcastic comments. 
> (https://bugs.python.org/issue34660#msg325515)

I also agree with Larry that sarcasm isn't the best strategy :) However, 
silencing discussions like this "There will be no further discussion about 
this." (https://bugs.python.org/issue34694#msg325437) isn't a good strategy 
either. 

I don't want to be involved into further discussion and I politely ask you to 
not refer to me or labeling me.

Thank you,

Gabriel

--
nosy: +suic

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-20 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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



[issue34125] Profiling depends on whether **kwargs is given

2018-09-20 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


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



[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-20 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



[issue34542] [TLS] Update test certs to future proof settings

2018-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset 49d65958e13db03b9a4240d8bdaff1a4be69a1d7 by Miss Islington (bot) 
(Christian Heimes) in branch '2.7':
[2.7] bpo-34542: Update test certs and keys (GH-8997) (GH-9397)
https://github.com/python/cpython/commit/49d65958e13db03b9a4240d8bdaff1a4be69a1d7


--

___
Python tracker 

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



[issue34542] [TLS] Update test certs to future proof settings

2018-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset 11485102cb7b3c57a1bc6d04c4ff4b1e25c53530 by Miss Islington (bot) 
(Christian Heimes) in branch '3.6':
[3.6] bpo-34542: Update test certs and keys (GH-8997) (GH-9396)
https://github.com/python/cpython/commit/11485102cb7b3c57a1bc6d04c4ff4b1e25c53530


--
nosy: +miss-islington

___
Python tracker 

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



[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-20 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems like a reasonable addition (Customization of writing to sys.stderr too) . 
It seems to have been inherited from optparse which has pretty much the same 
code with hardcoded exit code. The solution suggested is to catch SystemExit 
and provide custom status code or subclass ArgumentParser.

Googling "custom exit code ArgumentParser.error" gave me some discussions : 

* 
https://stackoverflow.com/questions/5943249/python-argparse-and-controlling-overriding-the-exit-status-code
* https://groups.google.com/forum/#!topic/comp.lang.python/NwsDljv_edk
* PEP discussion on sys.exit and stderr: 
https://www.python.org/dev/peps/pep-0389/#discussion-sys-stderr-and-sys-exit
* Open issue to customize stderr that might be helpful if someone wants to add 
a patch for custom exit code : https://bugs.python.org/issue9938

Thanks

--

___
Python tracker 

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



[issue34737] Python upgrade with SYSTEM account uninstalls python

2018-09-20 Thread Jatin Goel


Jatin Goel  added the comment:

Hi Steve,

It's not actually an issue with the Tcl/Tk package.

This is happening for all the packages.

Even with the installAllUsers flag set, the installation for all users fail, 
and then it tries to do justForMe installation, and that too is failing.

Again elaborating, this issue only comes when trying to upgrade the Python 
using the SYSTEM account.

No antivirus is running on any of the machines where it failed.

PFA the log file for Python installation.

You can find all the other log files in this GitHub repository: 
https://github.com/GoelJatin/PythonIssue34737

--
Added file: https://bugs.python.org/file47816/InstallPython

___
Python tracker 

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



[issue34663] Support POSIX_SPAWN_USEVFORK flag in posix_spawn

2018-09-20 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue34559] multiprocessing AuthenticationError when nesting with non-default authkey

2018-09-20 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



[issue32215] sqlite3 400x-600x slower depending on formatting of an UPDATE statement in a string

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 8d1e190fc507a9e304f6817e761e9f628a23cbd8 by Berker Peksag in 
branch 'master':
bpo-32215: Fix performance regression in sqlite3 (GH-8511)
https://github.com/python/cpython/commit/8d1e190fc507a9e304f6817e761e9f628a23cbd8


--

___
Python tracker 

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



[issue32215] sqlite3 400x-600x slower depending on formatting of an UPDATE statement in a string

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8856

___
Python tracker 

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



[issue32215] sqlite3 400x-600x slower depending on formatting of an UPDATE statement in a string

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8857

___
Python tracker 

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



[issue34743] test_database_source_name fails with SQLite 3.7.9

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset b10a64d117de6121ea3e79c467c4107f8f399f3d by Berker Peksag in 
branch 'master':
bpo-34743: Fix test_database_source_name under SQLite 3.7.9 (GH-9426)
https://github.com/python/cpython/commit/b10a64d117de6121ea3e79c467c4107f8f399f3d


--

___
Python tracker 

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



[issue34743] test_database_source_name fails with SQLite 3.7.9

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8858

___
Python tracker 

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



[issue34748] Incorrect HTML link in functools.partial

2018-09-20 Thread xitop


New submission from xitop :

There is a minor issue regarding the page 
https://docs.python.org/3/library/functools.html

The description of functools.partial starts with text "Return a new partial 
object" which contains a link. This link does not point to the partial object 
(#partial-objects anchor) as it should. It points back
to the partial function (#functools.partial anchor) which is not helpful. The 
partial object docs can be thus easily overseen.

--
assignee: docs@python
components: Documentation
messages: 325856
nosy: docs@python, xitop
priority: normal
severity: normal
status: open
title: Incorrect HTML link in functools.partial
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



[issue34344] Fix the docstring for AbstractEventLoopPolicy.get_event_loop

2018-09-20 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



[issue33813] Update overdue 'Deprecated ... removed in 3.x' messages

2018-09-20 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



[issue33545] Docs for uuid don't mention that uuid1 can repeat in some circumstances

2018-09-20 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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread Berker Peksag


Change by Berker Peksag :


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

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:

==
ERROR: setUpClass (test.test_nntplib.NetworkedNNTPTests)
--
Traceback (most recent call last):
  File "/home/travis/build/python/cpython/Lib/test/test_nntplib.py", line 292, 
in setUpClass
usenetrc=False)
  File "/home/travis/build/python/cpython/Lib/nntplib.py", line 1043, in 
__init__
self.sock = socket.create_connection((host, port), timeout)
  File "/home/travis/build/python/cpython/Lib/socket.py", line 724, in 
create_connection
raise err
  File "/home/travis/build/python/cpython/Lib/socket.py", line 713, in 
create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

https://travis-ci.org/python/cpython/jobs/430974933

--
status:  -> open

___
Python tracker 

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



[issue33813] Update overdue 'Deprecated ... removed in 3.x' messages

2018-09-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue27032.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34749] improve performance of binascii.a2b_base64()

2018-09-20 Thread Sergey Fedoseev


New submission from Sergey Fedoseev :

I reworked implementation of binascii.a2b_base64() and there is significant 
speedup:

$ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from binascii import b2a_base64, a2b_base64; s = b2a_base64(1000 * b'b')" 
"a2b_base64(s)"
/home/sergey/tmp/cpython-master-venv/bin/python: . 3.43 us 
+- 0.01 us
/home/sergey/tmp/cpython-dev-venv/bin/python: . 1.52 us +- 
0.01 us
Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 3.43 us +- 
0.01 us -> [/home/sergey/tmp/cpython-dev-venv/bin/python] 1.52 us +- 0.01 us: 
2.26x faster (-56%)

$ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s 
"from binascii import b2a_base64, a2b_base64; s = b2a_base64(1 * b'b')" 
"a2b_base64(s)"
/home/sergey/tmp/cpython-master-venv/bin/python: . 76.0 ns 
+- 0.2 ns
/home/sergey/tmp/cpython-dev-venv/bin/python: . 69.2 ns +- 
0.1 ns
Mean +- std dev: [/home/sergey/tmp/cpython-master-venv/bin/python] 76.0 ns +- 
0.2 ns -> [/home/sergey/tmp/cpython-dev-venv/bin/python] 69.2 ns +- 0.1 ns: 
1.10x faster (-9%)

--
components: Extension Modules
messages: 325860
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: improve performance of binascii.a2b_base64()
type: performance
versions: Python 3.8

___
Python tracker 

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



[issue34749] improve performance of binascii.a2b_base64()

2018-09-20 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


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

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:

I think it would be nice if tweaked support.transient_internet() to catch 
EADDRNOTAVAIL. See 
https://github.com/python/cpython/commit/e4dcbbd7f4ac18d01c0ec85f64ae98b8281ed403#diff-7fa374913c0ecbdc621db8ea79a1212bR78
 for another example.

--

___
Python tracker 

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



[issue34247] PYTHONOPTIMIZE ignored in 3.7.0 when using custom launcher

2018-09-20 Thread Nick Coghlan


Nick Coghlan  added the comment:

The "ill-defined" in Python 3.6 relates to the fact that we never actually 
defined or tested which environment variables were read by Py_Main and which 
ones were read by Py_Initialize, since the majority of our tests only covered 
Py_Main (by launching a full Python subprocess).

Thus the only way to find out which environment variables fell into which 
category would be to read the Python 3.6 source code.

That's technically still the case for Python 3.7, but Victor's done some 
excellent refactoring work so it's much clearer in the code which vars may be 
updated if Py_Initialize is run a second time.

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



[issue33236] MagicMock().__iter__.return_value is different from MagicMock().__iter__()

2018-09-20 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

Can you please link to the relevant documentation that is misleading? As I can 
see from the source code return value is a Mock object [1] which I believe the 
docs state as below : 

https://docs.python.org/3/library/unittest.mock.html#calling

> Mock objects are callable. The call will return the value set as the 
> return_value attribute. The default return value is a new Mock object; it is 
> created the first time the return value is accessed (either explicitly or by 
> calling the Mock) - but it is stored and the same one returned each time.

from unittest.mock import MagicMock
x = MagicMock()

print(x.__iter__())
print(x.__iter__.return_value)
print(x.return_value)


➜  cpython git:(master) ./python.exe bpo33236.py





[1] : 
https://github.com/python/cpython/blob/b10a64d117de6121ea3e79c467c4107f8f399f3d/Lib/unittest/mock.py#L463


Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue31628] test_emails failure on FreeBSD

2018-09-20 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



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

2018-09-20 Thread Antony Lee


New submission from Antony Lee :

A quick check suggests that enum entries can be programmatically created by 
assigning to locals() in the Enum body:

   class E(Enum): locals()["a"] = 1
   E.a  # -> 

However, using locals().update(...) doesn't, and silently does the wrong thing:

   class E(Enum): locals().update({"a": "a"})
   E.a  # -> 'a'

(Yes, in this simple case, I could just use the functional API (`E = Enum("E", 
[("a", "a")])`), but the above is simpler if I also want e.g. to define methods 
for the Enum.

--
components: Library (Lib)
messages: 325864
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: locals().update doesn't work in Enum body, even though direct assignment 
to locals() does
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



[issue33110] Adding a done callback to a concurrent.futures Future once it has already completed, may raise an exception, contrary to docs

2018-09-20 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



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

2018-09-20 Thread Nick Coghlan


Nick Coghlan  added the comment:

https://github.com/python/cpython/pull/9257 should be complete now, although I 
may have gone overboard on the documentation updates (as it seems to be 
unclear, at least to Victor, why PYTHONCOERCECLOCALE exists in the first place)

--

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


Nick Coghlan  added the comment:

(Also, the patch is currently still written on the assumption that it won't be 
backported to 3.7.1. I haven't checked if it would apply cleanly to 3.7.x, but 
I suspect not, given the magnitude of the startup changes targeting 3.8.0 since 
3.7.0 was released)

--

___
Python tracker 

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



[issue33117] asyncio example uses non-existing/documented method

2018-09-20 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I think `asyncio.run_coroutine_threadsafe(coro, loop)` returns a 
concurrent.futures.Future [1] which supports timeout and not asyncio.Future 
which doesn't support timeout. Please add in if I am missing anything. Since 
asyncio docs are being rewritten this would be a great time to contribute too 
if you would like to add more clarification.

Docs at [1] also say the below : 

asyncio.run_coroutine_threadsafe(coro, loop)

Submit a coroutine to the given event loop. Thread-safe.

Return a concurrent.futures.Future to wait for the result from another OS 
thread.


```
# bpo33117.py. This needs to be called from a different thread as docs said but 
I am using future.result(timeout) just to make sure there is no error with 
respect to function argument.

import asyncio

loop = asyncio.get_event_loop()
timeout = 4

# Create a coroutine
coro = asyncio.sleep(1, result=3)

# Submit the coroutine to a given loop
future = asyncio.run_coroutine_threadsafe(coro, loop)

# Wait for the result with an optional timeout argument
assert future.result(timeout) == 3
```


➜  cpython git:(master) ./python.exe bpo33117.py
Traceback (most recent call last):
  File "../bpo33117.py", line 13, in 
assert future.result(timeout) == 3
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/concurrent/futures/_base.py",
 line 438, in result
raise TimeoutError()
concurrent.futures._base.TimeoutError

[1] 
https://docs.python.org/3.8/library/concurrent.futures.html#concurrent.futures.Future



Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue19431] Document PyFrame_FastToLocals() and PyFrame_FastToLocalsWithError()

2018-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

I closed the issue because we decided to not document the function, but I'm 
still interested to mark the API is private. Such change is more sensitive, so 
I added it my larger "New C API" project which works on finding a way to 
deprecate functions and provide maybe helpers for backward and forward 
compatibility:
https://pythoncapi.readthedocs.io/bad_api.html#for-internal-use-only

--

___
Python tracker 

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



[issue33085] *** Error in `python': double free or corruption (out): 0x00007ff5254d50d0 ***

2018-09-20 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. Can you please add a little more description on 
reproducing this issue along with OS details ? By "the installation of readline 
(6.2.4.1) [1]" are you referring to a third party package that you have 
installed with Python that resulted in a crash in Python interpreter? I tried 
it with master in a virtual env and cannot reproduce the same. Is this 
reproducible with latest Python or Python 3.6 version? Also it seems you are 
installing it as a root user does this happen only for root user or even with a 
virtualenv?


```
(bpo33085-env) karthi@ubuntu-s-1vcpu-1gb-blr1-01:~$ pip install readline
[snip]
Installing collected packages: readline
  Running setup.py install for readline ... done
Successfully installed readline-6.2.4.1
(bpo33085-env) karthi@ubuntu-s-1vcpu-1gb-blr1-01:~$ python
Python 3.8.0a0 (heads/master:73820a6, Sep 14 2018, 18:33:26)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
```

[1] : https://pypi.org/project/readline/ (moved to 
https://pypi.org/project/gnureadline/)


Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue32995] Add a glossary entry for context variables

2018-09-20 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



[issue32291] Value error for string shared memory in multiprocessing

2018-09-20 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



[issue32019] Interactive shell doesn't work with readline bracketed paste

2018-09-20 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



[issue31898] Add a `recommended-packages.txt` file

2018-09-20 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



[issue31865] html.unescape does not work as per documentation

2018-09-20 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-20 Thread Jeroen Demeyer


New submission from Jeroen Demeyer :

It's not hard to come up with a hash collision for tuples:

>>> hash( (1,0,0) )
2528505496374819208
>>> hash( (1,-2,-2) )
2528505496374819208

The underlying reason is that the hashing code mixes ^ and *. This can create 
collisions because, for odd x, we have x ^ (-2) == -x and this minus operation 
commutes with multiplication.

This can be fixed by replacing ^ with +. On top of that, the hashing code for 
tuples looks needlessly complicated. A simple Bernstein hash suffices.

--
messages: 325870
nosy: jdemeyer
priority: normal
severity: normal
status: open
title: Hash collisions for tuples

___
Python tracker 

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



[issue34663] Support POSIX_SPAWN_USEVFORK flag in posix_spawn

2018-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

> Thanks for chiming in Florian, and thanks Pablo for your detailed 
> investigation. :)

I concur, very interesting talk ;-)

--

___
Python tracker 

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



[issue34690] Store startup modules as C structures for 20%+ startup speed improvement

2018-09-20 Thread Nick Coghlan


Nick Coghlan  added the comment:

python-dev thread with more discussion of the patch: 
https://mail.python.org/pipermail/python-dev/2018-September/155188.html

Note that my comment above was based on a misunderstanding of what the patch 
does - the module level code still gets executed at import time, what's able to 
be avoided is the unmarshalling costs.

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

> I think it would be nice if tweaked support.transient_internet() to catch 
> EADDRNOTAVAIL.

Sure, that sounds like a reasonable change? Do you want to work on a PR? If 
not, maybe we should open a new issue, since this issue is tidly linked to 
test_nntplib, whereas modifying support.transient_internet() is a more generic 
change.

--

___
Python tracker 

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



[issue34247] PYTHONOPTIMIZE ignored in 3.7.0 when using custom launcher

2018-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

> The "ill-defined" in Python 3.6 relates to the fact that we never actually 
> defined or tested which environment variables were read by Py_Main and which 
> ones were read by Py_Initialize, since the majority of our tests only covered 
> Py_Main (by launching a full Python subprocess).
>
> Thus the only way to find out which environment variables fell into which 
> category would be to read the Python 3.6 source code.

Oh ok, I see. Thanks for the explanation.

> That's technically still the case for Python 3.7, but Victor's done some 
> excellent refactoring work so it's much clearer in the code which vars may be 
> updated if Py_Initialize is run a second time.

Well, for me the most important part is not the code, but tests. test_embed 
currently tests the following environment variables:

static void test_init_env_putenvs(void)
{
putenv("PYTHONHASHSEED=42");
putenv("PYTHONMALLOC=malloc_debug");
putenv("PYTHONTRACEMALLOC=2");
putenv("PYTHONPROFILEIMPORTTIME=1");
putenv("PYTHONMALLOCSTATS=1");
putenv("PYTHONUTF8=1");
putenv("PYTHONVERBOSE=1");
putenv("PYTHONINSPECT=1");
putenv("PYTHONOPTIMIZE=2");
putenv("PYTHONDONTWRITEBYTECODE=1");
putenv("PYTHONUNBUFFERED=1");
putenv("PYTHONNOUSERSITE=1");
putenv("PYTHONFAULTHANDLER=1");
putenv("PYTHONDEVMODE=1");
/* FIXME: test PYTHONWARNINGS */
/* FIXME: test PYTHONEXECUTABLE */
/* FIXME: test PYTHONHOME */
/* FIXME: test PYTHONDEBUG */
/* FIXME: test PYTHONDUMPREFS */
/* FIXME: test PYTHONCOERCECLOCALE */
/* FIXME: test PYTHONPATH */
}

As you can see, the test suite is not complete yet. But since the tests are 
there, it shouldn't be hard to extend the test suite.

test_embed has InitConfigTests in 3.7 and master branches. I'm not interested 
to backport these tests to 3.6. I modified Python initialization deeply in 3.7, 
and the status of the code in 3.6 is "undefined". I don't think that it's worth 
it to backport these tests to 2.7 or 3.6. I success to focus on the master 
branch where we want to finish the implementation of the PEP 432 which should 
provide a better *public* API for that.

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

> Sure, that sounds like a reasonable change? 

Oh, typo: you should read "Sure, that sounds like a reasonable change." :-)

--

___
Python tracker 

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



[issue30140] Binary arithmetic does not always call subclasses first

2018-09-20 Thread Nick Coghlan


Nick Coghlan  added the comment:

Note that we've left a similar operand precedence handling issue languishing 
for a long time over compatibility concerns: https://bugs.python.org/issue11477

In that case, NumPy is actually benefiting from the discrepancy with the 
documentation though, as the lower-than-expected precedence of sq_concat and 
sq_repeat is what allows NumPy arrays to always take precedence over builtin 
container types, even when the array is the right hand operand.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue34247] PYTHONOPTIMIZE ignored in 3.7.0 when using custom launcher

2018-09-20 Thread Nick Coghlan


Nick Coghlan  added the comment:

Yep, exactly - things are much improved already, thanks primarily to your work, 
and it seems likely they'll be even further improved by the time 3.8.0 comes 
around :)

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:

Yeah, I will submit a pull request today. The reason I reopened this issue is 
that I didn't want to file another issue for a similar problem and wanted to 
use this as a meta issue for issues with test_nntplib. Also, I'd like to play 
Martin's patches a bit and see if they still needed.

--

___
Python tracker 

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



[issue34663] Support POSIX_SPAWN_USEVFORK flag in posix_spawn

2018-09-20 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Same here, even if I learned more about the implementation of posix_spawn than 
I should have to know ;-)

--

___
Python tracker 

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



[issue34752] warnings.warn fails silently with unicode input

2018-09-20 Thread Nicholas Parslow

New submission from Nicholas Parslow :

example:

Python 2.7.14 |Anaconda, Inc.| (default, Dec  7 2017, 17:05:42) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.warn(u'blé')
>>> warnings.warn('blah')
__main__:1: UserWarning: blah

the warnings.warn_explicit function seems to be the part that is failing. On a 
machine which doesn't use anaconda it fails in an identical manner.

if you do:
>>> with warnings.catch_warnings(record=True) as w:
...   warnings.warn(u'blé')
... 
>>> w
[]
>>> w[0].message
UserWarning(u'bl\xe9',)


I can get that it fails with unicode (though it's annoying) but the silent fail 
is really bad imo.

--
components: Extension Modules
messages: 325880
nosy: nparslow
priority: normal
severity: normal
status: open
title: warnings.warn fails silently with unicode input
versions: Python 2.7

___
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-20 Thread Ethan Furman


Ethan Furman  added the comment:

`locals()` returns the dictionary being used (an _EnumDict) and direct 
assignment uses the `__setitem__` method, which has been overridden -- and it 
is the only one; so `update()`, etc., still have normal dict meanings and not 
Enum ones.

Next step:  compile list of all methods that _EnumDict should override.

Or just say it's not supported.

Antony, can you give a more detailed use-case?  Meaning an actual example, 
please.

--
assignee:  -> ethan.furman
nosy: +ethan.furman
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



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

2018-09-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

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


Serhiy Storchaka  added the comment:

PR 9445 is an implementation of this idea. For simplicity and for reducing 
affect on tests no deprecation warning is raised, and there is no validation of 
the type of argument for old classes. Num('123') will just return 
Constant('123') without errors and warnings. isinstance(Constant('123'), Num) 
will return False, and isinstance(Constant('123'), Str) will return True.

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests: +8861
stage: needs patch -> patch review

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> It's not hard to come up with a hash collision for tuples:

Nor is it hard to come up with collisions for most simple hash functions.  For 
typical use cases of tuples, what we have works out fine (it just combined the 
effects of the underlying hashes).

> The underlying reason is that the hashing code mixes ^ and *. 

Addition also has a relationship to multiplication.   I think the XOR is fine.

> A simple Bernstein hash suffices.

That is more suited to character data and small hash ranges (as opposed to 
64-bit).  

>  On top of that, the hashing code for tuples looks 
> needlessly complicated.

The important thing is that it has passed our testing (see the comment above) 
and that it compiles nicely (see the tight disassembly below).


--

L82:
xorq%r14, %rax
imulq   %rbp, %rax
leaq82518(%rbp,%r12,2), %rbp
movq%r13, %r12
movq%rax, %r14
leaq-1(%r13), %rax
cmpq$-1, %rax
je  L81
movq%rax, %r13
L73:
addq$8, %rbx
movq-8(%rbx), %rdi
call_PyObject_Hash
cmpq$-1, %rax
jne L82

--
components: +Interpreter Core
nosy: +rhettinger
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
type:  -> performance
versions: +Python 3.8

___
Python tracker 

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



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

2018-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

+1. I wanted to propose this change while I was working on FAT Python, but I 
waited until I "completed" this project. Sadly, I abandonned the FAT Python. 
And I wasn't brave enough to propose to break the AST.

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8862

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8863

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 8213eaddf3ce8e87564d2949454903a1484748b5 by Berker Peksag in 
branch 'master':
bpo-19756: Prevent test failures due to EADDRNOTAVAIL (GH-9446)
https://github.com/python/cpython/commit/8213eaddf3ce8e87564d2949454903a1484748b5


--

___
Python tracker 

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



[issue34694] Dismiss To Avoid Slave/Master wording cause it easier for non English spoken programmers

2018-09-20 Thread Steve Dower


Change by Steve Dower :


--
nosy:  -steve.dower

___
Python tracker 

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



[issue34753] Use coroutine object or coroutine function instead of coroutine

2018-09-20 Thread Windson Yang

New submission from Windson Yang :

A PR https://github.com/python/cpython/pull/9408 solved an ambiguous problem 
about coroutine. Which led me to 
https://docs.python.org/3/library/asyncio-task.html#awaitables

> Note that in this documentation the term “coroutine” can be used for two 
> closely related concepts:

> a coroutine function: an async def function;
> a coroutine object: object returned by calling a coroutine function.

This will let people confused. IMO we should use `coroutine object` or 
`coroutine function` instead of coroutine when it means an object. For 
instance, L22 in 
https://github.com/python/cpython/blob/471503954a91d86cf04228c38134108c67a263b0/Doc/library/asyncio-api-index.rst

> Create event loop, run a coroutine, close the loop.
should be
> Create event loop, run a coroutine object, close the loop.

--
assignee: docs@python
components: Documentation
messages: 325886
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: Use coroutine object or coroutine function instead of coroutine
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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 476177005e8c8d4ece3070c8c378f8b8c068e76f by Berker Peksag (Miss 
Islington (bot)) in branch '3.7':
bpo-19756: Prevent test failures due to EADDRNOTAVAIL (GH-9446)
https://github.com/python/cpython/commit/476177005e8c8d4ece3070c8c378f8b8c068e76f


--

___
Python tracker 

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



[issue32215] sqlite3 400x-600x slower depending on formatting of an UPDATE statement in a string

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8864

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8865

___
Python tracker 

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



[issue34694] Dismiss To Avoid Slave/Master wording cause it easier for non English spoken programmers

2018-09-20 Thread Jose Angel Acosta


Jose Angel Acosta  added the comment:

I'm so sorry to see my proposal just derived in personal attacks.
The problem here is the core who  "owns" python, admited a change to the 
Language documentation on whats should be considered a political or cultural 
bias w/o considering the broad community OPINION, I wont name it irresponsible 
but fairly disconnected with the purpose of OpenSource: freedom as on free 
speech, which is something being censored by latest core's commit on suggestion 
based on political or cultural bias, not code usability.
In other instances or communities it should have been enough to ask for the 
resignation of those that allowed this distortion introduced into the project 
-owned by the community, not the core approving commits-.

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset 1eabe19c57938dd70b66b97239be337294e15cba by Miss Islington (bot) 
in branch '3.6':
bpo-19756: Prevent test failures due to EADDRNOTAVAIL (GH-9446)
https://github.com/python/cpython/commit/1eabe19c57938dd70b66b97239be337294e15cba


--
nosy: +miss-islington

___
Python tracker 

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



[issue34754] test_flush_return_value fails on FreeBSD

2018-09-20 Thread Berker Peksag


New submission from Berker Peksag :

==
FAIL: test_flush_return_value (test.test_mmap.MmapTests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_mmap.py", 
line 754, in test_flush_return_value
self.assertRaises(OSError, mm.flush, 1, len(b'python'))
AssertionError: OSError not raised by flush

I think I was relying on the behavior of Linux in that assert, it might be 
better to run that assert only under Linux.

--
assignee: berker.peksag
components: Tests
messages: 325890
nosy: berker.peksag, koobs
priority: normal
severity: normal
stage: needs patch
status: open
title: test_flush_return_value fails on FreeBSD
type: behavior
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



[issue34751] Hash collisions for tuples

2018-09-20 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Nor is it hard to come up with collisions for most simple hash functions.

The Bernstein hash algorithm is a simple algorithm for which it can be proven 
mathematically that collisions cannot be generated if the multiplier is 
unknown. That is an objective improvement over the current tuple hash. Of 
course, in practice the multiplier is not secret, but it suffices that it is 
random enough.

> Addition also has a relationship to multiplication.

Of course, but not in a way that can be used to generate hash collisions. In 
fact, the simple relation between addition and multiplication makes this an 
actual provable mathematical statement.

> That is more suited to character data and small hash ranges (as opposed to 
> 64-bit).

Maybe you are thinking of the multiplier 33 which is classically used for 
character data? If you replace the multiplier 33 by a larger number like 
_PyHASH_MULTIPLIER == 103 (ideally it would be a truly random number), it 
works fine for arbitrary sequences and arbitrary bit lengths.

> The important thing is that it has passed our testing

That's a silly argument. If it passed testing, it is only because the testing 
is insufficient.

But really: what I am proposing is a better hash without obvious collisions 
which won't be slower than the existing hash. Why would you be against that? 
Why should we "roll our own" hash instead of using a known good algorithm?

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

___
Python tracker 

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



[issue34754] test_flush_return_value fails on FreeBSD

2018-09-20 Thread Berker Peksag


Change by Berker Peksag :


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

___
Python tracker 

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



[issue32215] sqlite3 400x-600x slower depending on formatting of an UPDATE statement in a string

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 015cd0f5cb17b1b208a92e549cd665dc38f2f699 by Berker Peksag (Miss 
Islington (bot)) in branch '3.7':
bpo-32215: Fix performance regression in sqlite3 (GH-8511)
https://github.com/python/cpython/commit/015cd0f5cb17b1b208a92e549cd665dc38f2f699


--

___
Python tracker 

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



[issue32215] sqlite3 400x-600x slower depending on formatting of an UPDATE statement in a string

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8867

___
Python tracker 

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



[issue34743] test_database_source_name fails with SQLite 3.7.9

2018-09-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8868

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset 170ea8ccd4235d28538ab713041502d07ad1cacd by Miss Islington (bot) 
in branch '2.7':
bpo-19756: Prevent test failures due to EADDRNOTAVAIL (GH-9446)
https://github.com/python/cpython/commit/170ea8ccd4235d28538ab713041502d07ad1cacd


--

___
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-20 Thread Antony Lee


Antony Lee  added the comment:

I have a personal helper function for writing (Qt) GUIs that generates 
ComboBoxes from Enums; essentially something like

class Choices(Enum):
choice1 = "text for choice 1"
choice2 = "text for choice 2"

def callback(choice: Choices):
# do stuff based on choice
pass

create_combobox(Choices, callback=callback)

I'm not including the actual code for create_combobox because it's not 
particularly relevant here.

So far, if I wanted to add methods to the Choice enum (e.g. for simplifying the 
code in `callback`), I could do it directly; if I wanted to dynamically 
generate the list of choices, I could also do it (by using the functional API). 
 But to do both, it would have been nice to use the locals().update approach in 
the bug report above.  Instead, I need to do something like

class MethodsMixin(Enum):
def method(self): ...

ChoicesWithMethods = MethodsMixin("ChoicesWithMethods", [])

(As a side note, I originally thought I could do the inheritance in the 
opposite direction

Choices = Enum("Choices", [...])

class ChoicesWithMethods(Choices):
def method(self): ...

but that fails because Choices is a final class.  It would be nice if it was 
still possible to inherit from Choices *as long as only methods are added, 
rather than new members* (I understand why adding new members is problematic).  
But this is really a side point.)

Making _EnumDict actually support update() and every other relevant method is 
actually not particularly difficult: I think you just need to make it inherit 
from (collections.abc.MutableMapping, dict) (in that order); this is exactly 
the approach used (since a while ago) by matplotlib's RcParams class 
(https://github.com/matplotlib/matplotlib/blob/v3.0.0/lib/matplotlib/__init__.py#L783).

--

___
Python tracker 

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



[issue34648] Confirm the types of parameters of traceback.format_list and traceback.StackSummary.from_list post-3.5

2018-09-20 Thread Nathaniel Manista

Nathaniel Manista  added the comment:

> In 3.4, format_list() was documented to accept return values of extract_tb() 
> > and extract_stack() functions and they both were returned lists:
> 
> def extract_tb(tb, limit=None):
> return list(_extract_tb_iter(tb, limit=limit))
> 
> def extract_stack(f=None, limit=None):
> stack = list(_extract_stack_iter(_get_stack(f), limit=limit))
> stack.reverse()
> return stack

I think that’s an unnecessarily and extraordinarily narrow reading - you could 
use the same reading to make a judgement of “format_list may only be passed 
values returned by extract_tb and extract_stack rather than other values of the 
same type”, and that would be absurd.

I don’t think it’s a wise choice to say “because the motivation for offering 
the format_list function was to work with values returned by extract_tb and 
extract_stack, the allowed inputs to format_list should be restricted to just 
those types”.

Why not support Iterable[FrameSummary]? A choice to support 
Iterable[FrameSummary] *is also a choice to support List[FrameSummary]*. It's 
just a "wider" choice; it’s not a breaking choice to drop support for 
List[FrameSummary].

> I don't think we support the "pass manually created iterables" case here.

What’s a “manually created iterable”? What kinds of iterables aren’t “manually 
created iterables”? Can their differences be captured in the type system?

> Yes, the old API is still supported for backwards compatibility reasons.

This is a very flat statement that invites questions by what it doesn’t say and 
by the way it describes something that is true today without saying for how 
long into the future that thing will remain true. For how long will the old API 
be supported for backwards compatibility reasons? Is new code encouraged to use 
the new API? If the new API is better, shouldn’t new code use it? If the new 
API isn’t better, why was it introduced?

--

___
Python tracker 

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



[issue19756] test_nntplib: sporadic failures, network isses? server down?

2018-09-20 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Berker! Do you want to do something with Martin's patches? If not, can 
you please close the issue?

--

___
Python tracker 

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



[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-20 Thread Eric Snow


Eric Snow  added the comment:

FWIW, the PEP 520 example isn't exactly right.  PEP 520 is about the class 
definition namespace, not the namespace object passed to type().  That always 
does the right thing, since the default class definition namespace is dict 
(which happens to be ordered in 3.6+).

That said, a test that explicitly calls type() with an OrderedDict, as you have 
shown, is still a good idea since type() always changes the namespace to a dict.

Perhaps another good test of the same thing would be with a metaclass that 
returns an OrderedDict from __prepare__():

  class Meta(type):
  @classmethod
  def __prepare__(meta, name, bases, **kwargs):
  return OrderedDict()

  class Spam(metaclass=Meta):
  a = 1
  b = 2

  Spam.__dict__

Just keep in mind that neither of those is specific to PEP 520.

--

___
Python tracker 

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



[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-20 Thread Eric Snow


Change by Eric Snow :


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

___
Python tracker 

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



[issue34320] Creating dict from OrderedDict doesn't preserve order

2018-09-20 Thread Eric Snow


Eric Snow  added the comment:

FWIW, the PEP 520 example isn't exactly right.  PEP 520 is about the class 
definition namespace, not the namespace object passed to type().  That always 
does the right thing, since the default class definition namespace is dict 
(which happens to be ordered in 3.6+).

That said, a test that explicitly calls type() with an OrderedDict, as you have 
shown, is still a good idea since type() always changes the namespace to a dict.

Perhaps another good test of the same thing would be with a metaclass that 
returns an OrderedDict from __prepare__():

  class Meta(type):
  @classmethod
  def __prepare__(meta, name, bases, **kwargs):
  return OrderedDict()

  class Spam(metaclass=Meta):
  a = 1
  b = 2
  locals().move_to_end('a')

  Spam.__dict__

Just keep in mind that neither of those is specific to PEP 520.

--

___
Python tracker 

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



[issue34011] Default preference not given to venv DLL's

2018-09-20 Thread Steve Dower


Steve Dower  added the comment:

This change breaks a number of tests when run on a proper installation, since 
we still need to copy pythonXY.dll or else python.exe refuses to start.

Since I'm fixing these tests today, I'll also fix this issue.

--
assignee:  -> steve.dower

___
Python tracker 

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



[issue16438] Numeric operator predecence confusing

2018-09-20 Thread Elliot Edmunds


Elliot Edmunds  added the comment:

I agree that linking to the precedence table is probably the best solution.

A different option would be to add an extra column listing the "priority" and 
rank the priorities of the different operations.

--
nosy: +Elliot Edmunds

___
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-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8869

___
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-20 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset e247b46cba4f4d32ea96a15dbc36d73265171106 by Yury Selivanov in 
branch 'master':
bpo-33649: More improvements (GH-9439)
https://github.com/python/cpython/commit/e247b46cba4f4d32ea96a15dbc36d73265171106


--

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


New submission from Serhiy Storchaka :

* Perform cheap comparison with None before expensive checks in 
task_step_impl().
* Use more efficient private API for getting and setting an optional attribute.
* Use PyGen_Check() instead of inspect.isgenerator().
* Use faster and more idiomatic way of getting the name of the type.

--
messages: 325902
nosy: asvetlov, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Few minor optimizations in _asynciomodule.c
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



[issue34755] Few minor optimizations in _asynciomodule.c

2018-09-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue34754] test_flush_return_value fails on FreeBSD

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset bc854750589d4de0fd55693963964e0558b5c8ac by Berker Peksag in 
branch 'master':
bpo-34754: Fix test_flush_return_value on FreeBSD (GH-9451)
https://github.com/python/cpython/commit/bc854750589d4de0fd55693963964e0558b5c8ac


--

___
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-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't feel confident reviewing the code, but I'm okay with the change. Can 
you describe what usages of the old API will continue to work, and what part 
will break? (It would seem that code that creates a tree using e.g. Num(42) 
will still work, but code inspecting a tree won't see any Num instances, only 
Constant instances.)

--

___
Python tracker 

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



[issue26119] Windows Installer can sometimes silently fail pip stage

2018-09-20 Thread Steve Dower


Change by Steve Dower :


--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue33649] asyncio docs overhaul

2018-09-20 Thread miss-islington


miss-islington  added the comment:


New changeset 8e5ef58c10a1154f824d5875c2d89794a800eadc by Miss Islington (bot) 
in branch '3.7':
bpo-33649: More improvements (GH-9439)
https://github.com/python/cpython/commit/8e5ef58c10a1154f824d5875c2d89794a800eadc


--

___
Python tracker 

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



[issue32557] allow shutil.disk_usage to take a file path on Windows also

2018-09-20 Thread Joe Pamer


Joe Pamer  added the comment:

Awesome - thanks, Steve - this is all super helpful! If you're cool with it I'd 
like to stick to using _dirnameW for now, and then follow up with another set 
of PRs for the fixes you've recommended.

--

___
Python tracker 

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



[issue34732] uuid returns version more than 5

2018-09-20 Thread Richard Neumann


Richard Neumann  added the comment:

I updated my pull request.
Since "_windll_getnode()" is only returning a (random?) node for a UUID, I 
circumevented the value checking by introducing a new keyword-only argument 
"strict" defaulting to "True", there being set to "False".

--

___
Python tracker 

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



[issue34753] Use coroutine object or coroutine function instead of coroutine

2018-09-20 Thread Yury Selivanov


Yury Selivanov  added the comment:

> This will let people confused. IMO we should use `coroutine object` or 
> `coroutine function` instead of coroutine when it means an object.

I'm not sure that it's a good idea to apply this change everywhere, but I think 
in general this is a good idea.  Do you want to submit a PR?

--
nosy: +yselivanov

___
Python tracker 

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



[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-20 Thread paul j3


paul j3  added the comment:

While I don't think this change will cause any backward compatibility issues, I 
wonder whether it does much good.

https://docs.python.org/3/library/argparse.html#exiting-methods

already documents the option of customizing `parser.exit` and `parser.error`

parser.exit has the optional status argument (default 0).

I don't see how an error method with optional status can be used without some 
sort of subclassing.  At least not for standard argparse errors.  It would only 
help for custom error calls. 

parser.error('my own error message', status=0)

The usual errors are issued with a

self.error(message)

call.

Unittest, 'test_argparse.py' has a ErrorRaisingArgumentParser class that 
customizes both error() and exit().  But its error catching code is a bit 
complicated.

Another SO reference on argparse unittesting:

https://stackoverflow.com/questions/39028204/using-unittest-to-test-argparse-exit-errors

--

___
Python tracker 

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



[issue34648] Confirm the types of parameters of traceback.format_list and traceback.StackSummary.from_list post-3.5

2018-09-20 Thread Berker Peksag

Berker Peksag  added the comment:

> Why not support Iterable[FrameSummary]?

The question that needs to be answered here is "why we should support 
Iterable[FrameSummary]?" and you're one the one who needs to answer it instead 
of saying our design decisions were "absurd" and "not wise", without giving any 
concrete use cases for your "wider" design choice.

Initial docstring for format_list() were added in 2000: 
https://github.com/python/cpython/commit/e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757#diff-e57ff53a569d0ebbe201ad0c102ee27e

Given a list of tuples as returned by extract_tb() or
extract_stack(), return a list of strings ready for printing.

There are no tests for iterables other than list at 
https://github.com/python/cpython/blob/master/Lib/test/test_traceback.py 

So we won't change documentation and docstrings, add more tests without seeing 
concrete use cases.

> What’s a “manually created iterable”?

I meant an iterable that is extracted from a traceback object manually without 
using extract_tb() or extract_stack() functions (by using a custom function, an 
external dependency, or HTTP API) How people can get Iterable[FrameSummary] as 
an input and pass it to format_list()?

> For how long will the old API be supported for backwards
> compatibility reasons?

I don't remember any plans to remove the support for the old API. And I'm 
pretty sure we won't do anything until 2.7 is out of maintenance.

> Is new code encouraged to use the new API? If the new API is better,
> shouldn’t new code use it? If the new API isn’t better, why was it
> introduced?

Are you serious? No, we've introduced the new API and spent weeks designing it 
just to play with people. They should stick with the old one for no reason.

--

___
Python tracker 

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



[issue30947] Update embeded copy of libexpat from 2.2.1 to 2.2.3

2018-09-20 Thread Christian Heimes


Christian Heimes  added the comment:

Victor, the PR for this BPO has introduced XML_POOR_ENTROPY. Neither the commit 
message nor the issue explains why. Which platform failed to compile without 
XML_POOR_ENTROPY?

--

___
Python tracker 

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



[issue32215] sqlite3 400x-600x slower depending on formatting of an UPDATE statement in a string

2018-09-20 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 4fb672ff96ecbb87aaf2ecc4f04aed76aafe63b1 by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-32215: Fix performance regression in sqlite3 (GH-8511)
https://github.com/python/cpython/commit/4fb672ff96ecbb87aaf2ecc4f04aed76aafe63b1


--

___
Python tracker 

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



  1   2   >