[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-09-01 Thread Stefan Behnel

Stefan Behnel added the comment:

Looks like I forgot about this. My final fix still hasn't been applied, so the 
code in Py3.4+ is incorrect now.

No, this cannot be tested from the Python level.

--

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

2016-09-01 Thread Stefan Behnel

Stefan Behnel added the comment:

I haven't seen any crashes in the wild here, but this is still the case in the 
latest code base. The change doesn't seem invasive, so I don't see why it 
shouldn't get implemented.

--
nosy: +pitrou, scoder, serhiy.storchaka
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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2016-09-01 Thread Robert Jordens

Robert Jordens added the comment:

https://github.com/python/cpython/blob/master/Lib/asyncio/selector_events.py#L394
https://github.com/python/asyncio/blob/master/asyncio/selector_events.py#L394

AF_UNIX is special-cased.
Maybe AF_BLUETOOTH and others should use that same special treatment.
Or maybe only AF_INET, AF_INET6 should attempt resolving.

--

___
Python tracker 

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



[issue27779] Sync-up docstrings in C version of the the decimal module

2016-09-01 Thread Lisa Roach

Lisa Roach added the comment:

I will start working on the patch for this!

Thanks for pointing me this way, Raymond.

--
nosy: +lisroach

___
Python tracker 

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



[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x

2016-09-01 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
versions:  -Python 3.4

___
Python tracker 

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



[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e82b995d1a5c by Jason R. Coombs in branch '3.4':
Issue #12885: Revert commits in 3.4 branch which is security-only fixes.
https://hg.python.org/cpython/rev/e82b995d1a5c

New changeset a7ce98a4e9e4 by Jason R. Coombs in branch '3.5':
Issue #12885: Merge with 3.4, retaining commits reverted there.
https://hg.python.org/cpython/rev/a7ce98a4e9e4

New changeset fa82fabe9d65 by Jason R. Coombs in branch 'default':
Issue #12885: Merge with 3.5
https://hg.python.org/cpython/rev/fa82fabe9d65

--

___
Python tracker 

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



[issue12285] Unexpected behavior for 0 or negative processes in multiprocessing.pool()

2016-09-01 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Yep. Sorry for the misfile.

--
nosy: +jason.coombs

___
Python tracker 

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



[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 590d0de4ff48 by Jason R. Coombs in branch '3.4':
Issue #12885: Correct issue reference in NEWS
https://hg.python.org/cpython/rev/590d0de4ff48

New changeset 74ccec0bd442 by Jason R. Coombs in branch '3.5':
Issue #12885: Merge 3.4
https://hg.python.org/cpython/rev/74ccec0bd442

New changeset bfff89ed356b by Jason R. Coombs in branch 'default':
Issue #12885: Merge with 3.5
https://hg.python.org/cpython/rev/bfff89ed356b

--

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-09-01 Thread Tim Peters

Tim Peters added the comment:

BTW, add this other way of writing a native-precision Newton step to see that 
it's much worse (numerically) than writing it in the "guess + small_correction" 
form used in roots.py.  Mathematically they're identical, but numerically they 
behave differently:


def native2(x, n):
g = x**(1.0/n)
if g**n == x:
return g
return ((n-1)*g + x/g**(n-1)) / n

--

___
Python tracker 

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



[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x

2016-09-01 Thread Martin Panter

Martin Panter added the comment:

I think you mixed up the bug number. You should probably fix Misc/NEWS.

New changeset 941346104718 by Jason R. Coombs in branch '3.4':
Issue #12285: Add test capturing failure.
https://hg.python.org/cpython/rev/941346104718

New changeset 56c60b3d06fb by Jason R. Coombs in branch '3.4':
Issue #12285: Replace implementation of findall with implementation from 
Setuptools 7ce820d524db.
https://hg.python.org/cpython/rev/56c60b3d06fb

New changeset 13619a3e0737 by Jason R. Coombs in branch '3.4':
Issue #12285: Update NEWS
https://hg.python.org/cpython/rev/13619a3e0737

--
nosy: +martin.panter

___
Python tracker 

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



[issue12285] Unexpected behavior for 0 or negative processes in multiprocessing.pool()

2016-09-01 Thread Martin Panter

Martin Panter added the comment:

Looks like that last lot was meant to reference Issue 12885

--
nosy: +martin.panter

___
Python tracker 

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



[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x

2016-09-01 Thread Jason R. Coombs

Jason R. Coombs added the comment:

This code has been stable in Setuptools for some time, so I've pushed the code 
into the base.

--
resolution:  -> fixed
status: open -> closed
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



[issue12285] Unexpected behavior for 0 or negative processes in multiprocessing.pool()

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 941346104718 by Jason R. Coombs in branch '3.4':
Issue #12285: Add test capturing failure.
https://hg.python.org/cpython/rev/941346104718

New changeset 56c60b3d06fb by Jason R. Coombs in branch '3.4':
Issue #12285: Replace implementation of findall with implementation from 
Setuptools 7ce820d524db.
https://hg.python.org/cpython/rev/56c60b3d06fb

New changeset 13619a3e0737 by Jason R. Coombs in branch '3.4':
Issue #12285: Update NEWS
https://hg.python.org/cpython/rev/13619a3e0737

New changeset ade53661607a by Jason R. Coombs in branch '3.5':
Issue #12285: Merge with 3.4
https://hg.python.org/cpython/rev/ade53661607a

--

___
Python tracker 

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



[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 79422fab2ef4 by Jason R. Coombs in branch 'default':
Issue #12885: Merge with 3.5
https://hg.python.org/cpython/rev/79422fab2ef4

--
nosy: +python-dev

___
Python tracker 

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



[issue15663] Investigate providing Tcl/Tk 8.6 with OS X installers

2016-09-01 Thread Caleb Hattingh

Changes by Caleb Hattingh :


--
nosy: +cjrh

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-09-01 Thread Tim Peters

Tim Peters added the comment:

Attched file "roots.py" you can run to get a guess as to how bad pow(x, 1/n) 
typically is on your box.

Note that it's usually "pretty darned good" the larger `n` is.  There's a 
reason for that.  For example, when n=1000, all x satisfying 1 <= x < 2**1000 
have a root r satisfying 1 <= r < 2.  Mathematically, that's a 1-to-1 function, 
but in floating point there are only 2**52 representable r in the lstter range: 
 the larger n, the more of a many-to-1 function the n'th root is in native 
floating point precision.  That makes it much easier to get the best-possible 
result even by accident ;-)  So, e.g., this kind of output is common for 
"large" n:

n = 2272
x**(1/n)
   -110
0   982
1 8
with 1 native-precision step
all correct
with 1 extended-precision step
all correct

That means that, out of 1000 "random-ish" x, x**(1/2272) returned a result 1 
ulp smaller than best-possible 10 times, 1 ulp too large 8 times, and 
best-possible 982 times ("ulp" is relative to the best-possible result).  Doing 
any form of a single "guess + small_correction" Newton step (in either native 
or extended precision) repaired all the errors.

Things look very different for small n.  Like:

n = 2
x**(1/n)
   -1 1
0   997
1 2
with 1 native-precision step
   -1   117
0   772
1   111
with 1 extended-precision step
all correct

1/2 is exactly representable, so errors are few.  But doing a native-precsion 
"correction" made results significantly worse.

n=3 is more interesting, because 1/3 is not exactly representable:

n = 3
x**(1/n)
  -55 1
  -54 2
  -53 2
  -52 1
  -51 3
  -50 3
  -49 2
  -48 3
  -47 4
  -46 2
  -45 6
  -44 5
  -43 7
  -42 5
  -41 6
  -40 4
  -39 7
  -38 7
  -37 8
  -36 7
  -35 5
  -34 8
  -33 8
  -3214
  -31 8
  -30 9
  -2915
  -2813
  -2721
  -2614
  -25 7
  -2414
  -2315
  -22 7
  -2118
  -2014
  -1912
  -1817
  -17 8
  -1613
  -1515
  -14 9
  -1310
  -1214
  -1111
  -10 7
   -910
   -814
   -711
   -6 7
   -511
   -412
   -312
   -212
   -1 8
012
1 7
211
311
412
5 5
6 9
714
812
9 8
   1014
   1115
   1213
   1312
   14 9
   1515
   1617
   17 9
   1810
   1917
   2015
   21 9
   22 9
   23 6
   2411
   2520
   2624
   2721
   2816
   2911
   3012
   31 3
   3211
   3312
   3411
   3511
   36 2
   37 8
   38 8
   39 9
   40 3
   41 5
   42 4
   43 7
   44 4
   45 7
   46 5
   47 3
   48 4
   50 2
   53 3
   54 3
   56 1
with 1 native-precision step
   -142
0   917
141
with 1 extended-precision step
all correct

There a single native-precision step helped a lot overall.  But for n=4 (where 
1/n is again exactly representable), it again hurts:

n = 4
x**(1/n)
0   999
1 1
with 1 native-precision step
   -150
0   894
156
with 1 extended-precision step
all correct

And at n=5 it helps again; etc.

Of course my story hasn't changed ;-)  That is, use the single-step 
extended-precision code.  It's "almost always" correctly rounded (I still 
haven't seen a case where it isn't, and the test code here assert-fails if it 
finds one), and is plenty fast.  The reason this code gets very visibly slower 
as `n` increases is due to using the always-correctly-rounded `nroot()` for 
comparison.

--
Added file: http://bugs.python.org/file44339/roots.py

___
Python tracker 


[issue27898] regexp performance degradation between 2.7.6 and 2.7.12

2016-09-01 Thread Steve Newcomb

Steve Newcomb added the comment:

On 09/01/2016 05:01 PM, Steve Newcomb wrote:
>
>> The outputs show that 2.7.12's re.sub() takes 1.2 times as long as 
>> 2.7.6's.  It's a significant difference, but...
>>
>> ...it was not the dramatic degradation I expected to find in this 
>> exercise.
On second (third?) thought, the degree of degradation could easily 
depend on the source data being processed.  Maybe test.py does, in fact, 
demonstrate the problem, but the test data I used (p17-118.htm) do not 
demonstrate a terribly severe case of the problem.

--

___
Python tracker 

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



[issue9400] multiprocessing.pool.AsyncResult.get() messes up exceptions

2016-09-01 Thread Doug Coleman

Doug Coleman added the comment:

Six years later and I'm still running into this exact bug with 
``subprocess.CalledProcessError`` on python 2.7.12 when doing a 
``multiprocessing.Pool.map`` and trying to catch errors from 
``subprocess.check_output``. 

What's the reason it was never fixed and backported?

--
nosy: +Doug Coleman

___
Python tracker 

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



Python 3 at Facebook

2016-09-01 Thread Terry Reedy

https://www.youtube.com/watch?v=nRtp9NgtXiA
Jason Fried explains how he helped advance 'modern Python', 3.x, from
'impossible' in 2013 to the 'default for new code' today.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


[issue22458] Add fractions benchmark

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

@Stefan Krah: Please review the pull request.

https://github.com/python/performance/pull/10

I suggested to only run the benchmark with the fractions module. I don't see 
the point of running the benchmark with the decimal module.

--

___
Python tracker 

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



[issue27888] Hide pip install/uninstall windows in setup

2016-09-01 Thread Steve Dower

Changes by Steve Dower :


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

___
Python tracker 

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



[issue22458] Add fractions benchmark

2016-09-01 Thread Stefan Krah

Stefan Krah added the comment:

I'm also not opposed to adding it (-0.000) as long as we rename it to 
bm_fractions.py and change the docstring to "based on the telco benchmark".

--

___
Python tracker 

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



[issue22458] Add fractions benchmark

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

> I think string conversion should be part of this benchmark, or it should be 
> renamed to fraction-arith or something.

The "telco" benchmark seems to be standard and well defined. I agree
that we should use a different name.

 > That said, is the purpose of this benchmark to show that fractions
are slow and generate interest in changing the situation?

I'm not really convinced that the benchmark is useful in the Python
benchmark suite, but I'm not strongly opposed to adding it neither :-)

--

___
Python tracker 

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



[issue22458] Add fractions benchmark

2016-09-01 Thread Stefan Krah

Stefan Krah added the comment:

I think string conversion should be part of this benchmark, or it should be 
renamed to fraction-arith or something.

The formatting function can be a significant bottleneck, and if you use 
Fractions for financial calculations the result will still need to be printed 
in decimal floating point form.


That said, is the purpose of this benchmark to show that fractions are slow and 
generate interest in changing the situation?

--
nosy: +skrah

___
Python tracker 

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



[issue27898] regexp performance degradation between 2.7.6 and 2.7.12

2016-09-01 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo
type:  -> performance

___
Python tracker 

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



[issue27898] regexp performance degradation between 2.7.6 and 2.7.12

2016-09-01 Thread Steve Newcomb

Steve Newcomb added the comment:

Oops.  The correct url is sftp://coolheads.com/files/py-re-perform-276v2712/

On 09/01/2016 04:52 PM, Steve Newcomb wrote:
> On 08/30/2016 12:46 PM, Raymond Hettinger wrote:
>> Raymond Hettinger added the comment:
>>
>> It would be helpful if you ... make a small set of regular 
>> expressions that demonstrate the performance regression.
>>
> Done.  Attachments:
>
> test.py : Code that exercises re.sub() and outputs a profile report.
>
> test_output_2.7.6.txt : Output of test.py under Python 2.7.6.
>
> test_output_2.7.12.txt : Output of test.py under Python 2.7.12.
>
> p17.188.htm -- test data: public information from the U.S. Internal 
> Revenue Service.
>
> Equivalent hardware was used in both cases.
>
> The outputs show that 2.7.12's re.sub() takes 1.2 times as long as 
> 2.7.6's.  It's a significant difference, but...
>
> ...it was not the dramatic degradation I expected to find in this 
> exercise.  Therefore I attempted to tease what I was looking for out 
> of the profile stats I already uploaded to this site, made from actual 
> production runs.  My attempts are all found in an hg repository that 
> can be downloaded from 
> sftp://s...@coolheads.com//files/py-re-perform-276-2712 using password 
> bysIe20H .
>
> I do not feel the latter work took me where I wanted to go, and I 
> think the reason is that, at least for purposes of our application, 
> Python 2.7.12 has been so extensively refactored since Python 2.7.6.  
> So it's an apples-to-oranges comparison, apparently.  Still, the 
> performance difference for re.sub() is quite dramatic , and re.sub() 
> is the only comparable function whose performance dramatically 
> worsened: in our application, 2.7.12's re.sub() takes 3.04 times as 
> long as 2.7.6's.
>
> The good news, of course, is that by and large the performance of the 
> other *comparable* functions largely improved, often dramatically.  
> But at least in our application, it doesn't come close to making up 
> for the degradation in re.sub().
>
> My by-the-gut bottom line: somebody who really knows the re module 
> should take a deep look at re.sub().  Why would re.sub(), unlike all 
> others, take so much longer to run, while *every* other function in 
> the re module get (often much) faster?  It feels like there's a bug 
> somewhere in re.sub().
>
> Steve Newcomb
>

--

___
Python tracker 

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



[issue27928] Add hashlib.scrypt

2016-09-01 Thread Gregory P. Smith

Gregory P. Smith added the comment:

If clinic doesn't support required keyword only args then don't worry about it 
for now. :)

--

___
Python tracker 

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



[issue27928] Add hashlib.scrypt

2016-09-01 Thread Christian Heimes

Christian Heimes added the comment:

Argument is easy.

Your second request is a very good idea but also harder to implement. Neither 
PyArg_Parse nor clinic have a way to declare arguments that required and 
keyword only but have no default value. I have a workaround but it ain't 
beautiful.

--

___
Python tracker 

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



[issue27934] json float encoding incorrect for dbus.Double

2016-09-01 Thread Eddie James

Changes by Eddie James :


Added file: http://bugs.python.org/file44334/json-float-str-2.7.patch

___
Python tracker 

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



[issue27934] json float encoding incorrect for dbus.Double

2016-09-01 Thread Eddie James

New submission from Eddie James:

JSON does not correctly encode dbus.Double types, even though all other dbus 
types are handled fine. I end up with output like this (0.25 is the floating 
point value): dbus.Double(0.25, variant_level=1)

Found that the encoding uses repr() for float objects but uses str() for 
integer objects. I propose a change to use str() for float objects as well. 
This could be ported back to 2.7 as well

--
components: Library (Lib)
files: json-float-str-default.patch
keywords: patch
messages: 274179
nosy: eajames
priority: normal
severity: normal
status: open
title: json float encoding incorrect for dbus.Double
type: behavior
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file44333/json-float-str-default.patch

___
Python tracker 

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Matthias Klose

Matthias Klose added the comment:

checked in.

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a931fdc4c4c4 by doko in branch 'default':
- Issue #27917: Set platform triplets for Android builds.
https://hg.python.org/cpython/rev/a931fdc4c4c4

--
nosy: +python-dev

___
Python tracker 

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Matthias Klose

Matthias Klose added the comment:

I think that's good for now. The compiler checks maybe can be later adjusted.

--

___
Python tracker 

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



[issue27928] Add hashlib.scrypt

2016-09-01 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Rather than PyArg_ParseTupleAndKeywords can you have it use argument clinic?

Also, how about making all arguments other than password be keyword only so
that code calling the function is more clear.  Otherwise it's a bit of
positional argument soup with a lot of integers and potential to invert
password and salt without realizing it.

--

___
Python tracker 

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

OK found some wrong usages in my build script. Now MIPS64 builds fine, and 
PLATFORM_TRIPLET is detected as intended. I didn't test the build on actual 
devices, as I don't have a MIPS or MIPS64 device.

--

___
Python tracker 

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



[issue27925] Nicer interface to convert hashlib digests to int

2016-09-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is another way:

int.from_bytes(x.digest(), 'big')

Note that converting to int you lose the length of the digest. md5 digest 
d41d8cd98f00b204e9800998ecf8427e and sha1 digest 
d41d8cd98f00b204e9800998ecf8427e are converted to the same int. This 
can add a vulnerability.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27921] f-strings: do not allow backslashes

2016-09-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> -result.append(f'  [Previous line repeated {count-3} more 
> times]\n')
> +result.append(f'  [Previous line repeated {count-3} more 
> times]''\n')

This looks a little ugly.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue22881] show median in benchmark results

2016-09-01 Thread Stefan Behnel

Changes by Stefan Behnel :


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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

CPython builds fine for MIPS with this patch. For MIPS64, apparently Android 
NDK is broken - it can't even compile a simple C file.

--

___
Python tracker 

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




[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-09-01 Thread Elias Zamaria

Elias Zamaria added the comment:

Here is a patch with all of my latest changes, including the changes that 
Martin suggested for the tests.

--
Added file: http://bugs.python.org/file44332/pep467_attempt2.patch

___
Python tracker 

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



[issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 546b1f70cbed by Serhiy Storchaka in branch '3.5':
Issue #27881: Fixed possible bugs when setting 
sqlite3.Connection.isolation_level.
https://hg.python.org/cpython/rev/546b1f70cbed

New changeset 96e05f1af2c8 by Serhiy Storchaka in branch 'default':
Issue #27881: Fixed possible bugs when setting 
sqlite3.Connection.isolation_level.
https://hg.python.org/cpython/rev/96e05f1af2c8

--
nosy: +python-dev

___
Python tracker 

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



[issue16379] SQLite error code not exposed to python

2016-09-01 Thread Aviv Palivoda

Changes by Aviv Palivoda :


Added file: http://bugs.python.org/file44331/16379-3.patch

___
Python tracker 

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



[issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level

2016-09-01 Thread Aviv Palivoda

Aviv Palivoda added the comment:

The only change I see that can happen is that we return upper case isolation 
level when the user used a lower case. I think that it is worth to slow down 
the getter for the code simplification.

--

___
Python tracker 

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



[issue27933] functools.lru_cache seems to not work when renaming decorated functions

2016-09-01 Thread Федор Лянгузов

Федор Лянгузов added the comment:

Ok, thank you very much, i've got a little smarter today. Now i understand, 
that user_function (in this case factorial) is not modified by decorator, it is 
my job to change factorial to wrapper by assignment. Enlightning.

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Matthias Klose

Changes by Matthias Klose :


Removed file: http://bugs.python.org/file44327/android.diff

___
Python tracker 

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Matthias Klose

Matthias Klose added the comment:

yes, it should follow the gnu triplets. I updated these, and added some for 
mips. However I can't check if the mips ones will do what they are supposed to 
do. Please could you check these if you have cross compilers available?

--
Added file: http://bugs.python.org/file44330/android.diff

___
Python tracker 

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



[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-09-01 Thread Ethan Furman

Ethan Furman added the comment:

Two things to note:

- there is no need to change the stdlib to use anything besides the default
  constructor -- it's not going away, and it already works (my apologies if
  I misunderstood)

- PEP 467 has not yet been accepted (unless I missed that?)

However, thank you for getting some code written!

--

___
Python tracker 

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



[issue27888] Hide pip install/uninstall windows in setup

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e065aec0e6fa by Steve Dower in branch '2.7':
Issue #27888: Prevent Windows installer from displaying console windows and 
failing when pip cannot be installed/uninstalled.
https://hg.python.org/cpython/rev/e065aec0e6fa

--
nosy: +python-dev

___
Python tracker 

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



[issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level

2016-09-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, I thought about this. This changes the behavior (for now isolation_level 
returns exactly the same object that was assigned to it) and slows down the 
getter. This can be added only on the default branch.

--

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-09-01 Thread Bernard Spil

Bernard Spil added the comment:

Hi Christian,

Great stuff!

Please can you replace the HAVE_RAND_EGD ifdefs into OPENSSL_NO_EGD checks? 
Then the RAND_egd checks in configure.ac can also be removed.

This was introduced by OpenSSL in 
https://github.com/openssl/openssl/commit/0423f812dc61f70c6ae6643191259ca9e5692c7f
 and is consistent with the naming in LibreSSL.

Cheers,

Bernard.

--

___
Python tracker 

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



[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-09-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm not convinced that the zeros() method is needed. Zero-initialized sequences 
can be created via sequence repetition. Sorry, but arguments against this sound 
like "we made bad design decision in the past, let repeat it with new name" to 
me.

In any case if you want to write a code for different Python versions you 
should use sequence repetition.

Here is a patch that replaces all creations of zero-initialized bytes and 
bytearray objects in the stdlib and tests with repetitions. All tests (except 
test_bytes of course) are passed on Linux if disallow an int argument in bytes 
and bytearray constructors.

--
nosy: +serhiy.storchaka
Added file: http://bugs.python.org/file44329/no_bytes_from_int.patch

___
Python tracker 

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



[issue901727] extra_path kwarg to setup() undocumented

2016-09-01 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Given the progression in issue27919, I suggest this documentation effort can be 
dropped, but feel free to revive the conversation if you disagree.

--
nosy: +jason.coombs
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue27919] Deprecate and remove extra_path distribution kwarg

2016-09-01 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Thanks, Nick. I've also observed that the package that was mentioned in the 
comments was "Numeric Python" and I confirmed that numpy is not currently using 
this option, so that's a positive indication that it's unneeded. I've also 
reached out to New Relic and invited them to comment here about the value they 
get (if any) from the option.

I've committed the deprecation warning as well. I'll plan to mirror this 
deprecation warning in Setuptools to get faster feedback. I'm open to reverting 
this change before the final release of Python 3.6 if it turns out to be a 
necessary feature.

As for your first suggestion - having Setuptools disable the behavior, I'm not 
sure Setuptools has the context to disable the behavior, because at the time 
pip is invoking the install command, Setuptools doesn't know whether pip is 
going to install the packages into platlib or elsewhere. At least, that's my 
presumption; I haven't dived into the code. I'm okay with not having a 
workaround if later versions of Setuptools and Python can disable the 
functionality without breaking anything but the most obscure packages.

--

___
Python tracker 

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



[issue27881] Fix possible bugs when setting sqlite3.Connection.isolation_level

2016-09-01 Thread Aviv Palivoda

Aviv Palivoda added the comment:

What do you think about removing the isolation_level member from the 
pysqlite_Connection. It is only there to be for the 
pysqlite_connection_get_isolation_level and that could be easily calculated 
from the begin_statement.

--
Added file: http://bugs.python.org/file44328/issue27881_v5.patch

___
Python tracker 

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



[issue27919] Deprecate and remove extra_path distribution kwarg

2016-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 94710cbcac47 by Jason R. Coombs in branch 'default':
Issue #27919: Deprecate extra_path option in distutils.
https://hg.python.org/cpython/rev/94710cbcac47

--
nosy: +python-dev

___
Python tracker 

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Well, here's a list of cross compilers in Android NDK:

$ ls $ANDROID_NDK/toolchains/*/prebuilt/*/bin/*-gcc | xargs -i basename '{}'
 
aarch64-linux-android-gcc
arm-linux-androideabi-gcc
mips64el-linux-android-gcc
mipsel-linux-android-gcc
i686-linux-android-gcc
x86_64-linux-android-gcc

Does Python's platform triplet have the same meaning as GCC's --target? If so 
those names can be used.

By the way, +1 for not including the API level.

--

___
Python tracker 

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



[issue27917] Choose platform triplets for android builds

2016-09-01 Thread Matthias Klose

Matthias Klose added the comment:

here's a patch, not yet including the ABI levels. I think we didn't need them 
for Linux, and maybe start for Android without using them. You can later 
introduce these if you have to.

--
keywords: +patch
Added file: http://bugs.python.org/file44327/android.diff

___
Python tracker 

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



[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-09-01 Thread Elias Zamaria

Elias Zamaria added the comment:

I tried running `hg import --no-commit "$(xclip -o)"` and got the following 
result:

bash: xclip: command not found
abort: need at least one patch to import

I am using OS X 10.11.6 and Mercurial 3.8.2. I did a bit of quick research on 
xclip, but it looks like yet another unfamiliar tool, and I don't know exactly 
what it does or how it is supposed to help me.

I looked at your suggestions for my patch, and I am working on them.

I am planning to look at the tutorial, and to look for, and maybe fix, 
deprecated calls, but so far, I don't have a clear idea how long it will take 
me, or if it is realistic for one person to do it.

--

___
Python tracker 

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



Re: C Python extension to export an Function

2016-09-01 Thread Christian Gollwitzer

Hi Ganesh,

Am 01.09.16 um 17:24 schrieb Ganesh Pal:

Thanks stefan and  Gollwitzer  , good to know there are many ways to do this
i.e via cython or SWIG   but  the C/Python API
 is probably the most widely used method
- not for it’s simplicity but for the fact that you can manipulate python
objects in your C code.


I'm not sure you understood what SWIG or Cython do - they are not 
circumventing the C/Python API, they merely write some of the code for 
you (as a C file). With both you can add manually written C code if the 
generated code is insufficient, and you can also ship the generated 
code, so that SWIG or Cython are not needed to rebuild the module, 
unless the API of your C coded functions changes.



I want to use C/Python API 


You may have good reasons to do it manually anyway, in this case look at 
the PyArg_ParseTuple and Py_BuildValue functions documented here

https://docs.python.org/2/c-api/arg.html

Christian




--
https://mail.python.org/mailman/listinfo/python-list


[issue27376] Add mock_import method to mock module

2016-09-01 Thread Israel Fruchter

Israel Fruchter added the comment:

Some real use cases is needed, like testing a code that behave differently on 
case of package availability.

I think something like patch for modules can be useful here, so you could have 
some control on what would be returned.

--
nosy: +fruch

___
Python tracker 

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



Re: C Python extension to export an Function

2016-09-01 Thread Pavel S
If you're familiar with C++, I recommend to have a look at Boost::Python. 

Sample program:

#include 

#include 

void world()
{
std::cout << "hello world" << std::endl;
}


BOOST_PYTHON_MODULE( hello )
{
using namespace ::boost::python;

def( "world",  );
}

Usage:

python -c "import hello; hello.world()"

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27933] functools.lru_cache seems to not work when renaming decorated functions

2016-09-01 Thread Steven D'Aprano

Steven D'Aprano added the comment:

In case it isn't obvious, my example is meant to be pseudo-code, not the exact 
implementation used.

--

___
Python tracker 

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



[issue27933] functools.lru_cache seems to not work when renaming decorated functions

2016-09-01 Thread Steven D'Aprano

Steven D'Aprano added the comment:

This behaviour is expected. The factorial function calls itself, it doesn't 
call "f", but it is "f" which has the cache. So the call to f() goes through 
the cache, misses, and then calls factorial(), which has no cache.

In effect, what you have written is something like:

def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)

def f(n):
if n in f.cache:
return f.cache[n]
else:
x = f.cache[n] = factorial(n)
return x

f.cache = lru_cache()

--
nosy: +steven.daprano

___
Python tracker 

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



[issue27268] Incorrect error message on float('')

2016-09-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Setting this aside for Nofar to review.

--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue27933] functools.lru_cache seems to not work when renaming decorated functions

2016-09-01 Thread Emanuel Barry

Changes by Emanuel Barry :


--
nosy: +ncoghlan, rhettinger

___
Python tracker 

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



[issue27928] Add hashlib.scrypt

2016-09-01 Thread Christian Heimes

Changes by Christian Heimes :


--
keywords: +patch
Added file: http://bugs.python.org/file44326/Add-hashlib.scrypt.patch

___
Python tracker 

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



[issue27933] functools.lru_cache seems to not work when renaming decorated functions

2016-09-01 Thread Федор Лянгузов

New submission from Федор Лянгузов:

Greetings,

I've encountered strange behavior when using functools.lru_cache as a function 
(not as a decorator): it is at least miscounting misses, but probably not work 
at all, when the result of functools.lru_cache()(func) is saved in variable 
other than 'func'. Consider this snippet:

def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)

f = functools.lru_cache()(factorial)
f(20)
print(f.cache_info())

Output should be: CacheInfo(hits=0, misses=21, maxsize=128, currsize=21)
Instead it is: CacheInfo(hits=0, misses=1, maxsize=128, currsize=1)

I'm using Python 3.5.2 64bit on Windows 7 Professional 64bit.
I've written 3 unittests (using built-in module), which are attached as a file. 
I don't know how to comment them (conceptually, not syntactically), sorry.

Fedor

--
components: Library (Lib)
files: lru_cache_test.py
messages: 274149
nosy: Федор Лянгузов
priority: normal
severity: normal
status: open
title: functools.lru_cache seems to not work when renaming decorated functions
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file44325/lru_cache_test.py

___
Python tracker 

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



Re: C Python extension to export an Function

2016-09-01 Thread Stefan Behnel
Ganesh Pal schrieb am 01.09.2016 um 17:24:
> Thanks stefan and  Gollwitzer  , good to know there are many ways to do this
> i.e via cython or SWIG   but  the C/Python API
>  is probably the most widely used method

It certainly was, years ago, but I honestly doubt that it still is. I don't
think there is still that much manually written C-API code out there that
is actively maintained. Often enough, it's easier to rewrite the code in
Cython at some point, than to keep maintaining it in C over years.

Manually written C-API code is simply too difficult to maintain, and also
too difficult to get right in the first place. There are just too many ways
to introduce reference leaks, crashes and long standing unnoticed bugs
(believe me, I know what I'm talking about). Even experienced CPython core
devs still make mistakes here from time to time.


> - not for it’s simplicity but for the fact that you can manipulate python
> objects in your C code.

Neither SWIG nor Cython prevent you from doing that, although you'd usually
leave these things to Cython since it already generates faster code for
many operations than you would (or could) write by hand.

Stefan


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27926] ctypes is too slow to convert a Python list to a C array

2016-09-01 Thread Tom Cornebize

Tom Cornebize added the comment:

Thank you for these explanations.

I understand that we get a generic function to the cost of performances.

However, I think we should at least tell in the documentation that the 
constructor (ctypes.c_uint32 * len(t))(*t) is slow and that we can do much 
faster in some specific cases (e.g. an array of integers).

It would be even better to have some specific method(s) to do this in ctypes, 
instead of having to rely on an array.array just to build a ctypes array from a 
list. I am not familiar with CPython code, so I do not know if it would be 
easily feasible.

--

___
Python tracker 

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



[issue27925] Nicer interface to convert hashlib digests to int

2016-09-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

"int(x)" looks nice to me as well.

--
nosy: +rhettinger

___
Python tracker 

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



[issue27925] Nicer interface to convert hashlib digests to int

2016-09-01 Thread R. David Murray

R. David Murray added the comment:

+1  I just wanted this recently.  Also note that going through hexdigest/int 
isn't particularly efficient, so an object-supported fast way to do this would 
be nice.

--
nosy: +r.david.murray
stage:  -> needs patch

___
Python tracker 

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



[issue27931] Email parse IndexError <""@wiarcom.com>

2016-09-01 Thread R. David Murray

Changes by R. David Murray :


--
stage:  -> needs patch
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



[issue27932] platform.win32_ver() leaks in 2.7.12

2016-09-01 Thread Okko Willeboordse

Okko Willeboordse added the comment:

I did a gc.get_objects() before and after platform.win32_ver() and printed
objects that were not present before calling platform.win32_ver().

If I run platform.win32_ver() in a loop I see the memory increasing.

On 1 September 2016 at 17:35, STINNER Victor  wrote:

>
> STINNER Victor added the comment:
>
> Hum, can you please elaborate the issue? What is leaked_objects.txt?
>
> --
> nosy: +haypo
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27932] platform.win32_ver() leaks in 2.7.12

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

Hum, can you please elaborate the issue? What is leaked_objects.txt?

--
nosy: +haypo

___
Python tracker 

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



[issue27932] platform.win32_ver() leaks in 2.7.12

2016-09-01 Thread Okko Willeboordse

New submission from Okko Willeboordse:

Running;
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit 
(Intel)] on win32

platform.win32_ver() returns;
('10', '10.0.10586', '', u'Multiprocessor Free')

--
components: Windows
files: leaked_objects.txt
messages: 274144
nosy: Okko.Willeboordse, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: platform.win32_ver() leaks in 2.7.12
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file44324/leaked_objects.txt

___
Python tracker 

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



[issue27906] Socket accept exhaustion during high TCP traffic

2016-09-01 Thread Guido van Rossum

Guido van Rossum added the comment:

I'll try to get to this during the core dev sprint next week.

--

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2016-09-01 Thread Guido van Rossum

Guido van Rossum added the comment:

Looks related (possibly a duplicate) of issue #27136. Also related is a fix for 
the latter in https://github.com/python/asyncio/pull/357. That fix is already 
in the CPython repo, but I guess it didn't make it into 3.5.2.

--

___
Python tracker 

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



[issue27931] Email parse IndexError <""@wiarcom.com>

2016-09-01 Thread Константин Волков

New submission from Константин Волков:

Email lib fails to parse some emails:

from email._header_value_parser import get_angle_addr
get_angle_addr('<""@wiarcom.com> SIZE=28113').addr_spec

IndexError: list index out of range

Seems that email address can be parsed.

--
components: email
messages: 274140
nosy: barry, r.david.murray, Константин Волков
priority: normal
severity: normal
status: open
title: Email parse IndexError <""@wiarcom.com>
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



Re: C Python extension to export an Function

2016-09-01 Thread Ganesh Pal
Thanks stefan and  Gollwitzer  , good to know there are many ways to do this
i.e via cython or SWIG   but  the C/Python API
 is probably the most widely used method
- not for it’s simplicity but for the fact that you can manipulate python
objects in your C code.

I want to use C/Python API 

On Thu, Sep 1, 2016 at 6:32 PM, Stefan Behnel  wrote:

> Ganesh Pal schrieb am 01.09.2016 um 14:30:
> > On Thu, Sep 1, 2016 at 12:32 PM, dieter wrote:
> >> Ganesh Pal writes:
> >>> Iam pretty new to C Python extension , I was able to export few simple
> >>> modules to python and it look like the cool thing to do ...
> >>
> >> Maybe, it is a good idea to have a look at "cython".
> >>
> >> "cython" is a compiler. It translates Python code enhanced with
> >> special annotations into C. The annotations mostly tell the compiler
> >> that something ("object", "method", "function", ...) should be at "C"
> >> rather than "Python" level, thus avoiding much of Python's overhead
> >> and allows to do things possible in "C" but not in "Python".
> >>
> >> Developing safe "C" extensions for Python is difficult. You
> >> need some quite deep understanding of the Python-C interface
> >> and must be very careful to observe all requirements (especially
> >> those related to proper reference management).
> >>
> >> Developing "C" extensions with "cython" is much easier as
> >> "cython" hides many of the complexities and takes care of most
> >> requirements.
> >
> > Really appreciate the reply and your suggestion on  trying to use
> "cython"
> > ,  but my whole idea of using  "C" extension is to regular C codes .  We
> > have bunch of C code that's already available and   C -Python seems to
> suit
> > me better
>
> From your response it's not obvious whether you are aware that Cython also
> makes it substantially easier to *interface* CPython with external C code,
> in the same way that it makes it easy (but not necessary) to *avoid*
> writing C in the first place. So I thought I'd just mention that this is
> not a reason to rule it out as an excellent option.
>
> Stefan
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27930] logging's QueueListener drops log messages

2016-09-01 Thread Petr Viktorin

New submission from Petr Viktorin:

There are two "barrier" like abstractions on Lib/logging/handlers.py in the 
_monitor method.

First _monitor has two loops, what is already kind of a hint something is not 
right.

Second, it has two ways to exit the loop, that also exit the thread:
1) The _stop threading.Event is "set"
2) The _sentinel object is added to the queue

The problem is, the documentation says that the correct way to not loose 
records, the stop method must be called, but, the stop method just sets the 
_stop object and then adds the _sentinel object to the queue.

The loop stops when noticing that _stop is set, and then enters a second 
version of the loop, trying again to see the _sentinel object, but this time 
with non blocking read.

The test case shows the problem, but it also hints about the race conditions by 
the fact that running the test case under "taskset 1" works, so, to reproduce 
the issue, run the test under a multiprocessor environment.

The proper solution would be to have a proper locking mechanism, otherwise, the 
_stop object should not be used, and rely only in seeing the _sentinel field; 
this is what the class DeterministicQueueListener does in the test case.


(Reported by Paulo Andrade at 
https://bugzilla.redhat.com/show_bug.cgi?id=1370484 )

--
components: Library (Lib)
files: test.py
messages: 274139
nosy: encukou, vinay.sajip
priority: normal
severity: normal
status: open
title: logging's QueueListener drops log messages
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44323/test.py

___
Python tracker 

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



[issue27926] ctypes is too slow to convert a Python list to a C array

2016-09-01 Thread Eryk Sun

Changes by Eryk Sun :


--
versions: +Python 2.7, 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



[issue27926] ctypes is too slow to convert a Python list to a C array

2016-09-01 Thread Eryk Sun

Eryk Sun added the comment:

This is a consequence of several factors. It starts with the __init__ method of 
ctypes.Array, Array_init. This function doesn't hard-code calling the base 
sq_ass_item slot function, Array_ass_item. If it did, it wouldn't be nearly as 
slow. Instead it calls the abstract function PySequence_SetItem. Doing it this 
way accommodates an array subclass that overrides __setitem__. 

What I'd like to do here is check whether the sq_ass_item slot is defined as 
Array_ass_item, and if so call it directly instead of PySequence_SetItem. But 
it turns out that it's not set as Array_ass_item even if the subclass doesn't 
override __setitem__, and more than anything this is the real culprit for the 
relative slowness of Array_init.

If a built-in type such as ctypes.Array defines both mp_ass_subscript and 
sq_ass_item, then the __setitem__ wrapper_descriptor wraps the more generic 
mp_ass_subscript slot function. Then for a subclass, update_one_slot in 
Objects/typeobject.c plays it safe when updating the sq_ass_item slot. It sees 
that the inherited __setitem__ descriptor doesn't call wrap_sq_setitem, so it 
defines the slot in the subclass to use the generic function slot_sq_ass_item. 

This generic slot function goes the long way around to look up and bind the 
__setitem__ method and convert the Py_ssize_t index to a Python integer, to 
call the wrapper that calls the mp_ass_subscript slot. To add insult to injury, 
the implementation of this slot for a ctypes Array, Array_ass_subscript, has to 
convert back to a Py_ssize_t integer via PyNumber_AsSsize_t.

I don't know if this can be resolved while preserving the generic design of the 
initializer. As is, calling PySequence_SetItem in a tight loop is ridiculously 
slow. I experimented with calling Array_ass_item directly. With this change 
it's as fast as assigning to a slice of the whole array. Actually with a list 
it's a bit slower because *t has to be copied to a tuple. But it takes about 
the same amount of time as assigning to a slice when t is already a tuple, such 
as tuple(range(100)).

I doubt any amount of tweaking will make ctypes as fast as an array.array. 
ctypes has a generic design to accommodate simple C data, pointers, and 
aggregate arrays, structs, and unions. This comes with some cost to 
performance. However, you can and should make use of the buffer protocol to use 
arrays from the array module or numpy where performance is critical. It's 
trivial to create a ctypes array from an object that supports the buffer 
protocol. For example: 

v = array.array('I', t)
a = (ctypes.c_uint32 * len(v)).from_buffer(v)

There's no need to use the array.array's buffer_info() or ctypes.cast(). The 
from_buffer() method creates an array that shares the buffer of the source 
object, so it's relatively fast. It's also returning a sized array instead of a 
lengthless pointer (though it is possible to cast to an array pointer and 
immediately dereference the array).

--
nosy: +eryksun

___
Python tracker 

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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Uh... ok, I thought you wanted some feedback on the patches posted, since I 
didn't know you had committed a new version of them.

I haven't tried to use the new API (for various reasons it's a bit cumbersome 
to use a self-compiled Python for Numba), but I'm sure it will be good enough.

--

___
Python tracker 

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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

> Which patch are we talking about?

I'm talking about this change which was already merged into the default branch 
of Python in March 2016:

New changeset 60655e543d8a by Victor Stinner in branch 'default':
Add C functions _PyTraceMalloc_Track()
https://hg.python.org/cpython/rev/60655e543d8a

--

___
Python tracker 

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



[issue22458] Add fractions benchmark

2016-09-01 Thread Stefan Behnel

Stefan Behnel added the comment:

Done:
https://github.com/python/performance/pull/10

Note that I didn't replace the existing telco benchmark as it is more specific 
to Decimal. The new benchmark makes it possible to compare the decimal and 
fractions modules for similar operations, though.

--

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2016-09-01 Thread Emanuel Barry

Emanuel Barry added the comment:

Thanks for the report! I'm unable to reproduce, as `socket.AF_BLUETOOTH` 
doesn't exist on my system, but surely someone else can.

--
keywords: +3.5regression
nosy: +ebarry, ned.deily
priority: normal -> high
stage:  -> needs patch
title: asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH -> 
asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH
type:  -> behavior

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH

2016-09-01 Thread Robert Jordens

Changes by Robert Jordens :


--
components: +asyncio -Argument Clinic
nosy: +gvanrossum, haypo, yselivanov

___
Python tracker 

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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Which patch are we talking about? In tracemalloc_track-3.patch, I see:

+   If memory block is already tracked, update the existing trace. */
+PyAPI_FUNC(int) _PyTraceMalloc_Track(void *ptr, size_t size);
+
+/* Untrack an allocated memory block in the tracemalloc module.
+   Do nothing if the block was not tracked.
+
+   Do nothing if tracemalloc is not tracing Python memory allocations. */
+PyAPI_FUNC(void) _PyTraceMalloc_Untrack(void *ptr);

--

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH

2016-09-01 Thread Robert Jordens

Robert Jordens added the comment:

The error for inet_pton() is:

>>> import socket
>>> socket.inet_pton(socket.AF_BLUETOOTH, "00:12:34:56:78:99")
Traceback (most recent call last):
  File "", line 1, in 
socket.error: [Errno 97] Address family not supported by protocol

And the traceback in asyncio is:

DEBUG:asyncio:Using selector: EpollSelector
Traceback (most recent call last):
  File "log.py", line 91, in 
main()
  File "log.py", line 84, in main
loop.run_until_complete(log(loop, sys.argv[1]))
  File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in 
run_until_complete
return future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
  File "log.py", line 22, in log
yield from loop.sock_connect(sock, (addr, 1))
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 397, in 
sock_connect
yield from resolved
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.5/socket.py", line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname

--

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH

2016-09-01 Thread Robert Jordens

New submission from Robert Jordens:

Since 3.5.2 sock_connect() tries to be smart and resolves addresses for you if 
they fail a socket.inet_pton() check. But inet_pton() only supports AF_INET(6) 
and does not work for other address families that socket otherwise supports 
just fine (e.g. AF_BLUETOOTH).

Before 3.5.2, in order to happily use bluetooth sockets with asyncio, you could 
just do:

sock = socket.socket(family=socket.AF_BLUETOOTH, type=socket.SOCK_STREAM,
proto=socket.BTPROTO_RFCOMM)
sock.setblocking(False)
addr = "00:12:34:56:78:99"
yield from loop.sock_connect(sock, (addr, 1))

This is a regression.

--
components: Argument Clinic
messages: 274131
nosy: Robert.Jordens, larry
priority: normal
severity: normal
status: open
title: asyncio.AbstractEventLoop.sock_connect brooken for AF_BLUETOOTH
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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

> I may be a bit confused, but the "domain" integer you added in issue 26588 
> doesn't seem to be part of this API... Is it deliberate?

They are part of this API.

msg262180: """Ok, I added the following C functions:

  int _PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr, 
size_t size);
  int _PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr);

(...)"""

The domain 0 is used to track Python memory allocations.

--

___
Python tracker 

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



Re: Issues with "twistd" in Twisted 16.4.0

2016-09-01 Thread Yuri

On 01/09/16 20:17, Kevin Conway wrote:

Hi, you might not get much of an answer for this on the Python mailing
list. I suggest sending your question to the Twisted mailing list instead:
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python.

On Thu, Sep 1, 2016 at 7:12 AM juraseg  wrote:


Also, I've tried to find anything in Twisted bug tracker, but I can't find
my way in there.
--
https://mail.python.org/mailman/listinfo/python-list



Thanks! I'll try there

--
https://mail.python.org/mailman/listinfo/python-list


[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I may be a bit confused, but the "domain" integer you added in issue 26588 
doesn't seem to be part of this API... Is it deliberate?

--

___
Python tracker 

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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

> Is the timeout part of the API? :-)

I don't want to make the API public before you validated that it is usable for 
your use case or to track numpy memory usage.

I guess that the first beta release of Python 3.6 is the deadline for this 
issue. Otherwise, we will have to wait ~2 years with Python 3.7.

--

___
Python tracker 

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



[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is the timeout part of the API? :-)

--

___
Python tracker 

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



[issue27364] Deprecate invalid unicode escape sequences

2016-09-01 Thread Emanuel Barry

Emanuel Barry added the comment:

Thanks Serhiy; it does look better to me too!

--
Added file: 
http://bugs.python.org/file44322/deprecate_invalid_escapes_both_3.patch

___
Python tracker 

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



Re: Issues with "twistd" in Twisted 16.4.0

2016-09-01 Thread Kevin Conway
Hi, you might not get much of an answer for this on the Python mailing
list. I suggest sending your question to the Twisted mailing list instead:
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python.

On Thu, Sep 1, 2016 at 7:12 AM juraseg  wrote:

> Also, I've tried to find anything in Twisted bug tracker, but I can't find
> my way in there.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26814] [WIP] Add a new _PyObject_FastCall() function which avoids the creation of a tuple or dict for arguments

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

I splitted the giant patch into smaller patches easier to review. The first 
part (_PyObject_FastCall, _PyObject_FastCallDict) is already merged. Other 
issues were opened to implement the full feature. I now close this issue.

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

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

The main features (_PyFunction_FastCall()) has been merged. Supporting keyword 
arguments is now handled by other issue (see issue #27830). I close this issue.

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

___
Python tracker 

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



[issue27809] Add _PyFunction_FastCallDict(): fast call with keyword arguments as a dict

2016-09-01 Thread STINNER Victor

STINNER Victor added the comment:

The main feature has been merged, so I close the issue.

--
resolution:  -> fixed
status: open -> closed
title: _PyObject_FastCall(): add support for keyword arguments -> Add 
_PyFunction_FastCallDict(): fast call with keyword arguments as a dict

___
Python tracker 

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



  1   2   >