[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread STINNER Victor

STINNER Victor added the comment:

Maybe the failure should be explained in a comment? (Sorry I din't read the
patch.)

--

___
Python tracker 

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



[issue15657] Error in Python 3 docs for PyMethodDef

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

I'm going to delete

(but note that :const:`METH_KEYWORDS` alone is equivalent to ``METH_VARARGS 
| METH_KEYWORDS``)

from Doc/c-api/structures.rst in 3.5.

Then change the value of METH_KEYWORDS from 0x0002 to 0x0003 in 3.6.

Thanks for the review Serhiy.

--
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue16484] pydoc generates invalid docs.python.org link for xml.etree.ElementTree and other modules

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Kaushik or David (or anyone else), does you have an idea of how to fix the 
Windows tests? It would be good to make the buildbots healthy again, then it is 
easier to see new failures in Windows.

--
priority: normal -> high

___
Python tracker 

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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Test suite emits a new warning, and fails under python -Werror:

==
ERROR: test_readline (test.test_asyncio.test_pep492.StreamReaderTests)
--
Traceback (most recent call last):
  File 
"/media/disk/home/proj/python/cpython/Lib/test/test_asyncio/test_pep492.py", 
line 89, in test_readline
data = self.loop.run_until_complete(reader())
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/base_events.py", line 
387, in run_until_complete
return future.result()
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/futures.py", line 274, 
in result
raise self._exception
  File "/media/disk/home/proj/python/cpython/Lib/asyncio/tasks.py", line 239, 
in _step
result = coro.send(None)
  File 
"/media/disk/home/proj/python/cpython/Lib/test/test_asyncio/test_pep492.py", 
line 85, in reader
async for line in stream:
PendingDeprecationWarning: 'StreamReader' implements legacy __aiter__ protocol; 
__aiter__ should return an asynchronous iterator, not awaitable

--
nosy: +martin.panter
status: closed -> open

___
Python tracker 

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



[issue26868] Document PyModule_AddObject's behavior on error

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the review Serhiy. Here is an updated patch.

--
Added file: http://bugs.python.org/file43328/issue26868_v2.diff

___
Python tracker 

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



Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Jussi Piitulainen
Marko Rauhamaa writes:
> Paul Rudin wrote:

>> Talk of pointers is potentially confusing, because it carries baggage
>> from other languages which doesn't necessary map precisely onto the
>> python execution model.
>
> Unfortunately, virtually every word is overloaded and full of
> preconceived notions. Hence: "pegs", "leashes", "puppies".
>
> The main thing is to keep those three concepts apart from each other.
> Two notions will not suffice.

Does a new leash appear when a puppy is tied to a peg? Apparently.

Is it possible to tie two puppies to the same peg? Apparently not. Why
not?

Is the leash left dangling in the neck of a puppy if another puppy is
tied to its peg? What if the puppy is tied again to the same peg, is
there then the new leash from its neck to the peg, and the old leash
left dangling?

Is it possible to leave the leash tied to the peg but untie the puppy?
Apparently not.

It's also not possible to look at the puppy and follow all the leashes
to find all the pegs where the puppy is tied.

The real third thing is not a thing but a relationship: being tied to.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Yes it is okay. The code is compiling a dummy file without main(), just to see 
what libraries GCC tries to link with it. It is only interested in extracting 
the line matching *libc.so.*, which in your case should be

/lib/i386-linux-gnu/libc.so.6

So you should find that ctypes.util._findLib_gcc("c") still returns this path, 
even though the compile command technically fails.

--

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I presume then that the tests pass on Linux with TEntry removed.  I take this 
as repudiation of the 'X11' behavior by the tk maintainers, and as support for 
changing the old widgets.  Having different paste behavior in text and entry 
widgets, or even different entry widgets (in the same release of IDLE, when 
some but not all 'Entry's have been converted) would be pretty bad.

--

___
Python tracker 

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



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It looks to me that the command used in _findLib_gcc always fails.

$ LANG=C LC_ALL=C gcc -Wl,-t -o ttt -lc
/usr/bin/ld: mode elf_i386
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crt1.o
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crti.o
/usr/lib/gcc/i686-linux-gnu/5/crtbegin.o
/lib/i386-linux-gnu/libc.so.6
(/usr/lib/i386-linux-gnu/libc_nonshared.a)elf-init.oS
/lib/i386-linux-gnu/ld-linux.so.2
/lib/i386-linux-gnu/ld-linux.so.2
-lgcc_s (/usr/lib/gcc/i686-linux-gnu/5/libgcc_s.so)
/lib/i386-linux-gnu/libc.so.6
/lib/i386-linux-gnu/ld-linux.so.2
-lgcc_s (/usr/lib/gcc/i686-linux-gnu/5/libgcc_s.so)
/usr/lib/gcc/i686-linux-gnu/5/crtend.o
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crtn.o
/usr/lib/gcc/i686-linux-gnu/5/../../../i386-linux-gnu/crt1.o: In function 
`_start':
(.text+0x18): undefined reference to `main'
/usr/bin/ld: link errors found, deleting executable `ttt'
collect2: error: ld returned 1 exit status

Is it OK?

--

___
Python tracker 

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



Re: how to solve memory

2016-06-09 Thread meInvent bbird
On Friday, June 10, 2016 at 9:13:13 AM UTC+8, Michael Torrie wrote:
> On 06/09/2016 06:58 PM, meInvent bbird wrote:
> > 
> 
> Do you have a question for the list? If so, please state what it is, and
> describe what you are doing and what isn't working.  If you can boil it
> down to a dozen lines of run-able, self-contained code that illustrates
> the problem, that is helpful too.


there are six operator, and a logic table initial in b variable

aa[b[j][i]]
[aa[b[i][0:1]+b[i][2:3]

are just like vlookup to find output of each operator 
acting on first column and second column, second column and third column
, first column and third column

and searching a output columns which is result sum is 27*2
and record the path if succeed, 
it record the path  and output any path which has result is 27*2 described 
before
op1(op2(op3(op1(op2(),),op1(op2(),))), op1(op2(),))

there are two cases, first cases b are logic table 
later case are for six operators acting on the result column from previous 
result before recursive call

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


[issue20508] IndexError from ipaddress._BaseNetwork.__getitem__ has no message

2016-06-09 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



[issue24617] os.makedirs()'s [mode] not correct

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

This version of the patch looks good to me

--
stage: patch review -> commit review

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Will try to change the existing code from os.popen to subprocess (Issue 26439) 
to set a better example for new code like this

--
dependencies: +avoid using a shell in ctypes.util: replace os.popen with 
subprocess

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I deliberately omitted ttk.Entry, because it doesn't have special behavior on 
X11.

--

___
Python tracker 

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



[issue24750] IDLE: Cosmetic improvements for main window

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Added file: http://bugs.python.org/file43327/ttk-scrollbar.diff

___
Python tracker 

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



[issue27239] Make idlelib.macosx self-contained.

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


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



[issue22636] avoid using a shell in ctypes.util: replace os.popen with subprocess

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Updated Python 2 patch merged with recent changes.

I will commit at least the Python 3 version soon, because the existing code 
sets a bad example for potential additions (Issue 26439).

--
Added file: http://bugs.python.org/file43326/ctypes_util_popen-4.py2.patch

___
Python tracker 

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



[issue20508] IndexError from ipaddress._BaseNetwork.__getitem__ has no message

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

+1 for "address index out of range". The current test only covers the first 
IndexError. We also need to add another one for the else branch.

--
nosy: +berker.peksag
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



[issue26565] [ctypes] Add value attribute to non basic pointers.

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Eryk Sun’s as_void suggestion sounds similar to doing:

ctypes.cast(any_pointer, ctypes.c_void_p)

Why do you want the address? Perhaps it is good enough to get it from a void 
pointer:

ctypes.cast(any_pointer, ctypes.c_void_p).value

Maybe “pointer_value” would be less confusing than “toaddress”.

--
nosy: +martin.panter

___
Python tracker 

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



[issue7356] parsing of ldconfig output in ctypes/utils.py depends on the locale

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4839797f482 by Matthias Klose in branch '2.7':
Issue #7356: ctypes.util: Make parsing of ldconfig output locale independent.
https://hg.python.org/cpython/rev/b4839797f482

--
nosy: +python-dev

___
Python tracker 

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



[issue7356] parsing of ldconfig output in ctypes/utils.py depends on the locale

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

This was supposed to be fixed in 2.7 by r78979 and beb9d176503e. But those 
changes were made to the dead _findLib_ldconfig() function (later deleted as 
part of Issue 13979). I will port the changes to the live 
_findSoname_ldconfig() function.

--
nosy: +martin.panter

___
Python tracker 

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



[issue8491] Need readline command and keybinding information

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

For the record, I removed some trailing spaces and reworded the link in the 
comitted version.

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



[issue24750] IDLE: Cosmetic improvements for main window

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Revised plan: use ttk in 3.6 and only 3.6.  I will revise scroll patch for new 
file names, retest, and apply if good.

--
assignee:  -> terry.reedy
stage: needs patch -> commit review
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: how to solve memory

2016-06-09 Thread Michael Torrie
On 06/09/2016 06:58 PM, meInvent bbird wrote:
> 

Do you have a question for the list? If so, please state what it is, and
describe what you are doing and what isn't working.  If you can boil it
down to a dozen lines of run-able, self-contained code that illustrates
the problem, that is helpful too.

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


Re: which library has map reduce and how to use it for this case

2016-06-09 Thread Ho Yeung Lee
input are these six operators, output is finding full column of 27 elements add 
together is 54

i got memory error when searching this, 

i have difficulty in understanding map reduce and transforming my program into 
map reduce problem

M1 = {}
M2 = {}
M3 = {}
M4 = {}
M5 = {}
V6 = {}
M1['00']=0
M1['01']=2
M1['02']=1
M1['10']=1
M1['11']=1
M1['12']=1
M1['20']=1
M1['21']=1
M1['22']=2
M2['00']=0
M2['01']=1
M2['02']=1
M2['10']=1
M2['11']=1
M2['12']=1
M2['20']=1
M2['21']=1
M2['22']=1
M3['00']=2
M3['01']=2
M3['02']=2
M3['10']=0
M3['11']=2
M3['12']=1
M3['20']=0
M3['21']=1
M3['22']=2
M4['00']=1
M4['01']=2
M4['02']=1
M4['10']=2
M4['11']=2
M4['12']=2
M4['20']=0
M4['21']=1
M4['22']=2
M5['00']=0
M5['01']=1
M5['02']=1
M5['10']=0
M5['11']=2
M5['12']=1
M5['20']=0
M5['21']=1
M5['22']=1
V6['00']=1
V6['01']=1
V6['02']=2
V6['10']=1
V6['11']=2
V6['12']=1
V6['20']=1
V6['21']=2
V6['22']=2
MM = {}
MM[0] = M1
MM[1] = M2
MM[2] = M3
MM[3] = M4
MM[4] = M5
MM[5] = V6
m = 3
b = [str(i)+str(j)+str(k) for i in range(m) for j in range(m) for k in range(m)]
import itertools
deep = 3
final = []
mylist = [MM[i] for i in range(0,7-1)]
b = [str(i)+str(j)+str(k) for i in range(m) for j in range(m) for k in range(m)]
def DFS(b, deep, maxx, sourceoperators, path):
 initlist = []
 if deep > 0:
  print("deep=", deep)
  for aa,bb in itertools.combinations(sourceoperators, 2):
   print(aa,bb)
   if deep == maxx:
finalresult = []
op1xy = [aa[b[i][0:1]+b[i][1:2]] for i in range(len(b))]
op1yz = [aa[b[i][1:2]+b[i][2:3]] for i in range(len(b))]
op1xz = [aa[b[i][0:1]+b[i][2:3]] for i in range(len(b))]
op2xy = [bb[b[i][0:1]+b[i][1:2]] for i in range(len(b))]
op2yz = [bb[b[i][1:2]+b[i][2:3]] for i in range(len(b))]
op2xz = [bb[b[i][0:1]+b[i][2:3]] for i in range(len(b))]
if sum(op1xy) == 54:
  path.append([(deep, aa, "xy")])
if sum(op1yz) == 54:
  path.append([(deep, aa, "yz")])
if sum(op1xz) == 54:
  path.append([(deep, aa, "xz")])
if sum(op2xy) == 54:
  path.append([(deep, bb, "xy")])
if sum(op2yz) == 54:
  path.append([(deep, bb, "yz")])
if sum(op2xz) == 54:  
  path.append([(deep, bb, "xz")])
initlist.append(op1xy)
initlist.append(op1yz)
initlist.append(op1xz)
initlist.append(op2xy)
initlist.append(op2yz)
initlist.append(op2xz)
   else:
level = []
for j in range(len(b)):
 op1xy = [aa[b[j][i]] for i in range(len(b[j]))]
 op2xy = [bb[b[j][i]] for i in range(len(b[j]))]
 if sum(op1xy) == 54:
  path.append([(deep, aa, "xy")])
 if sum(op2xy) == 54:
  path.append([(deep, bb, "xy")])
 level.append(op1xy)
 level.append(op2xy)
 initlist.append(op1xy)
 initlist.append(op2xy)
 if deep == maxx:
  b = []
  #print(len(list(itertools.combinations(initlist, 2
  for aaa,bbb in itertools.combinations(initlist, 2): 
   b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
  path = DFS(b, deep-1, maxx, sourceoperators, path)
 else:
  #print(len(list(itertools.combinations(initlist, 2
  for aaa,bbb in itertools.combinations(initlist, 2):
   b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
  path = DFS(b, deep-1, maxx, sourceoperators, path)
 return path

path = []
mresult = DFS(b, 2, 2, mylist, path)




Michael Selik於 2016年6月10日星期五 UTC+8上午6時45分14秒寫道:
> I like using Yelp's mrjob module (https://github.com/Yelp/mrjob) to run
> Python on Hadoop.
> 
> On Thu, Jun 9, 2016 at 2:56 AM Ho Yeung Lee 
> wrote:
> 
> > [... a bunch of code ...]
> 
> 
> If you want to describe a map-reduce problem, start with the data. What
> does a record of your input data look like?
> 
> Then think about your mapper. What key-value pairs will you extract from
> each line of data?
> 
> Then think about your reducer. For a single key and its associated values,
> what will you calculate?

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


[issue24759] Idle: require tk 8.5 and ttk widgets, and drop unneeded code.

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 76f831e4b806 by Terry Jan Reedy in branch 'default':
Issue #24759: IDLE requires tk 8.5 and availability ttk widgets.
https://hg.python.org/cpython/rev/76f831e4b806

--

___
Python tracker 

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



[issue24759] Idle: require tk 8.5 and ttk widgets, and drop unneeded code.

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 81927f86fa3a by Terry Jan Reedy in branch 'default':
Issue #24759: Add test for IDLE syntax colorizoer.
https://hg.python.org/cpython/rev/81927f86fa3a

--

___
Python tracker 

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



how to solve memory

2016-06-09 Thread meInvent bbird
https://drive.google.com/file/d/0Bxs_ao6uuBDULVNsRjZSVjdPYlE/view?usp=sharing

M1 = {}
M2 = {}
M3 = {}
M4 = {}
M5 = {}
V6 = {}
M1['00']=0
M1['01']=2
M1['02']=1
M1['10']=1
M1['11']=1
M1['12']=1
M1['20']=1
M1['21']=1
M1['22']=2
M2['00']=0
M2['01']=1
M2['02']=1
M2['10']=1
M2['11']=1
M2['12']=1
M2['20']=1
M2['21']=1
M2['22']=1
M3['00']=2
M3['01']=2
M3['02']=2
M3['10']=0
M3['11']=2
M3['12']=1
M3['20']=0
M3['21']=1
M3['22']=2
M4['00']=1
M4['01']=2
M4['02']=1
M4['10']=2
M4['11']=2
M4['12']=2
M4['20']=0
M4['21']=1
M4['22']=2
M5['00']=0
M5['01']=1
M5['02']=1
M5['10']=0
M5['11']=2
M5['12']=1
M5['20']=0
M5['21']=1
M5['22']=1
V6['00']=1
V6['01']=1
V6['02']=2
V6['10']=1
V6['11']=2
V6['12']=1
V6['20']=1
V6['21']=2
V6['22']=2
MM = {}
MM[0] = M1
MM[1] = M2
MM[2] = M3
MM[3] = M4
MM[4] = M5
MM[5] = V6
m = 3
b = [str(i)+str(j)+str(k) for i in range(m) for j in range(m) for k in range(m)]
import itertools
deep = 3
final = []
mylist = [MM[i] for i in range(0,7-1)]
b = [str(i)+str(j)+str(k) for i in range(m) for j in range(m) for k in range(m)]
def DFS(b, deep, maxx, sourceoperators, path):
 initlist = []
 if deep > 0:
  print("deep=", deep)
  for aa,bb in itertools.combinations(sourceoperators, 2):
   print(aa,bb)
   if deep == maxx:
finalresult = []
op1xy = [aa[b[i][0:1]+b[i][1:2]] for i in range(len(b))]
op1yz = [aa[b[i][1:2]+b[i][2:3]] for i in range(len(b))]
op1xz = [aa[b[i][0:1]+b[i][2:3]] for i in range(len(b))]
op2xy = [bb[b[i][0:1]+b[i][1:2]] for i in range(len(b))]
op2yz = [bb[b[i][1:2]+b[i][2:3]] for i in range(len(b))]
op2xz = [bb[b[i][0:1]+b[i][2:3]] for i in range(len(b))]
if sum(op1xy) == 54:
  path.append([(deep, aa, "xy")])
if sum(op1yz) == 54:
  path.append([(deep, aa, "yz")])
if sum(op1xz) == 54:
  path.append([(deep, aa, "xz")])
if sum(op2xy) == 54:
  path.append([(deep, bb, "xy")])
if sum(op2yz) == 54:
  path.append([(deep, bb, "yz")])
if sum(op2xz) == 54:  
  path.append([(deep, bb, "xz")])
initlist.append(op1xy)
initlist.append(op1yz)
initlist.append(op1xz)
initlist.append(op2xy)
initlist.append(op2yz)
initlist.append(op2xz)
   else:
level = []
for j in range(len(b)):
 op1xy = [aa[b[j][i]] for i in range(len(b[j]))]
 op2xy = [bb[b[j][i]] for i in range(len(b[j]))]
 if sum(op1xy) == 54:
  path.append([(deep, aa, "xy")])
 if sum(op2xy) == 54:
  path.append([(deep, bb, "xy")])
 level.append(op1xy)
 level.append(op2xy)
 initlist.append(op1xy)
 initlist.append(op2xy)
 if deep == maxx:
  b = []
  #print(len(list(itertools.combinations(initlist, 2
  for aaa,bbb in itertools.combinations(initlist, 2): 
   b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
  path = DFS(b, deep-1, maxx, sourceoperators, path)
 else:
  #print(len(list(itertools.combinations(initlist, 2
  for aaa,bbb in itertools.combinations(initlist, 2):
   b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
  path = DFS(b, deep-1, maxx, sourceoperators, path)
 return path

path = []
mresult = DFS(b, 2, 2, mylist, path)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue8491] Need readline command and keybinding information

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e981a4273cf6 by Martin Panter in branch '2.7':
Issue #8491: Add link to Gnu Readline configuration documentation
https://hg.python.org/cpython/rev/e981a4273cf6

New changeset 5bbb021450d7 by Martin Panter in branch '3.5':
Issue #8491: Add link to Gnu Readline configuration documentation
https://hg.python.org/cpython/rev/5bbb021450d7

New changeset 5b904920c2d1 by Martin Panter in branch 'default':
Issue #8491: Merge readline doc from 3.5
https://hg.python.org/cpython/rev/5b904920c2d1

--
nosy: +python-dev

___
Python tracker 

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



[issue15476] Index "code object" and link to code object definition

2016-06-09 Thread Martin Panter

Martin Panter added the comment:

Thanks for the patch Tommy. I think we can close this now.

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



[issue27186] add os.fspath()

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cec1f00c538d by Brett Cannon in branch 'default':
Issue #27186: Document PyOS_FSPath().
https://hg.python.org/cpython/rev/cec1f00c538d

--

___
Python tracker 

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



[issue26556] Update expat to 2.2.1

2016-06-09 Thread Brian Martin

Brian Martin added the comment:

Per http://expat.sourceforge.net/, version 2.1.1 fixes CVE-2015-1283, not 2.2.1 
as mentioned in a comment.

--
nosy: +Brian Martin

___
Python tracker 

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



[issue15476] Index "code object" and link to code object definition

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2e9aace7e10a by Tommy Beadle in branch '3.5':
[Issue 15476] Make "code object" its own entry in the index
https://hg.python.org/cpython/rev/2e9aace7e10a

New changeset 8455bbc6b4f2 by Martin Panter in branch 'default':
Issue #15476: Merge index entries from 3.5
https://hg.python.org/cpython/rev/8455bbc6b4f2

New changeset f89e96235a42 by Tommy Beadle in branch '2.7':
[Issue 15476] Make "code object" its own entry in the index
https://hg.python.org/cpython/rev/f89e96235a42

--
nosy: +python-dev

___
Python tracker 

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



Re: [Q] ImportError by __import__() on Python >= 3.4

2016-06-09 Thread Makoto Kuwata
On Wed, Jun 8, 2016 at 10:24 PM, Michael Selik 
wrote:

> By the way, why choose to write, import, and delete modules? I'd think
> exec'ing code would be sufficient.
>
>
In order to test my own framework for web application.
It loads controller classes lazily. In other words, it loads python module
only when it is required.

For example:

mappings = [
(r'/api/hello',   'myapp1.api.hello.Hello'),#
myapp1/api/hello.py will be loaded lazily
]
app = WSGIApplication(mappings)


In order to test this framework, it is necessary to create and load python
module file dynamically.

--
regars,
makoto
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23693] timeit accuracy could be better

2016-06-09 Thread STINNER Victor

STINNER Victor added the comment:

Hi,

I develop a new implementation of timeit which should be more reliable:
http://perf.readthedocs.io/en/latest/

* Run 25 processes instead of just 1
* Compute average and standard deviation rather than the minimum
* Don't disable the garbage collector
* Skip the first timing to "warmup" the benchmark

Using the minimum and disable the garbage collector is a bad practice, it is 
not reliable:

* multiple processes are need to test different random hash functions, since 
Python hash function is now randomized by default in Python 3
* Linux also randomizes the address space by default (ASLR) and so the exact 
timing of memory accesses is different in each process

My following blog post "My journey to stable benchmark, part 3 (average)" 
explains in depth the multiple issues of using the minimum:
https://haypo.github.io/journey-to-stable-benchmark-average.html

My perf module is very yound, it's still a work-in-progress. It should be 
better than timeit right now. It works on Python 2.7 and 3 (I tested 3.4).

We may pick the best ideas into the timeit module.

See also my article explaining how to tune Linux to reduce the "noise" of the 
operating system on microbenchmarks:
https://haypo.github.io/journey-to-stable-benchmark-system.html

--

___
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-06-09 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon
dependencies: +Add a "What's New" entry for PEP 519

___
Python tracker 

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



[issue27283] Add a "What's New" entry for PEP 519

2016-06-09 Thread Brett Cannon

New submission from Brett Cannon:

Issue to track the fact that I need to write the "What's New" entry once all 
other PEP 519-related work is finished.

--
assignee: brett.cannon
components: Documentation
messages: 268066
nosy: brett.cannon
priority: deferred blocker
severity: normal
stage: needs patch
status: open
title: Add a "What's New" entry for PEP 519
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



[issue27182] PEP 519 support in the stdlib

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6239673d5e1d by Brett Cannon in branch 'default':
Issue #27182: Document os.PathLike.
https://hg.python.org/cpython/rev/6239673d5e1d

--

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

For 3.6, I added ttk.Entry to x11 fixer.  I expanded tests to Entry and 
Spinboxes.  I noted in a comment that tk.Entry/Spinbox, but not ttk.Entry, 
would not paste with generated <> event without a 0-length selection.  
This might be a glitch in tk, but pasting with line Entry worked fine.  Will 
attach 3.5 and 2.7 patches as well.

The 2.7 test results in ThemeChanged warnings when run as part of test_idle, 
but not when run alone.  I am ignoring this.

I will apply when tests run on x11.

--
Added file: http://bugs.python.org/file43323/x11-paste-36.diff

___
Python tracker 

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



[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Added file: http://bugs.python.org/file43324/x11-paste-35.diff

___
Python tracker 

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



Re: which library has map reduce and how to use it for this case

2016-06-09 Thread Michael Selik
I like using Yelp's mrjob module (https://github.com/Yelp/mrjob) to run
Python on Hadoop.

On Thu, Jun 9, 2016 at 2:56 AM Ho Yeung Lee 
wrote:

> [... a bunch of code ...]


If you want to describe a map-reduce problem, start with the data. What
does a record of your input data look like?

Then think about your mapper. What key-value pairs will you extract from
each line of data?

Then think about your reducer. For a single key and its associated values,
what will you calculate?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue5124] IDLE - pasting text doesn't delete selection

2016-06-09 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Added file: http://bugs.python.org/file43325/x11-paste-27.diff

___
Python tracker 

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



Re: Tie dictionary to database table?

2016-06-09 Thread Michael Selik
On Thu, Jun 9, 2016 at 9:10 AM justin walters 
wrote:

> It looks like you might be looking for an ORM. Have you checked out
> sqlalchemy?
>

An ORM might be overkill. If you just want a persistent dictionary, just
use the shelve module. https://docs.python.org/3/library/shelve.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: UserList - which methods needs to be overriden?

2016-06-09 Thread Michael Selik
On Thu, Jun 9, 2016 at 5:07 AM Nagy László Zsolt 
wrote:

> I would like to create a collections.UserList subclass that can notify
> others when the list is mutated.
>

Why not subclass MutableSequence instead? The ABC will tell you which
methods to override (the abstract ones). The mixin methods rely on those
overrides.

from collections.abc import MutableSequence

def noisy(message):
def decorator(func):
def wrapper(*args, **kwargs):
print(message)
return func(*args, **kwargs)
return wrapper
return decorator

class NoisyList(MutableSequence):
def __init__(self, *args, **kwargs):
self.contents = list(*args, **kwargs)

def __getitem__(self, index):
return self.contents[index]

def __len__(self):
return len(self.contents)

@noisy('set')
def __setitem__(self, index, value):
self.contents[index] = value

@noisy('del')
def __delitem__(self, index):
del self.contents[index]

@noisy('insert')
def insert(self, index, value):
self.contents.insert(index, value)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Yury Selivanov

Yury Selivanov added the comment:

I've also updated PEP 492: https://hg.python.org/peps/rev/fef4b9969b9d  

Please feel free to post to this issue if you think that I should have covered 
it differently or in more detail.

--

___
Python tracker 

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



[issue27186] add os.fspath()

2016-06-09 Thread Brett Cannon

Brett Cannon added the comment:

I'm starting to catch up on everything you all did for PEP 519 and I wanted to 
say thanks! It looks like everything that needs to be done has been committed, 
has a patch, or just needs docs. The only thing I needed to do post-commit is 
tweak the docstrings to be PEP 8 compatible and reword some documention and 
docstrings.

--

___
Python tracker 

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



[issue27262] IDLE: move Aqua context menu code to maxosx

2016-06-09 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am leaving this open to look into later adding an automated test for this to 
the new test_editmenu file that will be added for #5124.

--

___
Python tracker 

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



[issue27186] add os.fspath()

2016-06-09 Thread Brett Cannon

Brett Cannon added the comment:

Re-opening as there are several patches that got put in here that have not been 
applied (e.g. glossary entry, os.DirEntry, etc.).

--
assignee:  -> brett.cannon
status: closed -> open

___
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-06-09 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka added the comment:
> See issue27213. Maybe fast call with keyword arguments would avoid the 
> creation of a dict.

In a first verison of my implementation, I used dictionary items
stored a a list of (key, value) tuples in the same PyObject* C array
than positional parameters.

But in practice, it's very rare in the C code base to have to call a
function with keyword parameters, but most functions expect keyword
parameters as a dict. They are implemented with
PyArg_ParseTupleAndKeywords() which expects a dict.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

Uri Okrent added the comment:

I updated the patch to improve the tests and made the same change to 
xmlrpc.client.ProtocolError (which was the only other place in xmlrpc.client).  
I'll let you decide if this patch is better despite the fact that it suffers 
from the same data duplication as Fault.

If not, we can go back to just fixing Fault, or come up with a fancier solution 
entirely that doesn't duplicate data.  Though, I hesitate to start getting too 
fancy for two reasons: 1) this module is old and stable, and 2) these are 
exception objects, so while the data duplication is ugly, the instances 
themselves should be short-lived.

--
Added file: 
http://bugs.python.org/file43322/0001-xmlrpc.client-make-Errors-pickleable.patch

___
Python tracker 

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



[issue15657] Error in Python 3 docs for PyMethodDef

2016-06-09 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +belopolsky

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

Serhiy Storchaka added the comment:

See issue27213. Maybe fast call with keyword arguments would avoid the creation 
of a dict.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

Uri Okrent added the comment:

My reading of the docs leads me to lean towards bug since this seems to break 
the contract of BaseException API in a standard lib module:

https://docs.python.org/3/library/exceptions.html#BaseException says 
BaseExceptions have args and with_traceback so those probably should be 
preserved in all standard lib inheritors.

This excerpt from the tutorial also seems to imply the same:
https://docs.python.org/3/tutorial/errors.html#user-defined-exceptions

"In this example, the default __init__() of Exception has been overridden. The 
new behavior simply creates the value attribute. This replaces the default 
behavior of creating the args attribute."

The tutorial goes out of its way to note that the default behavior of creating 
args has been replaced in this simple example -- i.e., one would expect args to 
be present.


As for your other comments, should I make a similar change to other inheritors 
of xmlrpc.client that inherit from xmlrpc.client.Error?  Should I instead 
completely remove Fault's constructor and just make faultCode and faultString 
properties so the attributes aren't duplicated (that seems like it may be 
dangerous)?

I will update the test for pickling with the other protocols.

--

___
Python tracker 

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



PyCon Keynote

2016-06-09 Thread Ethan Furman
There were many good talks and presentations at PyCon 2016, but if you 
can only watch one, this is the one to watch:


  https://www.youtube.com/watch?v=bSfe5M_zG2s

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


Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Marko Rauhamaa
Paul Rudin :

> Marko Rauhamaa  writes:
>> The spec (https://docs.python.org/3/reference/datamodel.html>)
>> uses the terms *identity* and *reference*, which are one-to-one.
>
> identity isn't the same thing as a name, identity is an inherent
> property of an object - many names may refer to the same object.

x is yif and only ifid(x) == id(y)

However, sorry for muddling the discussion by bringing in the identity.
I'll leave it out for now.

>> So your "names" are *variables*.
>
> Informally yes, but "variable" has no meaning in the language reference.

Really? How do you interpret these, then?

   Although the definition of assignment implies that overlaps between
   the left-hand side and the right-hand side are ‘simultaneous’ (for
   example a, b = b, a swaps two variables), overlaps within the
   collection of assigned-to variables occur left-to-right, sometimes
   resulting in confusion.

   https://docs.python.org/3/reference/simple_stmts.html?#assignme
   nt-statements>


   Assignments to __debug__ are illegal. The value for the built-in
   variable is determined when the interpreter starts.

   https://docs.python.org/3/reference/simple_stmts.html?#the-asse
   rt-statement>


   The public names defined by a module are determined by checking the
   module’s namespace for a variable named __all__

   https://docs.python.org/3/reference/simple_stmts.html?#the-impo
   rt-statement>

   It would be impossible to assign to a global variable without global,
   although free variables may refer to globals without being declared
   global.

   https://docs.python.org/3/reference/simple_stmts.html?#the-glob
   al-statement>

>> Unfortunately, virtually every word is overloaded and full of
>> preconceived notions. Hence: "pegs", "leashes", "puppies".
>>
>> The main thing is to keep those three concepts apart from each other.
>> Two notions will not suffice.
>
> Well - adding more things is confusing in IMO - we have a language
> reference, let's just use the terms in the language reference.

I have quoted "the language reference" quite a bit. Your turn.

You would be correct that there is something of an faux elitism going
around that is influencing the language spec as well to a degree. It
appears some people consider "variables," "assignments," "pointers" etc
to be too riff-raff. So people want to say Python is unlike C and has
"names," "bindings," "references" etc.

There's no shame in stating directly that Python has variables just like
C even though Python's variables are not first-class. There's no
difference between binding and assignment. And a reference is a synonym
to a pointer.

Python still has good stuff C doesn't, or even Java.


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


Re: movie from pictures

2016-06-09 Thread MRAB

On 2016-06-09 19:58, Peter Otten wrote:

Nev wrote:


Thank you for your reply. I tried something like this in python code:

from subprocess import call
call(["ffmpeg -framerate 4/1 -start_number 1 -i
C:\\Projects\\data2\\img_%05d.png -c:v libx264 -r 30 -pix_fmt yuv420p
C:\\Projects\\data2\\movie.mp4"])

But it did not work. I get FileNotFoundError: [WinError 2] The system
cannot find the file specified..


You have to pass the command-line arguments as separate items in the list:

call(["ffmpeg",
  "-framerate", "4/1",
  "-start_number", "1",
  "-i", "C:\\Projects\\data2\\img_%05d.png",
  ... # and so on
  ])


You should also give it the full path of ffmpeg.


On the other hand, in-loop solution would be more preferable since it lets
me to use variable names of the images and paths..


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


[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Yury Selivanov

Yury Selivanov added the comment:

Thanks a lot, Nick!  I've merged the patch.

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

___
Python tracker 

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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 93ad47d63b87 by Yury Selivanov in branch '3.5':
Issue #27243: Fix __aiter__ protocol
https://hg.python.org/cpython/rev/93ad47d63b87

New changeset 9ff95c30a38e by Yury Selivanov in branch 'default':
Merge 3.5 (issue #27243)
https://hg.python.org/cpython/rev/9ff95c30a38e

--
nosy: +python-dev

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> resolved

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Radosław Szalski

Radosław Szalski added the comment:

Thanks for the comments, you are both correct. I think that the issue is 
resolved now, so I'm closing this a won't 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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This looks reasonable.

But since Fault never was unpickleable, this issue is in gray zone between bug 
fixing and adding new feature. The latter can be done only in new Python 
version. I hesitate with classification of this issue.

There are a lot of other exceptions that can't be unpickled (including 
xmlrpc.client.ProtocolError). This may be a part of larger issue.

As for the patch itself, it solves the issue. But faultCode and faultString are 
saved twice (this is not a large problem for multiprocessing). Test should test 
pickling with all possible protocols (see how other pickle tests are written).

--

___
Python tracker 

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



Re: movie from pictures

2016-06-09 Thread Peter Otten
Nev wrote:

> Thank you for your reply. I tried something like this in python code:
> 
> from subprocess import call
> call(["ffmpeg -framerate 4/1 -start_number 1 -i
> C:\\Projects\\data2\\img_%05d.png -c:v libx264 -r 30 -pix_fmt yuv420p
> C:\\Projects\\data2\\movie.mp4"])
> 
> But it did not work. I get FileNotFoundError: [WinError 2] The system
> cannot find the file specified..

You have to pass the command-line arguments as separate items in the list:

call(["ffmpeg", 
  "-framerate", "4/1",
  "-start_number", "1",
  "-i", "C:\\Projects\\data2\\img_%05d.png",
  ... # and so on
  ])

> On the other hand, in-loop solution would be more preferable since it lets
> me to use variable names of the images and paths..


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


[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note that Decimal(0.05) != Decimal('0.05').

>>> Decimal(0.05)
Decimal('0.05000277555756156289135105907917022705078125')
>>> hash(Decimal(0.05))
966367654
>>> hash(Decimal('0.05000277555756156289135105907917022705078125'))
966367654
>>> hash(0.05)
966367654

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Tim Peters

Tim Peters added the comment:

Ah!  Yes, .getrandbits(N) outputs remain vulnerable to equation-solving in 
Python 3, for any value of N.  I haven't seen any code where that matters (may 
be "a security hole"), but would bet some _could_ be found.

There's no claim of absolute security here.  To the contrary.  What I'm opposed 
to is making _all_ naive code vulnerable to easy script-kiddie brute force 
attacks against lame seeding.

The kinds of things people _were_ jumping up & down about were the many 
instances of stuff like this on the web:

https://stackoverflow.com/questions/3854692/generate-password-in-python

Again, I'd be impressed if you could write code under Python 3 to deduce the MT 
state from any number of outputs from his naive approach in reasonable time.  
Of course he should be using urandom() instead (as an unaccepted answer urges) 
- but much code plain doesn't, and in Python 3 it's resistant to any attack the 
PHP paper exposed.

Make seeding lame again, and the easiest attacks can succeed again (the 
equation-solving stuff remains a footnote to me).

--

___
Python tracker 

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



Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Random832
On Thu, Jun 9, 2016, at 03:30, Antoon Pardon wrote:
> Then you think wrong. Python has no pointers, that is an implementation
> detail.

Nonsense. A binary number referring to a memory address is an
implementation detail. A pointer/reference/arrow-thingy-on-a-diagram is
the thing it is an implementation detail *of*.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

Uri Okrent added the comment:

I'm not pickling/unpickling it directly, I'm using multiprocessing to handle 
queries to my server in worker processes which is using pickle to propagate 
exceptions raised in the worker to the parent.

I could instead raise a different exception and wrap it in a Fault later (which 
is what I ended up doing to avoid the issue), but it seems like a case of 
"to-may-to" vs. "to-mah-to".  Either way an Exception should be able to be 
propagated up to the parent in multiprocessing, whether it's my own or Fault.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why you need to pickle Fault?

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

> Sorry, I don't know what "it" refers to.  Surely not to a program exposing 
> the output of .getstate()?!

random.getrandbits()

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Tim Peters

Tim Peters added the comment:

> Searching github pulls up a number of results of people
> calling it, but I haven't looked through them to see
> how/why they're calling it.

Sorry, I don't know what "it" refers to.  Surely not to a program exposing the 
output of .getstate()?!

Regardless, there was a long discussion about the `secrets` module at the time, 
and nobody found any real code vulnerable to the approaches in the PHP paper 
under Python 3 (contrived code, certainly - that's easy).  Again, exploiting 
lame seeding alone sufficed to crack most of their examples, and Python's use 
of urandom() for seeding eliminated that approach (in Python 2 too).  

Examples potentially vulnerable to state equation-solving were "just like" what 
the PHP coders rolled by hand:  uses of things like .choice() and .randrange() 
to build "random" strings (passwords, session tokens, ...), from relatively 
small alphabets.  The smaller the alphabet, the more resistant Python 3 is to 
this approach, because the more likely ._randbelow() will invisibly skip over 
MT outputs.

For a while an incorrect claim was mistakenly accepted:  that when 
len(alphabet) was a power of 2, choice(alphabet) made an always-known number of 
MT calls.  If that were true, the equation solver could deduce the state 
quickly in such cases, which are relatively common.  But it's false - 
._randbelow() is actually _most_ likely to skip over MT outputs when it's 
making a choice from a power-of-2 number of possibilities.  That's not obvious 
from a glance at the code.

I remain -1 on making seeding "dumb" again.  But I don't care whether urandom() 
returns low-quality bytes in the boot-time edge cases people are upset about.  
They're still likely to be "better" than anything spun out of stuff like 
time.time().

--

___
Python tracker 

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



Re: why it is like stop running after a 3 seconds

2016-06-09 Thread John Gordon
In <35cd5920-1fbb-441f-9fc6-2f3f2e5f8...@googlegroups.com> Ho Yeung Lee 
 writes:

> i write a program, it is like forever loop
> but i only restrict it to run 2 level recursively, 

I don't think the restriction is working.  There is "if deep > 0:"
at the top of the function, but the recursive calls aren't inside that
if block.  DFS keeps calling itself with smaller and smaller values of
deep.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

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


[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Mark Dickinson

Mark Dickinson added the comment:

> the behavior differs simply based on whether the Decimal was created from a 
> string vs a float

That's not quite right: a Decimal object keeps no knowledge of how it was 
created. The behaviour differs depending on whether the value of the Decimal 
happens to be exactly representable as a Python float or not. That's necessary 
to ensure the invariant `x == y` implies `hash(x) == hash(y)` continues to hold 
across types (though Python 3 has a better way of doing this).

So for example `Decimal('0.375')` was created from a string, but will hash 
equal to the exactly equal float `0.375`:

noether:float-proofs mdickinson$ python2
Python 2.7.11 (default, May  1 2016, 08:20:00) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> hash(Decimal('0.375')), hash(Decimal(0.375))
(1610579968, 1610579968)
>>> hash(0.375)
1610579968

--

___
Python tracker 

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



[issue27282] Raise BlockingIOError in os.urandom if kernel is not ready

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

Quoting http://bugs.python.org/issue27266#msg268043:

The key advantage the BlockingIOError model offers is that it's trivial to 
build a blocking version as a busy loop around the non-blocking version:

def urandom_wait_for_entropy(num_bytes):
while True:
try:
return os.urandom(num_bytes)
except BlockingIOError:
pass

And if you ignore the problem and just call os.urandom(), you'll almost 
certainly be fine unless you're working with Linux boot scripts or embedded ARM 
devices (in which case, this point will be minor compared to the other arcana 
you're dealing with).

--

___
Python tracker 

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



[issue27266] Always use getrandom() in os.random() on Linux and add block=False parameter to os.urandom()

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

Since Victor requested it, I filed #27282 to track the "raise BlockingIOError 
if the kernel would block" design option.

The key advantage that particular model offers is that it's trivial to build a 
blocking version as a busy loop around the non-blocking version:

def urandom_wait_for_entropy(num_bytes):
while True:
try:
return os.urandom(num_bytes)
except BlockingIOError:
pass

And if you ignore the problem and just call os.urandom(), you'll almost 
certainly be fine unless you're working with Linux boot scripts or embedded ARM 
devices (in which case, this point will be minor compared to the other arcana 
you're dealing with).

--

___
Python tracker 

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



[issue27282] Raise BlockingIOError in os.urandom if kernel is not ready

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

This proposal is reasonable to me and solves any problems I have with the 
default behavior of os.urandom.

--
nosy: +dstufft

___
Python tracker 

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



[issue27282] Raise BlockingIOError in os.urandom if kernel is not ready

2016-06-09 Thread Nick Coghlan

New submission from Nick Coghlan:

This proposal competes directly with #27250, #27266, and #27279 as possible 
long term solutions to the Linux/systemd os.urandom deadlock bug described in 
#26839

Rather than adding new APIs, or making os.urandom potentially blocking on Linux 
(as it was in 3.5.0 and 3.5.1), it instead proposes that os.urandom immediately 
raise BlockingIOError if the kernel entropy pool has not yet been initialised.

This behaviour will mean that users attempting to gather strong entropy too 
early in the Linux boot process will fail rather than block, so affected 
scripts and programs can readily fall back to reading from /dev/urandom or 
using the random module APIs if they don't need cryptographically strong random 
data. Scripts that do need cryptographically strong random data can either poll 
os.urandom until it succeeds, or else fail explicitly and let their caller 
resolve the problem.

--
messages: 268041
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Raise BlockingIOError in os.urandom if kernel is not ready
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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Donald Stufft

Donald Stufft added the comment:

> But that's not what real-life programs expose.

Are you sure? Searching github pulls up a number of results of people calling 
it, but I haven't looked through them to see how/why they're calling it.

> What do you believe?  For example, do you believe it would remain a disaster 
> if MT initialization wanted only 1 byte from urandom()?  Or is 0 the only 
> value you can live with?

I don't really care that much what random.Random initialized with except as it 
related to what os.urandom does by default. Here's a copy/paste from my email 
to python-dev about it:

* Use getrandom(GRND_NONBLOCK) for random.Random since it doesn't matter if we
  get cryptographically secure random numbers or not.
* Switch it to use something other than a CSPRNG by default since it doesn't
  need that.
* Instead of seeding itself from os.urandom on import, have it lazily do that
  the first time one of the random.rand* functions are called.
* Do nothing, and say that ``import random`` relies on having the kernel's
  urandom pool initialized.

Between these options, I have a slight preference for switching it to use a non 
CSPRNG, but I really don't care that much which of these options we pick. Using 
random.Random is not secure and none of the above options meaningfully change 
the security posture of something that accidently uses it.

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

Looks good to me, thanks.

--
nosy: +berker.peksag

___
Python tracker 

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



Re: UserList - which methods needs to be overriden?

2016-06-09 Thread Nagy László Zsolt

> [Looks like you made progress while I struggled to come up with the 
> following. I'll post it anyway.]
Your version is much better. Thanks! :-)

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


[issue27279] Add random.cryptorandom() and random.pseudorandom, deprecate os.urandom()

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

As with other proposals to add new APIs, I think this is an overreaction to a 
Linux specific problem. Linux system boot could deadlock with 3.5.0 and 3.5.1 
due to:

- CPython startup using os.urandom() when it wasn't necessary
- systemd invoking a Python script before the OS entropy pool had been 
initialised (which then deadlocked until the Python invocation timed out)

As long as we switch the internal hash algorithm to seeding from a non-blocking 
random source, and also ensure that importing the random module doesn't 
implicitly call os.urandom, then any other software that only needs 
pseudorandom data can just use the random module APIs.

--
nosy: +ncoghlan

___
Python tracker 

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



Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Paul Rudin  writes:

> Marko Rauhamaa  writes:

>> So your "names" are *variables*.
>
> Informally yes, but "variable" has no meaning in the language reference.
>

... err sorry, actually not correct - but irrelevant to the point under
discussion.



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


[issue27271] asyncio lost udp packets

2016-06-09 Thread Guido van Rossum

Guido van Rossum added the comment:

You're welcome Valdemar. It's a wonderful world, there's so much to learn!
Sounds like you're on the right path. Good luck!

--

___
Python tracker 

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



[issue27272] random.Random should not read 2500 bytes from urandom

2016-06-09 Thread Tim Peters

Tim Peters added the comment:

Donald, your script appears to recreate the state from some hundreds of 
consecutive outputs of getrandbits(64).  Well, sure - but what of it?  That 
just requires inverting the MT's tempering permutation.  You may as well note 
that the state can be recreated from the output of random.getstate() - in which 
case, your script could be a lot shorter too ;-)

But that's not what real-life programs expose.  All the flaws in the PHP paper 
related to deducing PRNG state were found in real-life code using idiomatic PHP 
ways of spelling choice() or randrange(), with relatively few possible outputs.

Produce a program that can deduce the state, in Python 3, from - say - a 
million consecutive outputs of randrange(256), and _that_ would be interesting, 
because that would be relevant.  It's easy in Python 2.  But in Python 3, you 
can't tell from the outputs how many times MT was invoked under the covers 
(but, of course, you can from your contrived getrandbits(64) outputs - the 
C-level MT is called exactly twice for each of those outputs).

In any case, the vast bulk of the PHP flaws were found by out-brute-forcing 
dumb PRNG initialization, which requires nothing in the way of reproducing 
state via reverse-engineering outputs (see Figure 13).  Noting that idiomatic 
use of Python 3's choice() (etc) is resistant to the paper's equation-solving 
state-deducing approach is really just a footnote - the _point_ is that lame 
seeding is, all by itself, a Bad Idea.  That alone was enough to crack most of 
the PHP programs the paper covered.

As to the rest, there are already too many massive bug reports arguing about 
urandom()-in-general.  The title of _this_ bug report suggested it may be good 
enough to reduce the _number_ of urandom() bytes MT initialization uses.  But, 
so far, Victor & I appear to be the only ones who made an on-topic comment 
about that ;-)

What do you believe?  For example, do you believe it would remain a disaster if 
MT initialization wanted only 1 byte from urandom()?  Or is 0 the only value 
you can live with?

--

___
Python tracker 

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



[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +loewis
stage:  -> patch review
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue27243] __aiter__ should return async iterator instead of awaitable

2016-06-09 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 from me - my only comments were on the docs updates and one of the 
explanatory comments in the code.

--

___
Python tracker 

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



Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Marko Rauhamaa  writes:

> Paul Rudin :
>
>> Marko Rauhamaa  writes:
>>> The object is only an intermediate result; what is returned is a
>>> pointer (to an object), without an exception. That's not a matter of
>>> implementation. It's an essential part of Python's data model.
>>
>> Well - the language has no explicit notion of "pointer", [...] it's
>> better (IMO) to just talk in the terms the language specification
>> uses.
>
> The spec (https://docs.python.org/3/reference/datamodel.html>)
> uses the terms *identity* and *reference*, which are one-to-one.

identity isn't the same thing as a name, identity is an inherent
property of an object - many names may refer to the same object.

Similarly reference doesn't mean the same thing as identity. A reference
to an object can occur, for example:

["foo"]

The list refers to the string. There's no name involved anywhere. Both
the list and the string have an identity, but that's essentially
irrelevant to the fact that the list has a reference to the string.

>
>> There are names and objects, and mechanisms by which names come to
>> refer to objects according to the execution model.
>
> The spec as well as Python itself uses the word "name" for various
> strings:
>
>>>> "x".__class__.__name__
>'str'
>>>> __name__
>'__main__'
>

__name__ is not the same thing as what the spec means when it talks of a
name.

It's certainly true that a class declaration creates a binding from that
name to an object representing the class. But other names can equally
well refer to the same object:

>>> class Foo:
... pass
... 
>>> Bar = Foo
>>> x = Bar()
>>> x.__class__.__name__
'Foo'
>>>

>
> So your "names" are *variables*.

Informally yes, but "variable" has no meaning in the language reference.

>
> Your "mechanisms" are *references*.
>

Nope - when I spoke of mechanisms I was talking about the different
operational semantics by which a given names can be bound to an object.

Once such an binding has occured then I agree that the name refers to
the object in question.

> Your "objects" are *objects*.
>

I think I probably agree, but I'm not sure what you're saying - "object"
means something in the language reference - that's what I'm talking
about.


>> Talk of pointers is potentially confusing, because it carries baggage
>> from other languages which doesn't necessary map precisely onto the
>> python execution model.
>
> Unfortunately, virtually every word is overloaded and full of
> preconceived notions. Hence: "pegs", "leashes", "puppies".
>
> The main thing is to keep those three concepts apart from each other.
> Two notions will not suffice.
>

Well - adding more things is confusing in IMO - we have a language
reference, let's just use the terms in the language reference.

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


Re: movie from pictures

2016-06-09 Thread Nev
Thank you for your reply. I tried something like this in python code:

from subprocess import call
call(["ffmpeg -framerate 4/1 -start_number 1 -i 
C:\\Projects\\data2\\img_%05d.png -c:v libx264 -r 30 -pix_fmt yuv420p 
C:\\Projects\\data2\\movie.mp4"])

But it did not work. I get FileNotFoundError: [WinError 2] The system cannot 
find the file specified..

On the other hand, in-loop solution would be more preferable since it lets me 
to use variable names of the images and paths.. 

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


[issue27274] [ctypes] Allow from_pointer creation

2016-06-09 Thread Memeplex

Memeplex added the comment:

> The first argument can be any type accepted by c_void_p.from_param, such as a 
> ctypes pointer/array, str, bytes, or an integer address.

Now I see why you suggested ptr.as_void in 26565. Both issues are very related. 
Some functions are overloaded in the sense they automatically call 
c_void_p.from_param on their arguments; other functions aren't. Uniformity 
would dictate to treat all functions expecting an address the same way. Anyway 
this would not cover all use cases for ptr.toaddress or ptr.as_void or whatever 
it gets called.

--

___
Python tracker 

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



[issue26985] Information about CodeType in inspect documentation is outdated

2016-06-09 Thread Berker Peksag

Berker Peksag added the comment:

"Return true if the object is a code object." should stay. We can add a short 
sentence to refer people to the inspect documentation for the list of co_* 
attributes.

--

___
Python tracker 

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



[issue27274] [ctypes] Allow from_pointer creation

2016-06-09 Thread Memeplex

Memeplex added the comment:

Thank you for the great tips, Eryk, somehow I overlooked string_at while 
reading the docs.

Now, given that the address parameter of string_at is pretty overloaded, 
wouldn't it be reasonable to overload from_address the same instead of 
introducing from_pointer? That is, everywhere an address is expected, an 
address-like ctypes object would be ok.

--

___
Python tracker 

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



[issue27271] asyncio lost udp packets

2016-06-09 Thread valdemar pavesi

valdemar pavesi added the comment:

thanks Guido and Yury

I am new on python world. I was working with automation tests, sw implemented 
in Delphi in 199x.

this year I got a python certification from University Texas Arlington 
University by EDX.

and I already wrote 4 projects in python3 ,handling heavy traffic , one related 
to voice over lte simulation.

thanks for all your contribution to the world without asking nothing back.


regards!
valdemar

--

___
Python tracker 

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



[issue26985] Information about CodeType in inspect documentation is outdated

2016-06-09 Thread Xiang Zhang

Xiang Zhang added the comment:

So maybe remove the docstring entirely?

--

___
Python tracker 

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



Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Marko Rauhamaa
Paul Rudin :

> Marko Rauhamaa  writes:
>> The object is only an intermediate result; what is returned is a
>> pointer (to an object), without an exception. That's not a matter of
>> implementation. It's an essential part of Python's data model.
>
> Well - the language has no explicit notion of "pointer", [...] it's
> better (IMO) to just talk in the terms the language specification
> uses.

The spec (https://docs.python.org/3/reference/datamodel.html>)
uses the terms *identity* and *reference*, which are one-to-one.

> There are names and objects, and mechanisms by which names come to
> refer to objects according to the execution model.

The spec as well as Python itself uses the word "name" for various
strings:

   >>> "x".__class__.__name__
   'str'
   >>> __name__
   '__main__'


So your "names" are *variables*.

Your "mechanisms" are *references*.

Your "objects" are *objects*.

> Talk of pointers is potentially confusing, because it carries baggage
> from other languages which doesn't necessary map precisely onto the
> python execution model.

Unfortunately, virtually every word is overloaded and full of
preconceived notions. Hence: "pegs", "leashes", "puppies".

The main thing is to keep those three concepts apart from each other.
Two notions will not suffice.


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


[issue27265] Hash of different, specific Decimals created from str is the same

2016-06-09 Thread Radosław Szalski

Radosław Szalski added the comment:

Thanks for the reply and analysis, Mark.

My motivation was that as a "clueless user", I shouldn't worry about how 
Decimals are created. Given two equal numbers, I would expect their behavior 
(e.g., result of a hash) to be the same as well. In this example, the behavior 
differs simply based on whether the Decimal was created from a string vs a 
float.

However, since there are bound to be collisions, and the performance overhead 
is negligible (in case of a collision), and Python 3 solves this problem I 
agree this can be closed as "won't-fix".

--
status: pending -> open

___
Python tracker 

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



Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-09 Thread Lawrence D’Oliveiro
On Wednesday, June 8, 2016 at 10:39:00 PM UTC+12, rocky wrote:

> In addition to the example programs which give the classic arithmetic
> expression evaluator, I now include the beginnings of a full Python 2.6
> language.

Does anybody bother with LR(k) parsers any more?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27281] unpickling an xmlrpc.client.Fault raises TypeError

2016-06-09 Thread Uri Okrent

New submission from Uri Okrent:

Attempting to unpickle an xmlrpc.client.Fault will raise a TypeError:

>>> import xmlrpc.client as xmlrpclib
>>> f = xmlrpclib.Fault(42, 'Test Fault')
>>> import pickle
>>> s = pickle.dumps(f)
>>> pickle.loads(s)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: __init__() missing 2 required positional arguments: 'faultCode' and 
'faultString'

Apparently unpickle relies on BaseException's args attribute when 
reconstructing an Exception class that inherits from BaseException (Fault 
inherits from Exception).  Unfortunately, Fault implements __init__() and does 
call the base class constructor, but does not pass its arguments, so Fault.args 
is always an empty tuple.

Simply passing Fault's arguments to the base class constructor allows it to be 
unpickled.

I've included a patch for 3.x but the issue is present in 2.x as well (the code 
and fix are exactly the same except in xmlrpclib.py).

--
components: Library (Lib)
files: 0001-xmlrpc.client-make-Fault-pickleable.patch
keywords: patch
messages: 268028
nosy: Uri Okrent
priority: normal
severity: normal
status: open
title: unpickling an xmlrpc.client.Fault raises TypeError
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: 
http://bugs.python.org/file43321/0001-xmlrpc.client-make-Fault-pickleable.patch

___
Python tracker 

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



[issue27270] 'parentheses-equality' warnings when building with clang and ccache

2016-06-09 Thread STINNER Victor

STINNER Victor added the comment:

clang_ccache.patch LGTM.

--
nosy: +haypo

___
Python tracker 

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



Re: I'm wrong or Will we fix the ducks limp?

2016-06-09 Thread Paul Rudin
Marko Rauhamaa  writes:

> Paul Rudin :
>
>> Marko Rauhamaa  writes:
>>> What is different is that in Python, every expression evaluates to a
>>> pointer. Thus, you can only assign pointers to variables.
>>
>> I don't think that's really right - every expression evaluates to an
>> object.
>
> The object is only an intermediate result; what is returned is a pointer
> (to an object), without an exception. That's not a matter of
> implementation. It's an essential part of Python's data model.
>

Well - the language has no explicit notion of "pointer", so I'm not sure
it's really correct to say that it's an essential part of the data
model. The way variables are used to reference the objects associated
with them from time to time has some similarities with pointer semantics
in other languages. But actually it's better (IMO) to just talk in the
terms the language specification uses. 

There are names and objects, and mechanisms by which names come to refer
to objects according to the execution model.


> (However, since "pointer" is evokes passions among crowds, it is better
> to use the neutral word "leash".)


Talk of pointers is potentially confusing, because it carries baggage
from other languages which doesn't necessary map precisely onto the
python execution model.


(The underlying cpython implementation, is neither here nor there - we
could in theory implement python in some other language which lacks a
pointer type.)

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


EuroPython 2016 Keynotes

2016-06-09 Thread M.-A. Lemburg
We are pleased to announce our keynote schedule for EuroPython 2016:

 * Monday: Rachel Willmer & Nicholas Tollervey
 * Tuesday: Paul Hildebrandt
 * Wednesday: Jameson Rollins
 * Thursday: Naomi Ceder
 * Friday: Gaël Varoquaux

More information about our keynoters is available on the keynote
schedule page and the blog posts for each keynote:

   *** EuroPython 2016 Keynotes ***

   https://ep2016.europython.eu/en/events/keynotes/

We have also updated the schedule accordingly:

   *** EuroPython 2016 Schedule ***

   https://ep2016.europython.eu/p3/schedule/ep2016/


With gravitational regards,
--
EuroPython 2016 Team
http://ep2016.europython.eu/
http://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/740868506862915584
Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


EuroPython 2016 Keynotes

2016-06-09 Thread M.-A. Lemburg
We are pleased to announce our keynote schedule for EuroPython 2016:

 * Monday: Rachel Willmer & Nicholas Tollervey
 * Tuesday: Paul Hildebrandt
 * Wednesday: Jameson Rollins
 * Thursday: Naomi Ceder
 * Friday: Gaël Varoquaux

More information about our keynoters is available on the keynote
schedule page and the blog posts for each keynote:

   *** EuroPython 2016 Keynotes ***

   https://ep2016.europython.eu/en/events/keynotes/

We have also updated the schedule accordingly:

   *** EuroPython 2016 Schedule ***

   https://ep2016.europython.eu/p3/schedule/ep2016/


With gravitational regards,
--
EuroPython 2016 Team
http://ep2016.europython.eu/
http://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/740868506862915584
Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


  1   2   3   >