[issue23581] unittest.mock.MagicMock doesn't support matmul (@) operator

2015-03-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - berker.peksag
stage: patch review - commit review

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



[issue23486] Enum member lookup is 20x slower than normal class attribute lookup

2015-03-11 Thread Ethan Furman

Ethan Furman added the comment:

Slight reordering of code removed the one user visible change.

--

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



[issue23633] Improve py launcher help, index, and doc

2015-03-11 Thread eryksun

eryksun added the comment:

 To me, the reference to the windows internal function is 
 worse than useless and should perhaps be removed.

The docs could add an example commandline to edit the per-user .ini: 

NT 6: notepad %LOCALAPPDATA%\py.ini
NT 5: notepad %USERPROFILE%\Local Settings\Application Data\py.ini

Editing the global .ini would be simpler if the launcher looked for it in 
FOLDERID_ProgramData (i.e. CSIDL_COMMON_APPDATA). In that case even a limited 
user could create it. For example:

NT 6: notepad %ProgramData%\py.ini
NT 5: notepad %ALLUSERSPROFILE%\Application Data\py.ini

The security on %ProgramData% grants full control to the creator of files and 
directories. It also allows all users to create, read and execute files and 
directories.

--
nosy: +eryksun

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



[issue23486] Enum member lookup is 20x slower than normal class attribute lookup

2015-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2545bfe0d273 by Ethan Furman in branch 'default':
Close issue23486: performance boost for enum member lookup
https://hg.python.org/cpython/rev/2545bfe0d273

--
nosy: +python-dev
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue23640] Enum.from_bytes() is broken

2015-03-11 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
stage:  - test needed

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



[issue23642] Interaction of ModuleSpec and C Extension Modules

2015-03-11 Thread David Beazley

David Beazley added the comment:

inal comment.  It seems that one can generally avoid a lot of nastiness if 
importlib.reload() is used instead.  For example:

 mod = sys.modules[spec.name] = module_from_spec(spec)
 importlib.reload(mod)

This works for both source and Extension modules and completely avoids the need 
to worry about the exec_module()/load_module() warts.   Wouldn't say it's an 
obvious approach though ;-).

--

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



[issue23625] load_module() docs: zipped eggs are not loaded.

2015-03-11 Thread Brett Cannon

Brett Cannon added the comment:

Egg files are not a part of the Python stdlib and so I don't understand why you 
expected them to be supported by imp? Anyway, because egg files are not from 
Python itself but a third-party project they shouldn't be referenced from the 
official docs as it would just confuse people who don't know what eggs even are.

--
assignee:  - docs@python
components: +Documentation
nosy: +brett.cannon, docs@python
resolution:  - not a bug
status: open - closed
versions: +Python 2.7

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



[issue23642] Interaction of ModuleSpec and C Extension Modules

2015-03-11 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +brett.cannon, eric.snow, ncoghlan

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



[issue23467] Improve byte formatting compatibility between Py2 and Py3

2015-03-11 Thread STINNER Victor

STINNER Victor added the comment:

You should also update the PEP 461.

--

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



[issue23467] Improve byte formatting compatibility between Py2 and Py3

2015-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 611fa301b807 by Ethan Furman in branch 'default':
Close issue23467: add %r compatibility to bytes and bytearray
https://hg.python.org/cpython/rev/611fa301b807

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue23640] Enum.from_bytes() is broken

2015-03-11 Thread Ethan Furman

Ethan Furman added the comment:

The only solution that is coming to mind is to have EnumMeta go through the 
other base classes, wrap any classmethods it finds, and ensure that they return 
their appropriate type and not an Enum type.

Any other ideas?

--

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



[issue23642] Interaction of ModuleSpec and C Extension Modules

2015-03-11 Thread David Beazley

David Beazley added the comment:

Sorry. I take back the previous message.  It still doesn't quite do what I 
want.   Anyways, any insight or thoughts about this would be appreciated ;-).

--

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



[issue23641] Got rid of bad dunder names

2015-03-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
dependencies: +unittest.mock.MagicMock doesn't support matmul (@) operator

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



[issue23640] Enum.from_bytes() is broken

2015-03-11 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
keywords: +patch
stage: test needed - needs patch
Added file: http://bugs.python.org/file38444/issue23640.stoneleaf.01.patch

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



[issue23642] Interaction of ModuleSpec and C Extension Modules

2015-03-11 Thread David Beazley

New submission from David Beazley:

I have been investigating some of the new importlib machinery and the addition 
of ModuleSpec objects.  I am a little curious about the intended handling of C 
Extension modules going forward. 

Backing up for a moment, consider a pure Python module.  It seems that I can do 
things like this to bring a module into existence (some steps involving 
sys.modules omitted).

 from importlib.util import find_spec, module_from_spec
 spec = find_spec('socket')
 socket = module_from_spec(spec)
 spec.loader.exec_module(socket)


However, it all gets weird with C extension modules.  For example, you can 
perform the first few steps:

 spec = find_spec('math')
 spec
ModuleSpec(name='math', loader=_frozen_importlib.ExtensionFileLoader object at 
0x1012122b0, origin='/usr/local/lib/python3.5/lib-dynload/math.so')
 math = module_from_spec(spec)
 math
module 'math' from '/usr/local/lib/python3.5/lib-dynload/math.so'
 dir(math)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']

As you can see, you get a fresh unloaded module here.  However, if you try to 
bring in the module contents, things get screwy.

 spec.loader.exec_module(math)
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'ExtensionFileLoader' object has no attribute 'exec_module'


Yes, this is the old legacy interface in action--there is no exec_module() 
method.   You can always fall back to load_module() like this:

 spec.loader.load_module(spec.name)
module 'math' from '/usr/local/lib/python3.5/lib-dynload/math.so'


The problem here is that it creates a brand new module and ignores the one that 
was previously created by module_from_spec().  That module is still empty:

 dir(math)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
 

I realize that I'm treading into a swamp of legacy interfaces and some pretty 
complex machinery here.  However, here's my question:  are C extension modules 
always going to be a special case that need to be considered code that 
interacts with the import system.  Specifically, will it need to be 
special-cased to use load_module() instead of the 
module_from_spec()/exec_module() combination?

I suppose the question might also apply to built-in and frozen modules as well 
(although I haven't investigated that so much). 

Mainly, I'm just trying to gain some insight from the devs as to the overall 
direction where the import implementation is going with this.

P.S.  ModuleSpecs are cool. +1

--
components: Interpreter Core
messages: 237872
nosy: dabeaz
priority: normal
severity: normal
status: open
title: Interaction of ModuleSpec and C Extension Modules
type: behavior
versions: Python 3.5

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



[issue23625] load_module() docs: zipped eggs are not loaded.

2015-03-11 Thread Thomas Guettler

Thomas Guettler added the comment:

Dear Bret Cannon,

I don't ask for egg support in the imp module.
I don't want to change the implemenation of imp.find_module()

I just want to update the docs.

Most people run a python version which supports loading zipped eggs.

Please reopened this, since I think you misunderstood me. If not, and you don't 
care about the docs. Leave it closed :-)

--
nosy: +guettli

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



[issue23192] Generator return value ignored in lambda function

2015-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2b4a04c3681b by Serhiy Storchaka in branch '3.4':
Issue #23192: Fixed generator lambdas.  Patch by Bruno Cauet.
https://hg.python.org/cpython/rev/2b4a04c3681b

New changeset a3b889e9d3f3 by Serhiy Storchaka in branch 'default':
Issue #23192: Fixed generator lambdas.  Patch by Bruno Cauet.
https://hg.python.org/cpython/rev/a3b889e9d3f3

--
nosy: +python-dev

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



[issue23615] Reloading tokenize breaks tokenize.open()

2015-03-11 Thread Brett Cannon

Brett Cannon added the comment:

LGTM as well. You want to commit, Serhiy? If not assign to me and I will get to 
it on Friday.

--
assignee:  - serhiy.storchaka

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



[issue23615] Reloading tokenize breaks tokenize.open()

2015-03-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 383ba3699084 by Serhiy Storchaka in branch '3.4':
Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with
https://hg.python.org/cpython/rev/383ba3699084

New changeset 6e736a57a482 by Serhiy Storchaka in branch 'default':
Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with
https://hg.python.org/cpython/rev/6e736a57a482

New changeset 36bd5add9732 by Serhiy Storchaka in branch '2.7':
Issue #23615: Module tarfile is now can be reloaded with imp.reload().
https://hg.python.org/cpython/rev/36bd5add9732

--
nosy: +python-dev

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



[issue23615] Reloading tokenize breaks tokenize.open()

2015-03-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


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

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



[issue23639] Not documented special names

2015-03-11 Thread Éric Araujo

Éric Araujo added the comment:

I think like Ezio does.  Python covers itself by saying that all names starting 
and ending with two underscores are reserved, and documents those that are 
interesting for users.  On the other hand, many third-party 
frameworks/libs/apps invent their own __names__ (often for metadata, sometimes 
for custom protocols); I don’t know if a full list of existing names in the doc 
would have dissuaded them.

--

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



[issue23639] Not documented special names

2015-03-11 Thread Peter Otten

Changes by Peter Otten __pete...@web.de:


--
nosy: +peter.otten

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



[issue23633] Improve py launcher help, index, and doc

2015-03-11 Thread Steve Dower

Steve Dower added the comment:

For a per-user install, the launcher does not go in C:\Windows (note that 
Python 3.4 does not really have per-users installs). The correct location for 
the ini file in every case is alongside the executable, and it must always be 
named py.ini.

py.exe is put into C:\Windows because that directory will always be on PATH and 
has no 32-bit/64-bit redirection. The next best location would be a 
subdirectory of %CommonProgramFiles% and %CommonProgramFiles(x86)% and we'd 
probably need to install it twice.

The access denied message you got was because %LocalAppData% is a directory. 
Try doing:

 notepad %localappdata%\test.txt

--

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



[issue14436] SocketHandler sends obejcts while they cannot be unpickled on receiver's side

2015-03-11 Thread Nathan Jensen

Nathan Jensen added the comment:

I'm not sure this was fixed in an optimal way.

We have a set of processes using the SocketHandler to send log records to a 
single log process.  Some of these log records have the msg attribute as a 
dictionary that contained a variety of extra information about the event that 
was being logged.  After this change, our process receiving the events and 
logging to a file stopped working correctly because it was expecting a 
dictionary for the msg but was always receiving a string.  (I have since made 
it smarter).

The fix for this ticket makes sense when you don't have a guarantee of being 
able to unpickle the msg on the receiving end, but it also limits some of the 
adaptability to pass objects using the SocketHandler.

Some possible improvements:
1. Add a flag to SocketHandler on whether or not it should force the msg to a 
string
2. If it's it a built-in picklable type, don't force to string, else force msg 
to string

Suggestion 2 has some drawbacks in that you'd have to loop over lists, 
dictionaries, etc to verify everything inside there is also picklable.  Also it 
would prevent you from sending custom objects across.

--
nosy: +Nathan Jensen

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



[issue23615] Reloading tokenize breaks tokenize.open()

2015-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Is there a method to detect other reload bugs?

--

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy:  -ned.deily

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Ned Deily

Ned Deily added the comment:

Isn't this a duplicate of Issue5765 and Issue11383?

--
nosy:  -ronaldoussoren

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
components:  -Macintosh

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Michael Klein

New submission from Michael Klein:

I have gotten Segmentation Fault: 11 with the newest version of Python 2.7 
and nothing but standard functions. The program is of the following form 
(attached to this email):

def loopcountaux(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, 
a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, 
a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43):

loopcount = ((1-a36)*(a37)*(1-a41)) + ((a22)*(a33)*(1-a23)) + 
((a27)*(a34)*(1-a28)) + ((a38)*(a43)*(1-a39)) + 
((a40)*(a42)*(1-a41))+((1-a22)*(1-a33)*(a23)) + ((1-a27)*(1-a34)*(a28)) + 
((1-a38)*(1-a43)*(a39)) + ((1-a40)*(1-a42)*(a41)) + ((a36)*(1-a37)*(a41))
return loopcount

print 
loopcountaux(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)

The only difference between this and the file which causes the fault is the 
number of formulas added to the line where loopcount is defined (74858 more 
of a similar kind). Note that this program finds the number of boolean formulas 
from a given set which are true for given variables a1, a2,... For example, 
((1-a36)*(a37)*(1-a41)) is effectively the same as (not a36) and (a37) and 
(not a41).

If this example makes debugging particularly difficult, I can try to find a 
less complex example, though this example is just long enough to cause a 
segfault (with one less statement it runs well).

Thank you for your time.

The OSX error report is as follows:

Process:   Python [8151]
Path:  
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:Python
Version:   2.7.9 (2.7.9)
Code Type: X86-64 (Native)
Parent Process:bash [3554]
Responsible:   Terminal [599]
User ID:   501

Date/Time: 2015-03-11 12:21:52.952 -0400
OS Version:Mac OS X 10.10.2 (14C109)
Report Version:11
Anonymous UUID:49801587-229C-BA4D-0630-D2490825F5C7

Sleep/Wake UUID:   44D3FBEF-DC64-44CA-A10A-70E9E16AE5C2

Time Awake Since Boot: 16 seconds
Time Since Wake:   17000 seconds

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

Exception Type:EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:   KERN_PROTECTION_FAILURE at 0x7fff5f38

VM Regions Near 0x7fff5f38:
MALLOC_SMALL   00014e80-00015100 [ 40.0M] rw-/rwx 
SM=PRV  
-- STACK GUARD7fff5bc0-7fff5f40 [ 56.0M] ---/rwx 
SM=NUL  stack guard for thread 0
Stack  7fff5f40-7fff5fc0 [ 8192K] rw-/rwx 
SM=COW  thread 0

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.python.python   0x00010005d734 
PyObject_RichCompareBool + 4
1   org.python.python   0x000100070f38 tuplerichcompare + 
152
2   org.python.python   0x00010005cbf9 PyObject_RichCompare 
+ 201
3   org.python.python   0x00010005d760 
PyObject_RichCompareBool + 48
4   org.python.python   0x000100052ebd lookdict + 397
5   org.python.python   0x000100054900 PyDict_GetItem + 112
6   org.python.python   0x0001000c63a5 compiler_add_o + 277
7   org.python.python   0x0001000c9348 compiler_visit_expr 
+ 840
8   org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
9   org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
10  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
11  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
12  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
13  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
14  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
15  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
16  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
17  org.python.python   0x0001000c9bc0 compiler_visit_expr 
+ 3008
18  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
19  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
20  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
21  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
22  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
23  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
24  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
25  org.python.python   0x0001000c9bac compiler_visit_expr 
+ 2988
26  

[issue23615] Reloading tokenize breaks tokenize.open()

2015-03-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Only grep.

--

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Michael Klein

Changes by Michael Klein michael14...@gmail.com:


--
type:  - crash

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Michael Klein

Michael Klein added the comment:

I found a simpler one, like Amaury's eval(+1 * 748580):

def f(x): 
y = x+x+x+x+x
return y
print f(0)

(Except there are 74875 x+'s. This is exactly enough for a segfault, one less 
runs fine.)

I've tried something like:

 loopcount = 0
  loopcount += (1-a36)*(a37)*(1-a41)
  ...
  return loopcount

It works, but it's still pretty slow. (At least it doesn't crash.) I tried 
converting to C with Cython, but it's too big to be processed in a reasonable 
amount of time, but this is irrelevant to the bug.

--

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Probably a stack overflow, when the AST is too deep:
eval(+1 * 748580) also crashed for me

--
nosy: +amaury.forgeotdarc

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



[issue23633] Improve py launcher help, index, and doc

2015-03-11 Thread Steve Dower

Steve Dower added the comment:

NT 5 would be Vista and earlier in this case, I believe. Specifying 
%LOCALAPPDATA% should be sufficient, though %USERPROFILE% (e.g. C:\Users\Steve) 
would also be okay.

%ProgramData% is not writable by limited users, but we don't want the global 
.ini to be editable by non-admin users. That said, even admins aren't supposed 
to go editing stuff in %ProgramData%, as I understand it.

I think having alongside the EXE or in %LOCALAPPDATA% is fine.

--

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



[issue23633] Improve py launcher help, index, and doc

2015-03-11 Thread eryksun

eryksun added the comment:

 Specifying %LOCALAPPDATA% should be sufficient, though 
 %USERPROFILE% (e.g. C:\Users\Steve) would also be okay.

The command using %USERPROFILE% was for XP (NT 5.1), since the %LOCALAPPDATA% 
environment variable was added in Vista (NT 6.0).

 %ProgramData% is not writable by limited users, but we 
 don't want the global .ini to be editable by non-admin 
 users. That said, even admins aren't supposed to go 
 editing stuff in %ProgramData%, as I understand it.

C:\icacls %ProgramData%
C:\ProgramData NT AUTHORITY\SYSTEM:(OI)(CI)(F)
   BUILTIN\Administrators:(OI)(CI)(F)
   CREATOR OWNER:(OI)(CI)(IO)(F)
   BUILTIN\Users:(OI)(CI)(RX)
   BUILTIN\Users:(CI)(WD,AD,WEA,WA)

All users have the right to create files and directories here (i.e. 
(CI)(WD,AD,WEA,WA)), and by CREATOR OWNER they have full control of the files 
they create. So obviously if a system account or administrator creates the 
.ini, then non-admin users won't be able to edit it.

 I think having alongside the EXE or in %LOCALAPPDATA% is fine.

Editing an .ini in %SystemRoot% feels a bit weird, like something out of NT 4 
in the 1990s. Really it belongs in %ProgramData%, not that there's anything 
wrong with checking for it alongside the executable as well. I just think it 
wouldn't hurt to check in both locations.

--

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



[issue23633] Improve py launcher help, index, and doc

2015-03-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Good idea, but what do 'NT5' and 'NT6' correspond to in user terms -- Vista, 
Win 7, Win 8, and Win 10?

--

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



[issue23633] Improve py launcher help, index, and doc

2015-03-11 Thread eryksun

eryksun added the comment:

 Good idea, but what do 'NT5' and 'NT6' correspond to in user terms
 -- Vista, Win 7, Win 8, and Win 10?

Don't worry about NT 5 if Python's no longer supporting Windows XP in any 
fashion. Vista, Windows 7, Windows 8, Windows 8.1, and Windows 10 are 
respectively NT kernel versions 6.0, 6.1, 6.2, 6.3, and 10.0.

--

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



[issue23640] Enum.from_bytes() is broken

2015-03-11 Thread Ethan Furman

Ethan Furman added the comment:

I think the classmethod-as-constructor behavior is correct, so it's up to 
IntEnum (or EnumMeta, or foo, or ...), to work around the issue.

--

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread SilentGhost

SilentGhost added the comment:

This seems to work on linux (returning 0), but fails on 3.4 with RuntimeError: 
maximum recursion depth exceeded during compilation. I wonder if the two are 
related.

--
nosy: +SilentGhost

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



[issue23088] Document that PyUnicode_AsUTF8() returns a null-terminated string

2015-03-11 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


Added file: http://bugs.python.org/file38448/utf8-null.v3.patch

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



[issue23088] Document that PyUnicode_AsUTF8() returns a null-terminated string

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

Posting a new patch updating the documentation for some of the extra functions 
Serhiy mentioned. Also changed references of “NUL”, “nul” and “0” characters to 
“null”. I’m not very familiar with Python’s C API, so I am mainly relying on 
what you guys say without much of my own verification. But if there are other 
related doc fixes you can think of, I’m happy to include them.

The PyUnicode_AsWideCharString() function already seems to document null 
termination well enough, so I did not change it. Let me know if you had a 
specific change in mind.

--

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



[issue23638] shutil.copytree makedirs exception

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

In case it’s not clear to others, the first bit of code is from the 
shutil.copytree() implementation at Lib/shutil.py:303.

The documentation currently says “The destination directory . . . must not 
already exist”. Yuriy seems to be proposing to make copytree() use the existing 
destination directory, and only create it if it does not already exist. Perhaps 
you might be interested in Issue 20849, which proposes passing the 
os.makedirs(exist_ok=...) flag through, which would allow this functionality in 
a backwards-compatible way.

--
nosy: +vadmium

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



[issue23486] Enum member lookup is 20x slower than normal class attribute lookup

2015-03-11 Thread Larry Hastings

Larry Hastings added the comment:

Oh, I read the code.  But it's a performance hack, and the rules say we only 
accept security fixes and bug fixes at this stage of the release, and they're 
the rules for good reasons.

--

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



[issue14285] Traceback wrong on ImportError while executing a package

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

The patches at Issue 19771 should remove the part of the message that 
incorrectly says “. . . is a package and cannot be directly executed”. However 
that still leaves the problem of the suppressed traceback.

I am posting runpy-traceback.patch here which adds some tests to check if the 
traceback is suppressed. The offending test is marked @expectedFailure. It also 
points out where the exception is being incorrectly caught, but I haven’t 
thought of a nice way to fix the problem.

Other changes in the runpy-traceback.patch:

* Removed the exception message rewriting in _run_module_as_main(), because it 
seems to be redundant with the _get_main_module_details() function
* Fixed test_cmd_line_script.CmdLineTest.test_dash_m_error_code_is_one(), which 
was only checking the Python exit status, and not verifying that the specific 
failure was the one anticipated

--
keywords: +patch
Added file: http://bugs.python.org/file38438/runpy-traceback.patch

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



[issue23637] Warnings error with non-ascii chars.

2015-03-11 Thread Lukáš Němec

New submission from Lukáš Němec:

File /usr/lib/python2.7/warnings.py, line 29, in _show_warning
file.write(formatwarning(message, category, filename, lineno, line))
  File /usr/lib/python2.7/warnings.py, line 38, in formatwarning
s =  %s:%s: %s: %s\n % (filename, lineno, category.__name__, message)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 
42: ordinal not in range(128)

Only thing required to make this work is add u in front of the message so it 
is unicode. This will work for all ascii characters and all non-ascii should 
pass unicode anyway.

--
components: Library (Lib)
messages: 237850
nosy: Lukáš.Němec
priority: normal
severity: normal
status: open
title: Warnings error with non-ascii chars.
type: crash
versions: Python 2.7

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



[issue19771] runpy should check ImportError.name before wrapping it

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

Posting a new patch with the following changes:

* Added Poleto’s original tests, updated according to review comments. Combined 
the flag and source code string parameters.

* Used a different approach to guessing where the offending ImportError came 
from. Now it checks if the module got added to sys.modules, which seems to work 
in all cases I tried. It no longer does what the bug title says (check 
ImportError.name), but I think it is a better workaround or fix for the 
underlying problem.

* Removed Poleto’s “Error executing package . . .” ImportError wrapper. We 
already know what package we are trying to execute, and it hasn’t actually been 
“executed” yet, because __init__.py failed.

* Cleaned up exception name in the “Error while finding spec” message

--
Added file: http://bugs.python.org/file38437/issue_19771_runpy.patch.v3

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



[issue14285] Traceback wrong on ImportError while executing a package

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

Posting finding-spec.patch which just has another test I wrote. It tests if 
AttributeError/ValueError/TypeError gets wrapped in the “finding spec” 
ImportError, though I’m not sure if this is a bug or a feature, hence I kept it 
separate. And again I’m not sure of a good way to fix it either.

--
Added file: http://bugs.python.org/file38439/finding-spec.patch

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



[issue23486] Enum member lookup is 20x slower than normal class attribute lookup

2015-03-11 Thread Ethan Furman

Ethan Furman added the comment:

Argh, sorry -- that was supposed to be *does not* change user behavior nor the 
API, it's *just* a performance increase.

Does that change your inclination?

--

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



[issue23634] os.fdopen reopening a read-only fd on windows

2015-03-11 Thread eryksun

eryksun added the comment:

 I guess you were mainly testing with Python 2. Python 3 on Linux 
 does not raise any error either

In Python 3 os.fdopen delegates to io.open, which calls io.FileIO to create the 
raw file object. This doesn't verify a compatible mode on the file descriptor. 
Similarly, in Windows Python 2 os.fdopen calls VC++ _fdopen, which also doesn't 
verify a compatible mode. 

The POSIX spec (IEEE Std 1003.1, 2013 Edition) for fdopen says that the 
*application* shall ensure that the mode of the stream as expressed by the mode 
argument is allowed by the file access mode of the open file description to 
which fildes refers [1] (emphasis mine).  It happens that glibc in Linux opts 
to do this check for you.

If instead of closing the underlying file descriptor the program opts to close 
the Python file object or C FILE stream, this will attempt to write the 
buffered string bbb to the read-only fd, which should raise an EBADF error. 

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopen.html

---

The way test_openfd.py directly closes the underlying file descriptor does 
highlight an annoying problem in Python 2 on Windows. This should get its own 
issue in case someone feels like addressing it. The problem is open() and 
os.fdopen() create the file object with fclose as the FILE stream closer. It'd 
be nicer to instead use a closer on Windows that first calls _PyVerify_fd to 
check for a valid file descriptor. Otherwise the CRT asserts and terminates the 
process. For example:

import os
f = open('@test')
os.close(f.fileno())

Functions in posixmodule.c are good about first verifying the file descriptor:

 os.lseek(f.fileno(), 0, os.SEEK_CUR) # calls _PyVerify_fd
Traceback (most recent call last):
  File stdin, line 1, in module
OSError: [Errno 9] Bad file descriptor

OTOH, closing the file object doesn't verify the file descriptor:

 f.close() # Goodbye cruel world... :'(

Stack trace:

0:000 k 8
Child-SP  RetAddr   Call Site
`0021f3a8 `68e25200 kernel32!TerminateProcessStub
`0021f3b0 `68e252d4 MSVCR90!invoke_watson+0x11c
`0021f9a0 `68e1de7e MSVCR90!invalid_parameter+0x70
`0021f9e0 `68ddf904 MSVCR90!close+0x9e
`0021fa30 `68ddf997 MSVCR90!fclose_nolock+0x5c
`0021fa70 `1e0ac2e5 MSVCR90!fclose+0x5f
`0021fab0 `1e0ac7b2 python27!close_the_file+0xa5
`0021fae0 `1e114427 python27!file_close+0x12

The problem doesn't exist in Python 3, for which io.FileIO's internal_close 
function is gated by _PyVerify_fd.

--
nosy: +eryksun
versions: +Python 2.7

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



[issue23639] Not documented special names

2015-03-11 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here are lists of special names used in Python core and the stdlib, but absent 
in documentation index.

Module level names used in pydoc:
__author__
__credits__
__date__
__version__

Module level name used in doctest:
__test__

Other module level names:
__about__   (heapq only)
__copyright__   (many modules)
__cvsid__   (tarfile only)
__docformat__   (doctest only)
__email__   (test_with and test_keywordonlyarg only)
__libmpdec_version__(decimal only)
__status__  (logging only)


type attributes (mostly used in tests):
__abstractmethods__ (used in abc, functools)
__base__
__basicsize__
__dictoffset__
__flags__   (used in inspect, copyreg)
__itemsize__
__weakrefoffset__

super() attributes:
__self_class__
__thisclass__

Used in sqlite:
__adapt__
__conform__

Used in ctypes:
__ctype_be__
__ctype_le__
__ctypes_from_outparam__

Used in unittest:
__unittest_expecting_failure__
__unittest_skip__
__unittest_skip_why__

float methods, for testing:
__getformat__
__setformat__

Used in IDLE RPC:
__attributes__
__methods__

Others:
__alloc__   (bytearray method)
__args__(used in bdb)
__build_class__ (builtins function, used in eval loop)
__builtins__(module attribute)
__decimal_context__ (used in decimal)
__exception__   (used in pdb)
__getinitargs__ (used in pickle, datetime)
__initializing__(used in importlib)
__isabstractmethod__(function/method/descriptor attribute, used in abc, 
functools, types)
__ltrace__  (used in eval loop, never set)
__members__ (Enum attribute, used in many modules)
__mp_main__ (used in multiprocessing)
__new_member__  (Enum attribute, used in enum internally)
__newobj__  (copyreg function, used in pickle, 
object.__reduce_ex__)
__newobj_ex__   (copyreg function, used in pickle, 
object.__reduce_ex__)
__objclass__(descriptor/enum attribute, used in inspect, pydoc, 
doctest, multiprocessing)
__prepare__ (metaclass method, used in 
builtins.__build_class__, types)
__pycache__ (cache directory name)
__return__  (used in pdb)
__signature__   (used in inspect, never set)
__sizeof__  (standard method, used in sys.getsizeof)
__slotnames__   (used in object.__getstate__ for caching)
__text_signature__  (function/method/descriptor attribute, used in 
inspect)
__trunc__   (used in math.trunc, int, etc)
__warningregistry__ (used in warnings)
__weakref__ (used in weakref)
__wrapped__ (used in inspect, functools, contextlib, asyncio)

Needed a patch or a set of patches that will add theses names to the index and 
document them if they are not documented.

--
assignee: docs@python
components: Documentation
messages: 237859
nosy: docs@python, eric.araujo, ezio.melotti, georg.brandl, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Not documented special names
versions: Python 3.4, Python 3.5

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



[issue23526] Silence resource warnings in test_httplib

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

I think this one can be closed. Let me know if I was mistaken :)

--
resolution:  - fixed
status: open - closed

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



[issue23566] RFE: faulthandler.register() should support file descriptors

2015-03-11 Thread STINNER Victor

STINNER Victor added the comment:

issue23566_update.patch looks good to me, but I suggested some minor changes. 
Usually, I do such changes myself, but I proposed this issue on the Python 
menthorship list, so I prefer to do the changes to learn the process of 
reviewing patches and taking comments in account ;-)

--

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



[issue23526] Silence resource warnings in test_httplib

2015-03-11 Thread STINNER Victor

STINNER Victor added the comment:

 I think this one can be closed. Let me know if I was mistaken :)

Correct, I forgot to close it, thanks.

--

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



[issue2889] curses for windows (alternative patch)

2015-03-11 Thread Mario Figueiredo

Mario Figueiredo added the comment:

This patch is a huge improvement over the current situation, which is we don't 
have a cross-platform curses implementation in the standard library.

The alternatives listed by Mark aren't sufficient. For the two reasons given 
below:

- The implementation at http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses does 
not support unicode characters, which is a big limitation in today's general 
computing tasks.

- The UniCurses module isn't compatible with the curses standard lib 
implementation since it wraps curses/pdcurses and does not provide python own 
wrappers like the ability of addstr to accept encoded byte strings. This 
essentially makes UniCurses a 3rd-party library requirements regardless of the 
operating system, which is always nice to have but does not help the batteries 
included principles behind python standard library.

Conclusion:
Please implement this patch ASAP. It's been many years since it was made 
available. It works, it passes all tests and we all benefit if we close this 
python cross-compatibility issue.

--
nosy: +Mario Figueiredo

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



[issue23638] shutil.copytree makedirs exception

2015-03-11 Thread yuriy_levchenko

New submission from yuriy_levchenko:

We have a code:
names = os.listdir(src)
if ignore is not None:
ignored_names = ignore(src, names)
else:
ignored_names = set()

os.makedirs(dst)

errors = []

But if I had created this folder. I have exception.

Maybe add if?

if os.path.isdir(dst) is False:
os.makedirs(dst)
pass

--
components: Library (Lib)
messages: 237858
nosy: yuriy_levchenko
priority: normal
severity: normal
status: open
title: shutil.copytree makedirs exception
versions: Python 3.4

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



[issue2889] curses for windows (alternative patch)

2015-03-11 Thread Paul Moore

Paul Moore added the comment:

The patch would need updating to be applicable. Minimum changes I would expect 
to be required:

1. Update to build for Python 3.5 (the patch will *not* be included in earlier 
versions, as it is a new feature), which means it needs the Visual Studio 2015 
build files updating.
2. Rather than wholesale dumping a curses implementation into the Python source 
(which is what pdcurses.patch seems to do) the appropriate curses source should 
be fetched via the externals.bat script, like the other external dependencies.
3. Documentation. At a minimum available in Windows from Python X.Y, but 
probably also document any differences from Unix, which from the comments here 
are likely to exist if the patch uses pdcurses on Windows.
4. Tests. Again, make sure that any functionality that differs is properly 
covered on Windows, or skip specific Unix-only functionality.

That's quite a lot of changes, in practice.

Unless someone is going to step up and do all of that (and keep it maintained 
until it gets merged, which probably won't be till 3.6) *and* there's one of 
the core devs willing to support the code going forward once its committed, 
then I think closing this as won't fix and referring to the external packages 
is the best solution.

A documentation patch to https://docs.python.org/3.4/howto/curses.html (Curses 
programming with Python) which explained how to set up one of the external 
curses modules on Windows, and how to write cross-platform code that uses the 
core implementation on Unix and the 3rd party module on Windows, would be 
immensely useful for people interested in this patch. Probably far more so than 
pushing for this patch to go in, in all honesty, as it's easier to do and would 
be useful to people on older versions of Python as well.

--

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



[issue23526] Silence resource warnings in test_httplib

2015-03-11 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage: commit review - resolved

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



[issue2211] Cookie.Morsel interface needs update

2015-03-11 Thread Berker Peksag

Berker Peksag added the comment:

Serhiy already reviewed the latest patch. Just one more comment: The deprecated 
API should be documented in Doc/whatsnew/3.5.rst and 
Doc/library/http.cookies.rst.

--

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



[issue23630] support multiple hosts in create_server/start_server

2015-03-11 Thread Yann Sionneau

Yann Sionneau added the comment:

Here is a test related to Sebastien's patch.

--
nosy: +ysionneau
Added file: http://bugs.python.org/file38441/asyncio_multibind_test.diff

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



[issue23630] support multiple hosts in create_server/start_server

2015-03-11 Thread STINNER Victor

STINNER Victor added the comment:

Combine patch written for CPython tree, so we get the review button.

--
Added file: http://bugs.python.org/file38442/multibind.patch

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



[issue23640] Enum.from_bytes() is broken

2015-03-11 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Example:

 import socket
 x = socket.AddressFamily.from_bytes(b'\1', 'big')
 type(x)
enum 'AddressFamily'
 int(x)
1
 str(x)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/serhiy/py/cpython/Lib/enum.py, line 464, in __str__
return %s.%s % (self.__class__.__name__, self._name_)
AttributeError: 'AddressFamily' object has no attribute '_name_'
 repr(x)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/serhiy/py/cpython/Lib/enum.py, line 461, in __repr__
self.__class__.__name__, self._name_, self._value_)
AttributeError: 'AddressFamily' object has no attribute '_name_'

--
components: Library (Lib)
messages: 237864
nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Enum.from_bytes() is broken
type: behavior
versions: Python 3.4, Python 3.5

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



[issue23639] Not documented special names

2015-03-11 Thread Ezio Melotti

Ezio Melotti added the comment:

I think most of these are either implementation details or private names, so 
there is no need to document them.  The ones that are intended to be used by 
developers or that are useful to understand the functioning of a public API 
should be documented.  If these names are already in the documentation but not 
in the index, then an index entry should be added.

--
type:  - enhancement

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



[issue23192] Generator return value ignored in lambda function

2015-03-11 Thread Bruno Cauet

Bruno Cauet added the comment:

Here is a working test, testing yield by lambda  function as well as lambda 
and function yielding from those.

--
Added file: 
http://bugs.python.org/file38440/0001-Add-tests-for-issue-23192.patch

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



[issue23639] Not documented special names

2015-03-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
dependencies: +__sizeof__ is not documented

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



[issue23605] Use the new os.scandir() function in os.walk()

2015-03-11 Thread Ben Hoyt

Ben Hoyt added the comment:

Note specifically in the unsymlink() example Serhiy gave, you probably don't 
*want* os.walk() to recurse into a 
symlink-to-a-directory-that's-changed-to-a-directory, and you probably haven't 
thought about it doing so, so maybe the new behaviour is fine?

--

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



[issue23641] Got rid of bad dunder names

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

I’m not very familiar with the mock module so can't comment if removing div is 
sensible there. But all the other changes seem reasonable. I just left a few 
suggestions for further tweaks on Rietveld.

--
nosy: +vadmium

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



[issue23639] Not documented special names

2015-03-11 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue23605] Use the new os.scandir() function in os.walk()

2015-03-11 Thread Ben Hoyt

Ben Hoyt added the comment:

To Victor and Serhiy:

1) Serhiy's point about not needing to build the symlinks set when followlinks 
is True is a good one, because it'll never get used. Just a if not 
followlinks: ... around that try/except would do it. Though this is a small 
optimization, as I expect 95% of people use os.walk() with followlinks=False, 
which is the default.

2) Much as I don't want to admit it :-), I think Serhiy has a point regarding 
the change in behaviour. Can we accept this tiny change? This happens because 
the previous implementation of os.walk() calls path.islink(), which does a real 
syscall, after the yield returns.

So if the caller modifies dirnames and adds a symlink to a directory it won't 
be in the symlinks set. Or if (as Serhiy's example shows) they change a 
symlink-to-a-directory to a directory the new implementation doesn't do another 
syscall to check, so differs from the old one -- in Serhiy's example, the old 
os.walk() will recurse into the changed 
symlink-to-a-directory-that's-now-a-directory, whereas the new os.walk() won't 
recurse.

Arguably the new behaviour is just as good here, but it is different. And 
Serhiy's function unsymlink() is a reasonable example of how this might play 
out.

The os.walk() docs explicitly allow modifying dirnames -- not just removing 
and reordering, but also adding entries, which could surface the difference in 
behaviour: the caller can modify the dirnames list in-place ... even to inform 
walk() about directories the caller creates or renames before it resumes walk() 
again. See here:

https://docs.python.org/3.4/library/os.html#os.walk

So I do think it's a real issue. Will this really be an issue in practice? I 
don't know; I'm tempted to think not.

Obviously if we have to call stat/islink again, it defeats half of the purpose 
of scandir. But I don't see a way around it if we want to keep the exact old 
os.walk() behaviour. We could fix the behaviour if a directory/symlink was 
added to dirnames fairly easily by testing whether it changed, but I don't 
see a way to fix the unsymlinks() example without a syscall.

Thoughts?

--

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



[issue23641] Got rid of bad dunder names

2015-03-11 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch gets rid of uses and mentions of bad dunder names. I.e. names 
inherited from Python 2: __cmp__, __nonzero__, __getslice__, __unicode__, 
__div__, etc. They are replaced by correct names (__truediv__, __floordiv__, 
__eq__, __bool__, etc) or removed. Also fixed typos and other minor bugs. Also 
added support for __matmul__ and __getnewargs_ex__ in unittest.mock and added 
tests for __matmul__.

--
components: Library (Lib), Tests
files: bad_dunder_names.patch
keywords: patch
messages: 237868
nosy: ezio.melotti, michael.foord, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Got rid of bad dunder names
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file38443/bad_dunder_names.patch

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



[issue23641] Got rid of bad dunder names

2015-03-11 Thread Berker Peksag

Berker Peksag added the comment:

 Also added support for __matmul__ and __getnewargs_ex__ in unittest.mock [...]

See issue 23581 for __matmul__ support.

--
nosy: +berker.peksag

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



[issue23486] Enum member lookup is 20x slower than normal class attribute lookup

2015-03-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is not a regression (there were no enums before 3.4), slow down is not 
critical (only constant factor, not increased computational complexity), there 
is a workaround, and the code that just use constants that were converted to 
IntEnum is not affected. I'm -0 on it.

--
nosy: +serhiy.storchaka

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



[issue23486] Enum member lookup is 20x slower than normal class attribute lookup

2015-03-11 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Poor performance could fall under the category of bug fixes, so for an 
in-maintenance mode release, a fix that does not in any way change user visible 
behavior could be acceptable.  It would probably be fine for 3.4 but I'm just 
+0 on it.  Larry's call.

--

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



[issue23486] Enum member lookup is 20x slower than normal class attribute lookup

2015-03-11 Thread Ethan Furman

Ethan Furman added the comment:

In getting everything fixed up and tested I realized there was one slight 
user-facing change:  with this patch it is now possible to say:

  SomeEnum.SomeMember = SomeMember

In other words, it is possible to set a value on the class as long as it is the 
same value that already existed.

3.5 sounds good.

--
versions:  -Python 3.4

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



[issue23643] Segmentation Fault with Large Simple Function

2015-03-11 Thread Michael Klein

Changes by Michael Klein michael14...@gmail.com:


--
status: open - closed

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



[issue17295] __slots__ on PyVarObject subclass

2015-03-11 Thread Martin Panter

Martin Panter added the comment:

Encountered this when trying to add some fields to urllib.parse.SplitResult for 
Issue 22852. Issue 1173475 has a patch; I haven’t tried using it though.

--
nosy: +vadmium

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



[issue1173475] __slots__ for subclasses of variable length types

2015-03-11 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue23605] Use the new os.scandir() function in os.walk()

2015-03-11 Thread Ben Hoyt

Ben Hoyt added the comment:

@Scott Dial: just a response about this benchmark: note that this benchmark 
isn't really valid, as it says Using slower ctypes version of scandir, which 
is the slow all-Python version. You want it to be saying Using Python 3.5's 
builtin os.scandir().

--

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



[issue1553375] Add traceback.print_full_exception()

2015-03-11 Thread Mark Lawrence

Mark Lawrence added the comment:

The functionality described here certainly seems wanted and there's been some 
other work on the traceback module recently so could we get this into 3.5?

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.4

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