[issue27749] python 3.5.2 maybe crash

2016-08-12 Thread Eryk Sun

Eryk Sun added the comment:

To diagnose the access violation, it may help if you install the debug binaries 
and try to reproduce the crash using python_d.exe. Attach the dump file to this 
issue.

Regarding the multiprocessing question, if its a separate issue you need to 
file it on its own and nosy davin. At first glance, I don't see why the handle 
is None in the lock's __exit__ method. After you acquire the lock, try logging 
the connection information. For example:

import multiprocessing as mp
import multiprocessing.util

def test(lock):
with lock:
mp.util.info('test:lock:token: %r' % (lock._token,))
mp.util.info('test:lock:handle: %r' % 
(lock._tls.connection._handle,))

if __name__ == '__main__':
mp.util.log_to_stderr(mp.util.INFO)
lock = mp.Manager().Lock()
p = mp.Process(target=test, args=(lock,))
p.start()
p.join()

--
nosy: +eryksun

___
Python tracker 

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



[issue27749] python 3.5.2 maybe crash

2016-08-12 Thread Eryk Sun

Changes by Eryk Sun :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue27698] socketpair not in socket.__all__ on Windows

2016-08-12 Thread Eryk Sun

Changes by Eryk Sun :


--
keywords: +easy

___
Python tracker 

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



[issue24637] locals dictionary in PyRun_String

2016-08-12 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the patch, Matthew!

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



[issue24637] locals dictionary in PyRun_String

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0f2a09950ac8 by Berker Peksag in branch '3.5':
Issue #24637: Document that locals can be any mapping object
https://hg.python.org/cpython/rev/0f2a09950ac8

New changeset 61c4dbec2e2c by Berker Peksag in branch 'default':
Issue #24637: Merge from 3.5
https://hg.python.org/cpython/rev/61c4dbec2e2c

--
nosy: +python-dev

___
Python tracker 

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



[issue27751] Itertools -> Recipes -> pairwise()

2016-08-12 Thread Tim Peters

Changes by Tim Peters :


--
resolution:  -> rejected
stage:  -> resolved

___
Python tracker 

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



[issue27751] Itertools -> Recipes -> pairwise()

2016-08-12 Thread YoSTEALTH

YoSTEALTH added the comment:

Tim, I get what you are saying good point.

--
status: open -> closed

___
Python tracker 

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



[issue27751] Itertools -> Recipes -> pairwise()

2016-08-12 Thread Tim Peters

Tim Peters added the comment:

Note that "iterable" covers a world of things that may not support indexing 
(let alone slicing).  For example, it may be a generator, or a file open for 
reading.

--
nosy: +tim.peters

___
Python tracker 

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



[issue27751] Itertools -> Recipes -> pairwise()

2016-08-12 Thread YoSTEALTH

New submission from YoSTEALTH:

# Link: https://docs.python.org/3/library/itertools.html#itertools-recipes
# Function pairwise() in Itertools -> Recipes could be improved!? Here is the 
code:


import time
import itertools


def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = itertools.tee(iterable)
next(b, None)
return zip(a, b)


def new_pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
return zip(iterable, iterable[1:])


combine = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)


if __name__ == '__main__':
start_time = time.time()

# Current
print('Current:')
print(list(pairwise(combine)))
# output: [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8), 
(8, 9)]

print()

# New
print('New:')
print(list(new_pairwise(combine)))
# output: [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8), 
(8, 9)]

# Benchmark
# for _ in range(100):
# list(pairwise(combine))  # Time: 2.61199975
# list(new_pairwise(combine))  # Time: 1.14828038

print('\n\nTime: {}'.format(round(time.time() - start_time, 8)), end='')

--
messages: 272572
nosy: YoSTEALTH
priority: normal
severity: normal
status: open
title: Itertools -> Recipes -> pairwise()
type: performance
versions: Python 3.5

___
Python tracker 

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



[issue27038] Make os.DirEntry exist

2016-08-12 Thread Brendan Moloney

Brendan Moloney added the comment:

It makes it much easier to write functions that can work with either a DirEntry 
object or a plain path.

--

___
Python tracker 

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



[issue27038] Make os.DirEntry exist

2016-08-12 Thread Brett Cannon

Brett Cannon added the comment:

Exposing a class method to construct one is no different than exposing the 
constructor, so it's still not desired to have. What is the specific need you 
have for creating a DirEntry instance on its own?

--

___
Python tracker 

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



[issue27038] Make os.DirEntry exist

2016-08-12 Thread Brendan Moloney

Brendan Moloney added the comment:

It would be nice if there was a supported way to create a DirEntry object from 
a path. If you don't want to document the constructor perhaps expose some 
helper function or class method (i.e. from_path)?

--
nosy: +moloney

___
Python tracker 

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



[issue24773] Implement PEP 495 (Local Time Disambiguation)

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 71a7db7ceabc by Alexander Belopolsky in branch 'default':
Issue #24773: Skip system tests for transitions in year 2037 and later.
https://hg.python.org/cpython/rev/71a7db7ceabc

--

___
Python tracker 

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



[issue27714] some test_idle tests are not re-runnable, producing false failures with regrtest -w option

2016-08-12 Thread Ned Deily

Ned Deily added the comment:

>So what happens if you comment out line 34?
>  macosx.setupApp(cls.root, None)

That seems to eliminate the intermittent "IndexError: list assignment index out 
of range" and doesn't seem to cause any new errors.

--

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-12 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

> All that said, I agree with Mark that math.e is at best an attractive 
> nuisance.

Why don't we fix the nuisance part without making it less attractive:

class _E(float):
def __pow__(self, other):
if self is e:
return exp(other)
else:
return pow(self, other)

e = _E(2.718281828...)

> It's okay if Python occasionally shows its lighter side in unexpected places.

I would rather see

from math import π

work in the future Pythons.

I like Vi Hart, but I am firmly on the π side in the π vs. τ debate.  The 
problem with τ is that it is visually smaller than π, actually twice smaller: π 
≈ ττ, but the actual definition is the opposite.

--
nosy: +belopolsky

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-08-12 Thread Keith Brafford

Keith Brafford added the comment:

Serge, I wrote this awhile back, before I learned you aren't supposed to 
subclass built-in types.  Is this the type of effect you're looking for?

https://gist.github.com/kbrafford/da39e06d18b6df2a0eecb4493699

Here's an example using it:
https://gist.github.com/kbrafford/e0115e796890fcefb4f0c35248bd05f1

--

___
Python tracker 

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



[issue27736] repeated Py_Initialize/PyRun_SimpleString/Py_Finalize segfaults

2016-08-12 Thread Brett Cannon

Brett Cannon added the comment:

The revision that Ned found only changed posixmodule.c by adding 
PyModule_AddObject(m, "DirEntry", (PyObject *)); at the end of the 
module initializer. Only thing I can think of is it needs to go into the `if 
(!initialized)` block: 
https://github.com/python/cpython/blob/11b48001fb8d908f6db164e9d2233e911f22d4f4/Modules/posixmodule.c#L13214
 (maybe as an else clause for the PyType_Ready() call at 
https://github.com/python/cpython/blob/11b48001fb8d908f6db164e9d2233e911f22d4f4/Modules/posixmodule.c#L13259).

--

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-08-12 Thread Stefan Krah

Stefan Krah added the comment:

On Fri, Aug 12, 2016 at 08:38:52PM +, Serge Stroobandt wrote:
> This should not be that difficult to implement?
> I promise, every six months an engineer will stop by here asking for this. 
> Instead of nagging, this could already have been implemented one way or the 
> other. The large demand for this feature really warrants it. Thanks!

To whom should I send the invoice?

--

___
Python tracker 

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



[issue26223] decimal.to_eng_string() does not implement engineering notation in all cases.

2016-08-12 Thread Serge Stroobandt

Serge Stroobandt added the comment:

What most engineers would like to see implemented in Python is a new 
engineering notation identical to the one implemented in the omnipresent HP 
calculators.

Quoting from the HP-15C Owner's Handbook:
"- In engineering notation, the first significant digit is always present in 
the display. The number you key in after f ENG specifies the number of 
additional digits to which you want to round the display.
- Engineering notation shows all exponents in multiples of three."

Source + examples, see page 59: http://www.hp.com/ctg/Manual/c03030589.pdf

Most of the time, engineers are not after high precision. Ball park figures are 
good enough in a world where everything is built to a specified tolerance. For 
example, most electronic resistors feature 5% tolerance. Safety factors take 
care of the rest and assure a building will not collapse.

This should not be that difficult to implement?
I promise, every six months an engineer will stop by here asking for this. 
Instead of nagging, this could already have been implemented one way or the 
other. The large demand for this feature really warrants it. Thanks!

--

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-12 Thread Paul Sokolovsky

Paul Sokolovsky added the comment:

What about rounding pi to 3 (and tau to 6)?

https://en.wikipedia.org/wiki/Indiana_Pi_Bill (and I'm sure we can find a cute 
video about how cool to have pi as 3 to add it to the docs).

--
nosy: +pfalcon

___
Python tracker 

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



[issue27736] repeated Py_Initialize/PyRun_SimpleString/Py_Finalize segfaults

2016-08-12 Thread Ned Deily

Ned Deily added the comment:

Thanks for the good test, Simon.  Bisection points to b841972ed0bd for 
Issue27038 as the culprit here.  (It was pushed between 3.6.0a2 and a3.)  
Brett, Jelle, can you please take a look at this?  I'm going to keep it as a 
Release Blocker for now.

--
assignee:  -> brett.cannon
nosy: +Jelle Zijlstra, brett.cannon
stage:  -> needs patch

___
Python tracker 

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



[issue27182] PEP 519 support in the stdlib

2016-08-12 Thread Brett Cannon

Brett Cannon added the comment:

Here is an odd patch because I don't know where else to put it ATM that adds 
the remaining support in the os module/package not covered by other issues w/ 
patches (specifically os.walk() and os.fwalk()). I think everything else simply 
falls through thanks to os.path and path_converter.

--
Added file: http://bugs.python.org/file44091/os.diff

___
Python tracker 

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



[issue27750] Idle editor crashes when input size more than 250 lines given

2016-08-12 Thread chinmay hegde

New submission from chinmay hegde:

Idle editor crashes when input size more than 250 lines given.

Steps to reproduce:-
try with below snippet of code

for i in range(250):
n=input()

Execute the snippet of code. But while giving the input copy all 250 inputs 
with single paste.
Editor is crashed. On clicking it's giving "Not responding"

System Config:-
OS - Windows 10
Python Version - 3.5.2
IDLE version - 3.5.2
Tk version - 8.6.4

--
assignee: terry.reedy
components: IDLE
messages: 272558
nosy: chinmay hegde, terry.reedy
priority: normal
severity: normal
status: open
title: Idle editor crashes when input size more than 250 lines given
type: crash
versions: Python 3.5

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-12 Thread Brett Cannon

Brett Cannon added the comment:

Here is an updated patch that adds in change to posixmodule.c stemming from the 
new warning about using bytearrays. It also makes type checking more stringent 
for what __fspath__() returns.

--
Added file: http://bugs.python.org/file44090/path_converter.diff

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-12 Thread Tim Peters

Tim Peters added the comment:

Serhiy's objection is a little subtler than that.  The Python expression 
`math.log(math.e)` in fact yields exactly 1.0, so IF it were the case that x**y 
were implemented as

math.exp(math.log(x) * y)

THEN math.e**500 would be computed as math.exp(math.log(math.e) * 500) == 
math.exp(1.0 * 500) == math.exp(500.0).

But that's not how x**y is implemented.  Because the error in log() is 
multiplied by y, and then fed into exp() blowing it up even more, only a 
hopelessly naive library would implement pow() that way.  In practice, library 
pow functions fake the effect of at least 15 more bits than native double 
precision to absorb these errors.

Under the covers, then, a reasonable library pow computes math.log(math.e) to 
more than native double precision - and _that_ (internal, invisible) result is 
not 1.0.  Because math.e isn't the mathematical e to begin with.  The 
difference between math.e and the mathematical e is a difference quite visible 
to the internal log, which delivers an internal log not equal to 1, and its 
difference from 1 is "an error" multiplied by 500 and fed into the internal exp 
(blowing up the error even more).

In the end, math.e**500 returns a very good approximation to the true value, 
_given_ that math.e is not e.  There's no reason to hope that's close to 
exp(500), though - that delivers a very good approximation to e**500 (where `e` 
is the true e).  The larger the exponent, the more different math.e**y _should 
be_ from exp(y), and for the same fundamental reason 2**y differs from 3**y (or 
plug in any other pair of distinct bases).

All that said, I agree with Mark that math.e is at best an attractive nuisance. 
 Still, I'm -1 on removing it - it's a traditional and universally embraced 
nuisance ;-)

--

___
Python tracker 

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



[issue27747] Broken example in the queue module documentation

2016-08-12 Thread R. David Murray

Changes by R. David Murray :


--
stage:  -> resolved
type: enhancement -> behavior

___
Python tracker 

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



[issue27712] Tiny typos in import.rst

2016-08-12 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for your work too! :)

--

___
Python tracker 

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



[issue25805] Failure in test_pkgutil run from command-line

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 863258dcb745 by Brett Cannon in branch 'default':
Issue #25805: Skip a test for test_pkgutil when __name__ == __main__.
https://hg.python.org/cpython/rev/863258dcb745

--
nosy: +python-dev

___
Python tracker 

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



[issue25805] Failure in test_pkgutil run from command-line

2016-08-12 Thread Brett Cannon

Changes by Brett Cannon :


--
stage: patch review -> resolved

___
Python tracker 

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



[issue27712] Tiny typos in import.rst

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 927c29e1d646 by Brett Cannon in branch '3.5':
Issue #27712: Fix some typos in the import docs.
https://hg.python.org/cpython/rev/927c29e1d646

New changeset 42a461366d6c by Brett Cannon in branch 'default':
Merge for issue #27712
https://hg.python.org/cpython/rev/42a461366d6c

--
nosy: +python-dev

___
Python tracker 

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



[issue27712] Tiny typos in import.rst

2016-08-12 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the patch!

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



[issue25805] Failure in test_pkgutil run from command-line

2016-08-12 Thread Brett Cannon

Brett Cannon added the comment:

Since most people just run tests using `-m test` I only applied the fix to 3.6. 
Thanks for the patch, SilentGhost!

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

___
Python tracker 

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



[issue25805] Failure in test_pkgutil run from command-line

2016-08-12 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon
nosy: +brett.cannon

___
Python tracker 

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



[issue27594] Assertion failure when running "test_ast" tests with coverage.

2016-08-12 Thread Quentin Pradet

Quentin Pradet added the comment:

Thanks levkivskyi, it fixed the issue for me!

--

___
Python tracker 

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



[issue25805] Failure in test_pkgutil run from command-line

2016-08-12 Thread SilentGhost

SilentGhost added the comment:

Could anyone could have a look at this fairly trivial patch?

--

___
Python tracker 

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



[issue27747] Broken example in the queue module documentation

2016-08-12 Thread Paulo Gabriel Poiati

Paulo Gabriel Poiati added the comment:

You are absolutely right David. I was calling join after putting `None` in the 
queue. Sorry, I'm closing this.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue27748] Simplify test_winsound

2016-08-12 Thread Zachary Ware

New submission from Zachary Ware:

test_winsound is rather annoying.  It currently attempts to determine whether a 
sound card is present, and whether particular system sounds are available.  
These checks are fragile at best, and I routinely see failures that shouldn't 
be.  In particular, if I have an open RDP session to my ware-win81-release 
buildbot, test_winsound fails because it thinks the sounds should fail to play, 
but instead they succeed.

Rather than attempt to make the checks more robust, I suggest that we instead 
rip out the checks and simply ensure that each call that might succeed either 
returns normally or raises RuntimeError.  After all, we can't actually test 
whether a sound really played or not.

--
assignee: zach.ware
components: Tests, Windows
files: simplify_test_winsound.diff
keywords: patch
messages: 272546
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: low
severity: normal
stage: patch review
status: open
title: Simplify test_winsound
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44089/simplify_test_winsound.diff

___
Python tracker 

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



[issue27742] Random.randint generates different values in Python2 and Python3

2016-08-12 Thread SilentGhost

Changes by SilentGhost :


--
stage:  -> resolved

___
Python tracker 

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



[issue27719] Misleading note about "args" attribute in "User-defined Exceptions" section of tutorial

2016-08-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue27719] Misleading note about "args" attribute in "User-defined Exceptions" section of tutorial

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6fdd29a9d5d4 by Raymond Hettinger in branch '3.5':
Issue 27719:  Remove a doc example that is not applicable in Python 3
https://hg.python.org/cpython/rev/6fdd29a9d5d4

--
nosy: +python-dev

___
Python tracker 

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



[issue27742] Random.randint generates different values in Python2 and Python3

2016-08-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Wolfgang, sorry you bumped into this problem and glad that you have a 
workaround.  We only guarantee availability of backward compatible seeders and 
that calls to random() are reproducible.   The other methods are allowed to 
change so that we can make periodic improvements (i.e. using _randbelow to 
favor equidistribution over speed).  Marking this as not a bug and closing.

--
assignee:  -> rhettinger
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue14977] mailcap does not respect precedence in the presence of wildcards

2016-08-12 Thread Fabio Alessandro Locati

Fabio Alessandro Locati added the comment:

Any news on this?

--
nosy: +Fabio Alessandro Locati

___
Python tracker 

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



[issue27747] Broken example in the queue module documentation

2016-08-12 Thread R. David Murray

R. David Murray added the comment:

The example looks correct to me.  Have you tested it and seen it hang?

The q.join() is done, and returns once all the puts have been processed.  
*Then* None is put for each worker, which terminates the worker thread.  
There's no q.join() to block at that point.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27738] odd behavior in creating list of lambda expressions

2016-08-12 Thread John Sahr

John Sahr added the comment:

I eventually figured that out that source of the problem;

thanks for the coding fix; that's useful to know.

-John

On Thu, Aug 11, 2016 at 8:17 AM, Emanuel Barry 
wrote:

>
> Emanuel Barry added the comment:
>
> This is due to the fact that Python evaluates the variable 'n' when the
> function is called, not when it is created. As such, the variable holds the
> latest value for all functions, and they exhibit identical behaviour.
>
> Workaround:
>
> ...
> f = lambda x, n=n: sin(n*x)
> ...
>
> And this should work as you expect. More information is available at
> https://docs.python.org/3/faq/programming.html#why-do-
> lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result
>
> --
> nosy: +ebarry
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
> versions:  -Python 2.7
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27747] Broken example in the queue module documentation

2016-08-12 Thread Paulo Gabriel Poiati

New submission from Paulo Gabriel Poiati:

I believe the code example at https://docs.python.org/3.6/library/queue.html is 
broken. The break condition in the worker loop (when the queued value is None) 
must call the `task_done` before breaking, otherwise the code blocks 
indefinitely in the `queue.join()` statement.

--
assignee: docs@python
components: Documentation
messages: 272540
nosy: Paulo Gabriel Poiati, docs@python
priority: normal
severity: normal
status: open
title: Broken example in the queue module documentation
type: enhancement
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-08-12 Thread Christian Heimes

Changes by Christian Heimes :


Removed file: 
http://bugs.python.org/file44088/Microsoft_Screen_Sharing_for_Lumia_Phones_HD-10_UG_th_TH.pdf

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-08-12 Thread Pan Naekton

Changes by Pan Naekton :


Added file: 
http://bugs.python.org/file44088/Microsoft_Screen_Sharing_for_Lumia_Phones_HD-10_UG_th_TH.pdf

___
Python tracker 

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



[issue25825] AIX shared library extension modules installation broken

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 58c8cae6c61a by Martin Panter in branch '3.5':
Issue #25825: Fix references to Modules/python.exp
https://hg.python.org/cpython/rev/58c8cae6c61a

New changeset 4d4b5b978b7e by Martin Panter in branch 'default':
Issue #25825: Merge AIX fix from 3.5
https://hg.python.org/cpython/rev/4d4b5b978b7e

--
nosy: +python-dev

___
Python tracker 

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



[issue25825] AIX shared library extension modules installation broken

2016-08-12 Thread David Edelsohn

David Edelsohn added the comment:

Yes, please apply Patch 1 that reverts the mistaken change of revision 
88a532a31eb3 .  I want to work through this incrementally so that it's clear to 
reviewers.

--

___
Python tracker 

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



[issue12887] Documenting all SO_* constants in socket module

2016-08-12 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue24363] httplib fails to handle semivalid HTTP headers

2016-08-12 Thread Martin Panter

Martin Panter added the comment:

In order to avoid messing too much with the intricacies of the existing email 
parsing, here is a patch for Python 3 that limits the behaviour changes to the 
HTTP module. It should fix the bad handling of broken header lines. As a side 
effect, it should also fix Issue 22233, since it bypasses the offending 
splitlines() call. I incorporated the test cases from my previous patches for 
Issue 26686 and Issue 22233.

I tried to maintain a minimal compatibility with the previous special behaviour 
for message/* and multipart/* message types, although I didn’t bother trying to 
emulate e.g. StartBoundaryNotFoundDefect (http.client.parse_headers() doesn’t 
pass any body to the email parser, so it won’t see any start boundaries.)

--
dependencies:  -email.parser stops parsing headers too soon when given a 
defective message.
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file44087/bypass-parsegen.patch

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread SilentGhost

SilentGhost added the comment:

Thanks, Lele.

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-08-12 Thread Martin Panter

Martin Panter added the comment:

No super important reason, just to avoid indenting the code. This is a 
medium-sized test function, with a few long lines already. And if you keep the 
indentation the same, it makes it easier to port other changes to Python 2, 
look through the repository history etc.

--

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-08-12 Thread STINNER Victor

STINNER Victor added the comment:

Martin: why don't you use "with"?

--

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-12 Thread STINNER Victor

STINNER Victor added the comment:

> math.e**500 = math.exp(math.log(math.e)*500)

That's the theory if numbers have an infinite precision. In practice,
intermediate results are rounded and have a limited precision.

--

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f78a682a3515 by Martin Panter in branch '3.5':
Issue #26741: Clean up subprocess.Popen object in test_poll
https://hg.python.org/cpython/rev/f78a682a3515

New changeset 7ff3ce0dfd45 by Martin Panter in branch 'default':
Issue #26741: Merge ResourceWarning fixes from 3.5
https://hg.python.org/cpython/rev/7ff3ce0dfd45

--

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 129c601e7bfa by Martin Panter in branch '3.5':
Issue #27745: Fix some typos in Argument Clinic howto, by Lele Gaifax
https://hg.python.org/cpython/rev/129c601e7bfa

New changeset 8c33152fd75c by Martin Panter in branch 'default':
Issue #27745: Merge typo fixes from 3.5
https://hg.python.org/cpython/rev/8c33152fd75c

--
nosy: +python-dev

___
Python tracker 

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



[issue27730] Update shutil to work with max file path length on Windows

2016-08-12 Thread Eryk Sun

Eryk Sun added the comment:

I overlooked some aspects of the problem:

* A short relative path may end up exceeding MAX_PATH when normalized as a 
fully qualified path.
* The working directory may be a UNC path or may already have the \\?\ prefix. 
It's not thread-safe to check this beforehand.
* A path that contains a reserved DOS device name results in a \\.\ path.
 
Thus on second thought I think it's safer to call GetFullPathNameW for all 
paths that lack the \\?\ prefix, and then copy the result if it needs to be 
prefixed by \\?\ or \\?\UNC. The final path, if it's a filesystem path, should 
always use the \\?\ namespace to ensure that functions such as shutil.rmtree 
won't fail. 

For example:

_DOS_DEVICES = ".\\"
_NT_DOS_DEVICES = "?\\"
_NT_UNC_DEVICE = "?\\UNC"

def winapi_path(path):
path = os.fsdecode(path) or '.'
if path.startswith(_NT_DOS_DEVICES):
return path
temp = os.path._getfullpathname(path)
if temp.startswith((_NT_DOS_DEVICES, _DOS_DEVICES)):
return path if temp == path else temp
if temp.startswith(''):
return _NT_UNC_DEVICE + temp[1:]
return _NT_DOS_DEVICES + temp

For reference, here's a typical call pattern when Windows 10.0.10586 converts a 
DOS path to an NT path:

RtlInitUnicodeStringEx
RtlDosPathNameToRelativeNtPathName_U_WithStatus
RtlInitUnicodeStringEx
RtlDosPathNameToRelativeNtPathName
RtlGetFullPathName_Ustr
RtlDetermineDosPathNameType_Ustr
RtlAllocateHeap
memcpy

RtlGetFullPathName_Ustr is called with a buffer that's sizeof(WCHAR) * MAX_PATH 
bytes. GetFullPathNameW also calls RtlGetFullPathName_Ustr, but with a 
caller-supplied buffer that can be up to sizeof(WCHAR) * 32768 bytes.

Here's the call pattern for a \\?\ path:

RtlInitUnicodeStringEx
RtlDosPathNameToRelativeNtPathName_U_WithStatus
RtlInitUnicodeStringEx
RtlDosPathNameToRelativeNtPathName
RtlpWin32NtNameToNtPathName
RtlAllocateHeap
RtlAppendUnicodeStringToString
RtlAppendUnicodeStringToString

RtlpWin32NtNameToNtPathName copies the path, replacing \\? with the object 
manager's \?? virtual DOS devices directory. 

Here's some background information for those who don't already know the basics 
of how Windows implements DOS devices in NT's object namespace, which you can 
explore using Microsoft's free WinObj tool.

In Windows NT 3 and 4 (before Terminal Services) there was a single \DosDevices 
directory, which is where the system created DOS device links to the actual NT 
devices in \Device, such as C: => \Device\HarddiskVolume2. Windows 2000 changed 
this in ways that were problematic, mostly due to using a per-session directory 
instead of a per-logon directory. (Tokens for multiple logon sessions can be 
used in a single Windows session, and almost always are since UAC split tokens 
arrived in Vista.) 

The design was changed again in Windows XP. \DosDevices is now just a link to 
the virtual \?? directory. The system creates DOS devices in a local (per 
logon) directory, except for system threads and LocalSystem logons (typically 
services), which use the \GLOBAL?? directory. The per-logon directories are 
located at \Sessions\0\DosDevices\[LogonAuthenticationId]. The object manager 
parses \?? by first checking the local DOS devices and then the global DOS 
devices. Each local DOS devices directory also has a Global link back to 
\GLOBAL??. It's accessible as \\?\Global\[Device Name], which is useful when a 
local device has the same name as a global one. The root directory of the 
object namespace is accessible to administrators using the \GLOBAL??\GLOBALROOT 
link, which from the Windows API is \\?\GLOBALROOT.

--

___
Python tracker 

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



[issue27746] ResourceWarnings in test_asyncio

2016-08-12 Thread Martin Panter

New submission from Martin Panter:

$ ./python -bWerror -m test -r -u all
. . .
0:12:58 [ 70/402] test_asyncio
Exception ignored in: >
Traceback (most recent call last):
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/sslproto.py", line 
329, in __del__
source=self)
ResourceWarning: unclosed transport 
Exception ignored in: >
Traceback (most recent call last):
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/sslproto.py", line 
329, in __del__
source=self)
ResourceWarning: unclosed transport 
Exception ignored in: >
Traceback (most recent call last):
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/sslproto.py", line 
329, in __del__
source=self)
ResourceWarning: unclosed transport 
Executing .start() done, defined at 
/media/disk/home/proj/python/cpython/Lib/test/test_asyncio/test_pep492.py:149> 
result=None created at 
/media/disk/home/proj/python/cpython/Lib/asyncio/base_events.py:367> took 0.351 
seconds

If necessary, you should be able to run with python -Wall -X tracemalloc=33 to 
get a stack dump where the resources (transport objects or whatever) were 
allocated.

--
components: Tests, asyncio
messages: 272529
nosy: gvanrossum, haypo, martin.panter, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: ResourceWarnings in test_asyncio
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue27539] negative Fraction ** negative int not normalized

2016-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

> _Please_, can this go in before 15th?

Note that this is a bugfix, not a new feature, so it can still go in after the 
15th.

--

___
Python tracker 

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



[issue27594] Assertion failure when running "test_ast" tests with coverage.

2016-08-12 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

You could try changing this line in compile.c (in function 'assemble')

if (entryblock && entryblock->b_instr)

to

if (entryblock && entryblock->b_instr && entryblock->b_instr->i_lineno)

Does this help?

--
nosy: +levkivskyi

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

> According to my testing, math.pow(x, 0.5) is no worse than sqrt.

It certainly is worse than sqrt, both in terms of speed and accuracy. Whether 
the difference is enough to make it worth special-casing is another question, 
of course, and as you say, that can happen later.

--

___
Python tracker 

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



[issue27350] Compact and ordered dict

2016-08-12 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file44086/compact-dict.patch

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-12 Thread Xiang Zhang

Changes by Xiang Zhang :


Added file: http://bugs.python.org/file44085/Py_CompileStringExFlags_doc.patch

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-12 Thread Xiang Zhang

Changes by Xiang Zhang :


Removed file: http://bugs.python.org/file44078/Py_CompileStringExFlags_doc.patch

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I thought about special-casing n=2 to math.sqrt, but as that's an 
implementation detail I can make that change at any time. According 
to my testing, math.pow(x, 0.5) is no worse than sqrt, so I'm not 
sure if there's any advantage to having yet another branch.

I'd be interested in special-casing n=3 to math.cbrt (if and when it exists) 
now that its a standard C99 function.

--

___
Python tracker 

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



[issue27743] Python 2 has a wrong artificial limit on the amount of memory that can be allocated in ctypes

2016-08-12 Thread Eryk Sun

Eryk Sun added the comment:

AFAIK this only affects Windows. It looks like a relatively simple fix. In 
PyCArrayType_new, change the declaration of `length` to Py_ssize_t to match the 
definition StgDictObject.length; ensure the _length_ attribute is an index via 
PyIndex_Check instead of PyInt_Check; and call PyNumber_AsSsize_t instead of 
PyInt_AS_LONG.

--
components: +Windows
nosy: +eryksun, paul.moore, tim.golden, zach.ware

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread SilentGhost

SilentGhost added the comment:

LGTM

--
stage:  -> commit review
type:  -> behavior

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread SilentGhost

Changes by SilentGhost :


--
components: +Documentation
versions: +Python 3.5

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread Lele Gaifax

Changes by Lele Gaifax :


Removed file: http://bugs.python.org/file44083/ac-doc-typos.patch

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread Lele Gaifax

Lele Gaifax added the comment:

Re-uploaded the patch file, without spurious stuff.

--
Added file: http://bugs.python.org/file44084/ac-doc-typos.patch

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread Lele Gaifax

Lele Gaifax added the comment:

Yes, sorry about that, picked the wrong file :-|

I will renew the patch shortly!

--
components:  -Documentation
versions:  -Python 3.5

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread SilentGhost

SilentGhost added the comment:

Then I guess all the changes to Modules/_sqlite.c are there by mistake? Would 
you mid refreshing your patch to remove them?

--
assignee:  -> docs@python
components: +Documentation
nosy: +SilentGhost, docs@python
versions: +Python 3.5

___
Python tracker 

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



[issue27742] Random.randint generates different values in Python2 and Python3

2016-08-12 Thread Antti Haapala

Antti Haapala added the comment:

Anyhow, in this case it is easy to simulate the Python 2 randint behaviour (add 
checks for hi >= lo if needed):

>>> random.seed(5, version=1)
>>> randint_compat = lambda lo, hi: lo + int(random.random() * (hi + 1 - 
lo))
>>> randint_compat(0, 999)
6229016

--

___
Python tracker 

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



[issue27745] Fix typos in Argument Clinic howto

2016-08-12 Thread Lele Gaifax

New submission from Lele Gaifax:

The attached patch, available also as 
https://github.com/lelit/cpython/commit/9e33f33e87ad594daae71ccdbe6f0a5c5f8aca65,
 fixes a few typos in the Argument Clinic howto document.

--
components: Argument Clinic
files: ac-doc-typos.patch
keywords: patch
messages: 272518
nosy: larry, lelit
priority: normal
severity: normal
status: open
title: Fix typos in Argument Clinic howto
versions: Python 3.6
Added file: http://bugs.python.org/file44083/ac-doc-typos.patch

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-08-12 Thread Cory Benfield

Changes by Cory Benfield :


--
nosy: +Lukasa

___
Python tracker 

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



[issue27742] Random.randint generates different values in Python2 and Python3

2016-08-12 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

@SilentGhost: Sorry, I did not see the latest messages, I was referring to 
msg272511

Having to re-implement everything but rnd.random is not very user friendly. I 
will do that now for my project.

--

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-08-12 Thread Christian Heimes

New submission from Christian Heimes:

Linux has a netlink-based user-space interface for Kernel cryptography. Kernel 
based crypto has a couple of advantages that are explained at 
http://www.chronox.de/libkcapi/html/ch01s02.html . The document doesn't mention 
that a crypto socket also supports splicing and sendfile. Files no longer have 
to be copied to user-space.

My experimental branch https://github.com/tiran/cpython/commits/feature/af_alg 
implements af_alg support. Example:

from socket import socket, AF_ALG, SOCK_SEQPACKET, SOL_ALG, ALG_SET_KEY
from binascii import hexlify
with socket(AF_ALG, SOCK_SEQPACKET, 0) as alg:
alg.bind(('hash', 'hmac(sha512)'))
alg.setsockopt(SOL_ALG, ALG_SET_KEY, b'key')
op, _ = alg.accept()
with open('/etc/passwd', 'rb') as f:
op.sendfile(f)
print(hexlify(op.recv(64)))
op.close()

--
components: Extension Modules
messages: 272516
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Add AF_ALG (Linux Kernel crypto) to socket module
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27742] Random.randint generates different values in Python2 and Python3

2016-08-12 Thread SilentGhost

SilentGhost added the comment:

> There seems to be more to it

I'm not sure what "it" are you referring to. The output of randint is not 
guaranteed to be the same across versions, the seeded sequence is still the 
same between python2 and 3 - as documented.

--
title: Random.seed(5, version=1) generates different values in PYthon2 and 
Python3 -> Random.randint generates different values in Python2 and Python3

___
Python tracker 

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread Wolfgang Rohdewald

Wolfgang Rohdewald added the comment:

There seems to be more to it, _randbelow already returns different values. 

And _randbelow is used by other user helpers like randrange, choice, select, 
shuffle, sample

--

___
Python tracker 

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread Antti Haapala

Antti Haapala added the comment:

but yes, now that I read the documentation, 3.5 docs it say very explicitly 
that:

  Two aspects are guaranteed not to change:

- If a new seeding method is added, then a backward compatible seeder will 
be offered.
- The generator’s random() method will continue to produce the same 
sequence when the compatible seeder is given the same seed.

thus no guarantee is given about any other method at all, including randrange 
and randint.

--

___
Python tracker 

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread Antti Haapala

Antti Haapala added the comment:

Sorry + and - are backwards there (I did the delta in wrong direction); + is 
before, and - after Raymond's commit. The `if` was retained there for 
backward-compatibility.

--

___
Python tracker 

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread Antti Haapala

Antti Haapala added the comment:

It is this change in 3.2:

randrange is more sophisticated about producing equally distributed
values.  Formerly it used a style like ``int(random()*n)`` which  '
could produce slightly uneven distributions.

-return self._randbelow(istart)
+if istart >= maxwidth:
+return self._randbelow(istart)
+return int(self.random() * istart)

by rhettinger. Since there has not been any regression tests that the seeded 
numbers would stay compatible, they don't. Perhaps it would be a good idea to 
*add* such tests.

--
nosy: +ztane

___
Python tracker 

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



[issue27743] Python 2 has a wrong artificial limit on the amount of memory that can be allocated in ctypes

2016-08-12 Thread tzickel

New submission from tzickel:

Python 2 has a wrong artificial limit on the amount of memory that can be 
allocated in ctypes via sequence repeating (i.e. using create_string_buffer or 
c_char * )

The problem is practical in Windows 64 bit, when running python 64 bit, since 
in that platform the sys.maxint is 2GB and while sys.maxsize is as large as in 
other platforms, trying to allocate more than 2GB of memory results in a 
different exception than other platforms (where sys.maxint = sys.maxsize):

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, ctypes
>>> ctypes.c_char * (sys.maxint + 1)
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: class must define a '_length_' attribute, which must be a 
positive integer

>>> ctypes.create_string_buffer(sys.maxint + 1)
Traceback (most recent call last):
  File "", line 1, in 
  File "c:\Python27-64\lib\ctypes\__init__.py", line 65, in create_string_buffer
buftype = c_char * init
AttributeError: class must define a '_length_' attribute, which must be a 
positive integer

on other platforms you get:

Traceback (most recent call last):
  File "", line 1, in 
OverflowError: cannot fit 'long' into an index-sized integer

Thus to allocate more than 2GB, you need to use other methods (numpy or 
something else).

>From my reading of the code, I assume the bug is this line:
https://github.com/python/cpython/blob/2.7/Modules/_ctypes/_ctypes.c#L1388

Where the code checks if _length_ is an integer (PyInt_Check). As soon as the 
number is bigger than sys.maxint, it's a long, and while it's a valid size for 
the platform (< sys.maxsize), it will bork there. Since this seems like an 
artificial limit, I think it should be fixed, since it's practical to allocate 
this sizes on 64 bit systems for some applications.

Python 3 has no issue, since it has no int type :)

--
components: ctypes
messages: 272510
nosy: Bob, Christoph Sarnowski, Patrick Stewart, doko, jpe, larry, 
mark.dickinson, mattip, meador.inge, python-dev, rkuska, steve.dower, tzickel, 
vinay.sajip
priority: normal
severity: normal
status: open
title: Python 2 has a wrong artificial limit on the amount of memory that can 
be allocated in ctypes
type: behavior
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



[issue12345] Add math.tau

2016-08-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> To give just one example, on my machine, the result of `exp(500)` has an
> error of 0.42 ulps, while `math.e**500` gives an error of over 150 ulps.

How can it be? math.e**500 = math.exp(math.log(math.e)*500) and 
math.log(math.e) is 1.0.

--

___
Python tracker 

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread SilentGhost

SilentGhost added the comment:

The rnd.random is still producing the same sequence, between versions. randint 
evidently doesn't, but that must be happening elsewhere.

--
components: +Extension Modules
nosy: +SilentGhost, mark.dickinson, rhettinger
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



[issue12345] Add math.tau

2016-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

BTW, if we're talking about useless constants in the math module, it's hard to 
get more useless than `math.e`: it's rare for `e` to turn up in formulas except 
in the form `e**`, and the latter case is better catered for by the 
more accurate (and usually faster) expression `exp(`. I'd even go so 
far as to call `math.e` *worse* than useless, since its presence leads people 
astray by encouraging them to write `math.e**x` instead of `exp(x)`.

To give just one example, on my machine, the result of `exp(500)` has an error 
of 0.42 ulps, while `math.e**500` gives an error of over 150 ulps.

--

___
Python tracker 

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



[issue27742] Random.seed(5, version=1) generates different values in PYthon2 and Python3

2016-08-12 Thread Wolfgang Rohdewald

New submission from Wolfgang Rohdewald:

The documentation promises backwards compatible seeders. I understand this as 
such that they generate the same random sequences. But for Python 2.7.12 and 
3.5.2 this is not so, even if I pass an integer as seed value. The attached 
script returns different values.

Maybe I misunderstand the documentation - I believe it means that 
seed(version=1) uses the backwards compatible seeder, but it does not say so 
explicitly. If that is not so, the documentation does not say how to invoke the 
backwards compatible seeder.

--
components: Library (Lib)
files: r.py
messages: 272506
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: Random.seed(5, version=1) generates different values in PYthon2 and 
Python3
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file44082/r.py

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

The unification of tau2.diff and tau3.diff LGTM; thanks, Lisa!

My commit bit is broken at the moment; anyone in a position to apply those 
patches?

--

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

What no patch for pre-commit review?!

For computing nth roots, it may be worth special-casing the case n=2: for 
floats, `math.sqrt` is likely to be faster and more precise than an ad-hoc 
algorithm. (Indeed, I'd expect it to be perfectly correctly rounded on the vast 
majority of current machines.)

--

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-12 Thread Antti Haapala

Antti Haapala added the comment:

About "I hesitate between the C types "int" and "Py_ssize_t" for nargs. I read 
once that using "int" can cause performance issues on a loop using "i++" and 
"data[i]" because the compiler has to handle integer overflow of the int type."

This is true because of -fwrapv, but I believe it is true also for Py_ssize_t 
which is also of signed type. However, there would be a speed-up achievable by 
disabling -fwrapv, because only then the i++; data[i] can be safely optimized 
into *(++data)

--
nosy: +ztane

___
Python tracker 

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



[issue23545] Turn on extra warnings on GCC

2016-08-12 Thread Antti Haapala

Antti Haapala added the comment:

Ah, indeed, I somehow missed that. Though, there is no good reason for it being 
unsigned either; as the actual type in SSL API's is of type int. Another 
argument of type int is cast to unsigned just for the comparison on line 4419, 
and unsigned int counters i and j are used in function _setup_ssl_threads.

The variable could be safely changed to `size_t` (along with those index 
variables) without it affecting anything at all, as it is a static variable 
within that module and only used to hold a size of an array, and never passed 
back to another function.

--

___
Python tracker 

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



[issue23545] Turn on extra warnings on GCC

2016-08-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Seems GCC is such smart, that can deduce that the maximal value of 
_ssl_locks_count is never larger than PY_SSIZE_T_MAX / 
sizeof(PyThread_type_lock). The other workaround is making _ssl_locks_count of 
type size_t instead of unsigned int, but I wouldn't do this with good reasons.

--

___
Python tracker 

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



[issue27736] repeated Py_Initialize/PyRun_SimpleString/Py_Finalize segfaults

2016-08-12 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +ned.deily
priority: normal -> release blocker

___
Python tracker 

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



[issue27574] Faster parsing keyword arguments

2016-08-12 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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