[issue24446] imap and map inconsistent behaviour

2015-06-13 Thread Ned Deily

Ned Deily added the comment:

This is a documented behavior difference in itertools.imap:

If function is set to None, then imap() returns the arguments as a tuple. Like 
map() but stops when the shortest iterable is exhausted instead of filling in 
None for shorter iterables. The reason for the difference is that infinite 
iterator arguments are typically an error for map() (because the output is 
fully evaluated) but represent a common and useful way of supplying arguments 
to imap(). 

https://docs.python.org/2/library/itertools.html#itertools.imap

--
nosy: +ned.deily
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue24447] tab indentation breaks in tokenize.untokenize

2015-06-13 Thread Dingyuan Wang

New submission from Dingyuan Wang:

If a script uses tabs for indentation, tokenize.untokenize won't restore 
original indentation correctly from the second line of the indentation level, 
and thus breaks the file.

This affects all Python versions.

Test code:

python2 -c 'import sys, tokenize; 
sys.stdout.write(tokenize.untokenize(tokenize.generate_tokens(sys.stdin.readline)))'
  tab.py

python3 -c 'import sys, tokenize; 
sys.stdout.buffer.write(tokenize.untokenize(tokenize.tokenize(sys.stdin.buffer.readline)))'
  tab.py

Out:

def foo():
pass
 pass
 if 1:
pass
  pass

--
components: Library (Lib)
files: tab.py
messages: 245333
nosy: gumblex
priority: normal
severity: normal
status: open
title: tab indentation breaks in tokenize.untokenize
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file39704/tab.py

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



[issue24446] imap and map inconsistent behaviour

2015-06-13 Thread Ned Deily

Ned Deily added the comment:

Also note that the behavior of map() in Python 3 has been changed to also stop 
with the termination of the shortest iterator.

https://docs.python.org/3.4/whatsnew/3.0.html#views-and-iterators-instead-of-lists

--

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



[issue24303] OSError 17 due to _multiprocessing/semaphore.c assuming a one-to-one Pid - process mapping.

2015-06-13 Thread Charles-François Natali

Changes by Charles-François Natali cf.nat...@gmail.com:


--
keywords: +needs review
nosy: +haypo

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



[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread o1da

o1da added the comment:

Ok, thank you. I thought it trims whole sequence or nothing.

--
status: open - closed

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



[issue24426] re.split performance degraded significantly by capturing group

2015-06-13 Thread Patrick Maupin

Patrick Maupin added the comment:

 (stuff about cPython)

No, I was curious about whether somebody maintained pure-Python fixes (e.g. to 
the re parser and compiler).  Those could be in a regular package that fixed 
some corner cases such as the capture group you just applied a patch for.

 ... regex is more powerful and better supports Unicode.

Unfortunately, it is still not competitive.  For example, for one package I 
maintain (github.com/pmaupin/pdfrw), I have one unittest which reads in and 
parses several PDF files, and then outputs them to new PDF files:

Python 2.7 with re -- 5.9 s
Python 2.7 with regex -- 6.9 s
Python 3.4 with re -- 7.2 s
Python 3.4 with regex -- 8.2 s

A large reason for the difference between 2.7 and 3.4 is the fact that I'm too 
lazy, or it seems too error-prone, to put the b'xxx' in front of every string, 
so the package uses the same source code for 2.7 and 3.4, which means unicode 
strings for 3.4 and byte strings for 2.7.

Nonetheless, when you consider all the other work going on in the package, a 
14% _overall_ slowdown to change to a better re package seems like going the 
wrong direction, especially when stacked on top of the 22% slowdown for 
switching to Python3.

 Do you mean documenting codes of compiled re pattern?

Yes.


 This is implementation detail and will be changed in future.

Understood, and that's fine.  If the documentation existed, it would have 
helped if I want to create a pure-python package that simply performed 
optimizations (like the one in your patch) against existing Python 
implementations, for use until regex (which is a HUGE undertaking) is ready.

Thanks,
Pat

--

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



[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread Patrick Maupin

Patrick Maupin added the comment:

Example

 text = 'test1/1.jp2'
 text.rstrip('.2jp')
'test1/1'

--

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



[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread Patrick Maupin

Patrick Maupin added the comment:

I think you misunderstand rstrip -- it works from the right, and checks to see 
if the right-most character is in the string you have given it.  As long as it 
is, then it will remove the character and loop

--
nosy: +Patrick Maupin

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



[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread o1da

New submission from o1da:

Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type help, copyright, credits or license for more information.
 text = 'test1/1.jp2'
 text.rstrip('.jp2')
'test1/1'
 text = 'test1.jp2'
 text.rstrip('.jp2')
'test1'
 text = 'test1/2.jp2'
 text.rstrip('.jp2')
'test1/'
 

Why the rstrip function stripped '2' from the last example? I think that it is 
a bug.

--
messages: 245311
nosy: o1da
priority: normal
severity: normal
status: open
title: rstrip strips what it doesn't have to
versions: Python 2.7

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



[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread Martin Panter

Martin Panter added the comment:

The 3.5 documentation of str.strip() was recently modified in Issue 24204 due 
to this kind of misunderstanding. Perhaps other versions should be modified as 
well, or the str.l/rstrip() methods, or the bytes() and bytearray() methods. 
See also Issue 23560 proposing to group the documentation of these methods 
together.

--
nosy: +vadmium

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



[issue795081] email.Message param parsing problem II

2015-06-13 Thread R. David Murray

R. David Murray added the comment:

It think the thing to do is to turn it into a test case for both the old and 
the new parser, and the decide what we want the behavior to be.

--

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



[issue24412] setUpClass equivalent for addCleanup

2015-06-13 Thread R. David Murray

R. David Murray added the comment:

Not having addClassCleanup means that my setUpClass method will have four 
try/excepts in it, as will my tearDownClass (I have four fixtures I'm setting 
up for the tests).

So, no, it isn't strictly needed, but it is prettier :).  As Robert says, 
though, it makes for a nice symmetry in the API.  Basically, I like to see 
tearDown deprecated, as I find the setup/addcleanup pattern much easier to 
write and, more importantly, to read.

--

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



[issue24412] setUpClass equivalent for addCleanup

2015-06-13 Thread Tal Einat

Tal Einat added the comment:

Is this really needed? One can use try/except/raise, and since 
addClassCleanup() would only be called from setUpClass(), I don't quite see the 
utility of it.

--
nosy: +taleinat

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



[issue24421] Race condition compiling Modules/_math.c

2015-06-13 Thread Tal Einat

Tal Einat added the comment:

Confirmed on OSX 10.10. Here's my output:

running build
running build_ext
building 'cmath' extension
./slow-cc.py -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g 
-fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement 
-I./Include -I. -IInclude -I/usr/local/include 
-I/Users/taleinat/dev/cpython/Include -I/Users/taleinat/dev/cpython -c 
/Users/taleinat/dev/cpython/Modules/cmathmodule.c -o 
build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/cmathmodule.o
building 'math' extension
./slow-cc.py -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g 
-fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement 
-I./Include -I. -IInclude -I/usr/local/include 
-I/Users/taleinat/dev/cpython/Include -I/Users/taleinat/dev/cpython -c 
/Users/taleinat/dev/cpython/Modules/mathmodule.c -o 
build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/mathmodule.o
./slow-cc.py -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g 
-fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement 
-I./Include -I. -IInclude -I/usr/local/include 
-I/Users/taleinat/dev/cpython/Include -I/Users/taleinat/dev/cpython -c 
/Users/taleinat/dev/cpython/Modules/_math.c -o 
build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/_math.o
./slow-cc.py -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g 
-fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement 
-I./Include -I. -IInclude -I/usr/local/include 
-I/Users/taleinat/dev/cpython/Include -I/Users/taleinat/dev/cpython -c 
/Users/taleinat/dev/cpython/Modules/_math.c -o 
build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/_math.o
INITIAL COMPILE
RECOMPILE
RECOMPIILE TRUNCATING
INITIAL COMPILE FINISHED
./slow-cc.py -bundle -undefined dynamic_lookup 
build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/mathmodule.o
 build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/_math.o 
-L/usr/local/lib -o build/lib.macosx-10.10-x86_64-3.6/math.cpython-36m-darwin.so
ld: file too small (length=0) file 
'build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/_math.o' 
for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
RECOMPILE FINISHED
./slow-cc.py -bundle -undefined dynamic_lookup 
build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/cmathmodule.o
 build/temp.macosx-10.10-x86_64-3.6/Users/taleinat/dev/cpython/Modules/_math.o 
-L/usr/local/lib -o 
build/lib.macosx-10.10-x86_64-3.6/cmath.cpython-36m-darwin.so

--
nosy: +taleinat

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



[issue24412] setUpClass equivalent for addCleanup

2015-06-13 Thread Tal Einat

Tal Einat added the comment:

I'm not convinced this would be worth the effort required to implement and 
maintain it.

Can someone find examples from existing test suites where this would clearly be 
useful? For example, a setUpClass() or setUpModule() function with multiple 
try/finally clauses.

--

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



[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-13 Thread Nick Coghlan

Nick Coghlan added the comment:

Regarding the idea of doing a typedef for the new coro type at the C level: 
looking further at the way the new type integrates with the eval loop, it's 
essential that they actually retain the exact same memory layout if we don't 
want to rewrite a whole lot of code.

I still like the idea of adding the typedef so we can at least make the 
distinction in cases where the C level handling *isn't* shared between the two 
types, it would just need a great big disclaimer saying that the memory layout 
of the coroutine struct can't be altered independently of the generator layout.

--

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



[issue24403] Missing fixer for changed round() behavior

2015-06-13 Thread Tal Einat

Tal Einat added the comment:

See the existing issue and discussion about this on the six library's issue 
tracker (opened nearly a year ago):

https://bitbucket.org/gutworth/six/issue/94/introduce-sixround

--
nosy: +taleinat

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



[issue24412] setUpClass equivalent for addCleanup

2015-06-13 Thread Robert Collins

Robert Collins added the comment:

It would be nice for symmetry. I mean, setUpClass isn't needed either, and we 
have it ;).

however, we actually have two contexts this would be called from - setUpClass 
and setUpModule; both share their internals. So we probably need a decoupled 
cleanups implementation, and two new binding points to it.

--

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



[issue24412] setUpClass equivalent for addCleanup

2015-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

addCleanup() is helpful because it can be used in test methods. 
addClassCleanup() and addModuleCleanup() can't be used in test methods, and 
setUpClass() and setUpModule() are used less than setUp(), therefore the 
benefit of these methods are less than of addCleanup().

--
nosy: +serhiy.storchaka

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



[issue24435] Grammar/Grammar points to outdated guide

2015-06-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4ba334ed3bb7 by Berker Peksag in branch '3.4':
Issue #24435: Use the devguide link instead of PEP 306 in Grammar/Grammar.
https://hg.python.org/cpython/rev/4ba334ed3bb7

New changeset 1622bc1af766 by Berker Peksag in branch '3.5':
Issue #24435: Use the devguide link instead of PEP 306 in Grammar/Grammar.
https://hg.python.org/cpython/rev/1622bc1af766

New changeset a9c34db88d79 by Berker Peksag in branch 'default':
Issue #24435: Use the devguide link instead of PEP 306 in Grammar/Grammar.
https://hg.python.org/cpython/rev/a9c34db88d79

--
nosy: +python-dev

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



[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-13 Thread Stefan Behnel

Stefan Behnel added the comment:

I agree that a typedef is a good idea. It doesn't cost anything but gives
us more freedom for future changes.

--

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



[issue795081] email.Message param parsing problem II

2015-06-13 Thread Milan Oberkirch

Milan Oberkirch added the comment:

Is this still relevant? I just made a patch based on the suggestions discussed 
and it does not change the behavior of the original bug report (but fixed the 
bug regarding '' mentioned by tony_nelson). Maybe I'm missing something?

--
keywords: +patch
nosy: +zvyn
Added file: http://bugs.python.org/file39701/issue795081.patch

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



[issue24443] Link for clear and wait missing in EventObjects

2015-06-13 Thread Jaivish Kothari

New submission from Jaivish Kothari:

https://docs.python.org/2/library/threading.html#threading.Event.set

links missing for wait and clear .
set() is linked though.

Line: 

An event object manages an internal flag that can be set to true with the set() 
method and reset to false with the clear() method. The wait() method blocks 
until the flag is true.



--
assignee: docs@python
components: Documentation
files: Fix_link.patch
keywords: patch
messages: 245294
nosy: berker.peksag, docs@python, georg.brandl, janonymous, janonymous, 
tim.golden, willingc
priority: normal
severity: normal
status: open
title: Link for clear and wait missing in EventObjects
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file39702/Fix_link.patch

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



[issue24443] Link for clear and wait missing in EventObjects

2015-06-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a985b6455fde by Berker Peksag in branch '2.7':
Issue #24443: Fix links for Event.clear() and Event.wait() methods.
https://hg.python.org/cpython/rev/a985b6455fde

--
nosy: +python-dev

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



[issue24444] In argparse empty choices cannot be printed in the help

2015-06-13 Thread py.user

New submission from py.user:

 import argparse
 
 parser = argparse.ArgumentParser()
 _ = parser.add_argument('foo', choices=[], help='%(choices)s')
 parser.print_help()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py, 
line 2358, in print_help
self._print_message(self.format_help(), file)
  File /home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py, 
line 2342, in format_help
return formatter.format_help()
  File /home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py, 
line 278, in format_help
help = self._root_section.format_help()
  File /home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py, 
line 208, in format_help
func(*args)
  File /home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py, 
line 208, in format_help
func(*args)
  File /home/guest/tmp/tests/misc/git/example/cpython/main/Lib/argparse.py, 
line 517, in _format_action
parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
IndexError: list index out of range


It's not very useful to print empty choices, but the choices list could be 
formed dynamically. So the command-line user can't figure out what's happen.

--
components: Library (Lib)
messages: 245297
nosy: py.user
priority: normal
severity: normal
status: open
title: In argparse empty choices cannot be printed in the help
type: behavior
versions: Python 3.6

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



[issue24435] Grammar/Grammar points to outdated guide

2015-06-13 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report, Chris.

--
nosy: +berker.peksag
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue24429] msvcrt error when embedded

2015-06-13 Thread Steve Dower

Steve Dower added the comment:

About the only possible solution here would be to special case ctypes to detect 
msvcr90 as a parameter (later versions of the CRT don't need it) and also 
whether another activation context already exists. We could also document the 
need for a complete manifest in the embedding docs. All of this really only 
affects 2.7, as later versions of Python don't necessarily suffer the same 
limitation (unless someone wants to load msvcr90 explicitly).

What functionality do you need that you can't get some other way (such as the 
msvcrt module)? Or is it just the uuid issue?

--

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



[issue23992] multiprocessing: MapResult shouldn't fail fast upon exception

2015-06-13 Thread Charles-François Natali

Changes by Charles-François Natali cf.nat...@gmail.com:


--
keywords: +needs review
nosy: +haypo

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



[issue24127] Fatal error in launcher: Job information querying failed

2015-06-13 Thread Henrik Heimbuerger

Henrik Heimbuerger added the comment:

I can still reproduce this on the just released Windows 10 build 10130, after 
python -m pip uninstall pip and then python get-pip.py (which recreated the 
pip.exe binary for pip 7.0.3).

Is there anything else I need to do to make this work now?

--

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



[issue24426] re.split performance degraded significantly by capturing group

2015-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a reason to file a feature request to regex. In 3.3 re was slower than 
regex in some cases:

$ ./python -m timeit -s import re; p = re.compile('\n\r'); s = ('a'*100 + 
'\n\r')*1000 -- p.split(s)
Python 3.3 re   : 1000 loops, best of 3: 952 usec per loop
Python 3.4 regex: 1000 loops, best of 3: 757 usec per loop
Python 3.4 re   : 1000 loops, best of 3: 323 usec per loop

And this optimization (issue18685 or others) can be applied to regex.

As for this particular issue, the optimization of splitting with 1-character 
capturing group needs changes to C part of re engine. Python part of my patch 
is not needed for this, it is here only for generalizing support of other 
corner cases. So this issue can't be fixed with patching only Python code.

--

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



[issue24443] Link for clear and wait missing in EventObjects

2015-06-13 Thread Jaivish Kothari

Jaivish Kothari added the comment:

My Pleasure sir :)

--

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



[issue23275] Can assign [] = (), but not () = []

2015-06-13 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the reviews. Here is an updated patch.

--
Added file: http://bugs.python.org/file39703/issue23275_v2.diff

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



[issue24426] re.split performance degraded significantly by capturing group

2015-06-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 1) Do you know if anybody maintains a patched version of the Python code 
 anywhere?  I could put a package up on github/PyPI, if not.

Sorry, perhaps I misunderstood you. There are unofficial mirrors of CPython on 
Bitbucket [1] and GitHub [2]. They don't contain unofficial patches, but 
perhaps there are private clones with additional patches. Of course different 
Linux distributives can provide Python with own patches. And you can maintain 
private fork of CPython with your patches for your own or your company needs.

But if you needs only optimized regular expressions, I suggest you to look on 
the regex module [3]. It is more powerful and better supports Unicode.

Results of the same mickrobenchmarks for regex:

$ ./python -m timeit -s import regex as re; p = re.compile('\n'); s = ('a'*100 
+ '\n')*1000 -- p.split(s)
1000 loops, best of 3: 544 usec per loop
$ ./python -m timeit -s import regex as re; p = re.compile('(\n)'); s = 
('a'*100 + '\n')*1000 -- p.split(s)
1000 loops, best of 3: 661 usec per loop
$ ./python -m timeit -s import regex as re; p = re.compile('\n\r'); s = 
('a'*100 + '\n\r')*1000 -- p.split(s)
1000 loops, best of 3: 521 usec per loop
$ ./python -m timeit -s import regex as re; p = re.compile('(\n\r)'); s = 
('a'*100 + '\n\r')*1000 -- p.split(s)
1000 loops, best of 3: 743 usec per loop

regex is slightly slower than optimized re in these cases, but is much faster 
than non-optimized re in the case of splitting with capturing group.

 2) Do you know if anybody has done a good writeup on the behavior of the 
 instruction stream to the C engine?  I could try to do some work on this and 
 put it with the package, if not, or point to it if so.

Sorry, I don't understood you. Do you mean documenting codes of compiled re 
pattern? This is implementation detail and will be changed in future.

[1] https://bitbucket.org/mirror/cpython
[2] https://github.com/python/cpython
[3] https://pypi.python.org/pypi/regex

--

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



[issue24412] setUpClass equivalent for addCleanup

2015-06-13 Thread Tal Einat

Tal Einat added the comment:

Ahh, that makes sense. Sounds good to me!

--

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



[issue24429] msvcrt error when embedded

2015-06-13 Thread Steve Dower

Steve Dower added the comment:

 i'm not following why it's a special case, or why later versions wouldn't 
 have the same problem?

The Microsoft C Runtime 9.0 required an activation context to allow multiple 
versions to load side by side. This turned out to be more trouble than it was 
worth, and so version 10.0 removed that requirement.

 isn't this a problem for any DLLs that the embedding context may have loaded 
 that would conflict with DLLs that python depends on?

For any DLL that requires a version specification in the current activation 
context, yes. These are fairly rare, but if the DLL checks, then the context 
needs to be created for it. (MSVCRT 9.0 requires it and checks - hence the 
error when it isn't set up.)

 python's DLL already has the necessary complete manifest, right?

In theory yes, but apparently it isn't working in this case. It needs more 
investigation to figure out why.

 what is the purpose of ctypes.cdll.msvcrt if no one is supposed to use it?

ctypes.cdll.msvcrt doesn't really exist - ctypes.cdll turns it into a 
LoadLibrary(msvcrt) call that works because Windows keeps shipping msvcrt.dll 
for backwards compatibility (for applications that rely on msvcrt.dll entirely 
- not piecemeal).

 there is also import msvcrt which is apparently a subset of what you get 
 from find_library('c'), so would need the same fix?

No, because this module is built into Python's DLL (and does properly 
conversion from Python types to C types, which occasionally differ from the 
ctypes conversions). If you've been able to load Python, these functions will 
be fine.

 what changed that avoids the problem?  perhaps that fix can be applied to 2.7?

Python 3.0-3.2 are also affected, but Python 3.3 and later use newer versions 
of the CRT that do not have the manifest requirement. It's been discussed in 
the past and has been decided that the official builds of Python will not 
change compiler version without a version bump (in this case, 2.7-2.8 would be 
required, but has been ruled out).

 innocent ol' me was just trying to import shapely from matlab - they call 
 find_library('c') and need the 'free' function.  i don't think they ever 
 malloc -- they depend on a geos_c.dll, which must do the allocations and is 
 built on whatever msvcrt was used for python?  probably a better design would 
 be for geos_c.dll to export its own free function?  but afaiu, geos_c.dll 
 comes from a totally different (more legacy?) project, not python related... 

Yeah, geos_c.dll really should have exported its own free() function. 
find_library('c') is probably the wrong approach here - if geos_c.dll is being 
rebuilt with different CRTs at all then the free() function should be added to 
it, and if it's truly legacy and is no longer being rebuilt then the version of 
the CRT it uses should be loaded explicitly. It isn't automatically getting the 
same version as whatever version of Python is running, that's for sure.

 uuid is the only case i can find in the standard libraries that also calls 
 find_library('c').

As I said earlier, I'm sure we'd accept a patch to uuid.py to avoid that call 
on Windows (or completely remove it - I was sure at one point that ctypes was 
considered off-limits for the stdlib). Everything ought to be going through 
import msvcrt or their own extension modules, and it sounds like they mostly 
are.

--

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