[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-04-04 Thread Phil Connell

Changes by Phil Connell :


--
nosy: +pconnell

___
Python tracker 

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



[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-04-04 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue17483] Can not tell urlopen not to check the hostname for https connections.

2013-04-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fc39b8f0348d by Senthil Kumaran in branch '3.3':
Issue #17483: 3.3 Branch - Remove unreachable code in urllib.request
http://hg.python.org/cpython/rev/fc39b8f0348d

--

___
Python tracker 

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



[issue14146] IDLE: source line in editor doesn't highlight when debugging

2013-04-04 Thread Todd Rovito

Todd Rovito added the comment:

I posted this message on tinter discuss email list:
http://mail.python.org/pipermail/tkinter-discuss/2013-March/003415.html

--

___
Python tracker 

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



[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-04-04 Thread INADA Naoki

Changes by INADA Naoki :


--
nosy: +naoki

___
Python tracker 

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



[issue17637] Mention "What's New" in devguide's patch guidelines

2013-04-04 Thread Brett Cannon

New submission from Brett Cannon:

http://docs.python.org/devguide/patch.html should mention that What's New 
should also be considered for updating if a change is either significant or 
requires potential modification of existing code.

--
components: Devguide
messages: 186060
nosy: brett.cannon, ezio.melotti
priority: normal
severity: normal
stage: needs patch
status: open
title: Mention "What's New" in devguide's patch guidelines

___
Python tracker 

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



[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-04-04 Thread Brett Cannon

New submission from Brett Cannon:

To help with circular imports, IMPORT_FROM should be modified to check 
sys.modules if a getattr() check fails.

http://mail.python.org/pipermail/python-dev/2013-April/125123.html

--
components: Interpreter Core
messages: 186059
nosy: brett.cannon, pje
priority: normal
severity: normal
stage: test needed
status: open
title: Modify IMPORT_FROM to fallback on sys.modules
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue15518] Provide test coverage for filecmp.dircmp.report methods.

2013-04-04 Thread Chris Calloway

Chris Calloway added the comment:

Replaced patch to fix a few under-informative test messages.

--
Added file: http://bugs.python.org/file29682/issue-15518-1.patch

___
Python tracker 

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



[issue15518] Provide test coverage for filecmp.dircmp.report methods.

2013-04-04 Thread Chris Calloway

Changes by Chris Calloway :


Removed file: http://bugs.python.org/file29681/issue-15518-1.patch

___
Python tracker 

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



[issue15518] Provide test coverage for filecmp.dircmp.report methods.

2013-04-04 Thread Chris Calloway

Chris Calloway added the comment:

OK, I got to participate in my Python user group hack night this week where I 
actually got to work on my projects instead of spending all night helping 
newbies on their projects. I used the time to refactor all the previous patches 
for this issue on which I had previously been working into the attached 
issue-15518-1.patch (replacing previous patch of the same name). I believe this 
patch a) provides the necessary minimum test coverage for the report methods, 
b) addresses chris.jerdonek's and eli.bendersky concerns, and c) does a strict 
PEP8 clean-up of the pre-existing tests (without changing pre-existing code). 
If you like this patch, I'd be glad to refactor the pre-existing tests to a) 
put each pre-existing test in its own TestCase methods and b) clean-up the 
unmaintainable proliferation of repeated hard-coded strings in the pre-existing 
tests. Feedback appreciated.

--
Added file: http://bugs.python.org/file29681/issue-15518-1.patch

___
Python tracker 

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



[issue16754] Incorrect shared library extension on linux

2013-04-04 Thread Julian Taylor

Julian Taylor added the comment:

just to clarify its not any issue in python, python is working fine with .so
The issue is just that theses variables tends to be used by other applications 
to figure out information on the system (like shared library extension, see 
numpy.distutils)
You certainly could argue that these applications are broken by even needing 
this information, but a proper naming of the variables could help reduce 
confusion and wrong code.

--

___
Python tracker 

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



[issue15518] Provide test coverage for filecmp.dircmp.report methods.

2013-04-04 Thread Chris Calloway

Changes by Chris Calloway :


Removed file: http://bugs.python.org/file26635/issue-15518-1.patch

___
Python tracker 

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



[issue16754] Incorrect shared library extension on linux

2013-04-04 Thread Julian Taylor

Julian Taylor added the comment:

I'm going by what says in configure:
# SHLIB_SUFFIX is the extension of shared libraries

The extension of shared libraries on macos is .dylib in most cases (e.g libtool 
based libraries and as mentioned python itself)

Maybe its just a documentation/naming issue.

--

___
Python tracker 

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



[issue17615] String comparison performance regression

2013-04-04 Thread Neil Hodgson

Neil Hodgson added the comment:

Looking at the assembler output from gcc 4.7 on Linux shows that it specialises 
the loop 9 times - once for each pair of kinds. This is why there was far less 
slow-down on Linux.

Explicitly writing out the 9 loops is inelegant and would make accurate 
maintenance more difficult. There may be some way to use the preprocessor to do 
this cleanly.

--

___
Python tracker 

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



[issue16754] Incorrect shared library extension on linux

2013-04-04 Thread Matthias Klose

Matthias Klose added the comment:

are you speculating, or is your comment based on some testing? MacOS had this 
value before, and apparently it did work before that change.

--

___
Python tracker 

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



[issue9253] argparse: optional subparsers

2013-04-04 Thread Sebastien Luttringer

Sebastien Luttringer added the comment:

I got the same issue that mike bayer with argparse doesn't throw error when 
subparser are missing.

Is it a bug which should be fixed in Python or in all python script? This 
sounds like an API break.

--
nosy: +seblu

___
Python tracker 

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



[issue10740] sqlite3 module should allow DDL statements in transactions

2013-04-04 Thread mike bayer

Changes by mike bayer :


--
nosy: +zzzeek

___
Python tracker 

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



[issue17365] Remove Python 2 code from test_print

2013-04-04 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Fixed.
Thanks, Berker

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue17365] Remove Python 2 code from test_print

2013-04-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 178075fbff3a by Andrew Svetlov in branch 'default':
#17365: Remove Python 2 code from test_print
http://hg.python.org/cpython/rev/178075fbff3a

--
nosy: +python-dev

___
Python tracker 

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



[issue16754] Incorrect shared library extension on linux

2013-04-04 Thread Julian Taylor

Julian Taylor added the comment:

is SHLIB_SUFFIX=".so" really correct on mac?
shared libraries have .dylib extension, loadable modules have .so (which would 
be EXT_SUFFIX?)
e.g libpython itself uses .dylib.

--
nosy: +jtaylor108

___
Python tracker 

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



[issue17365] Remove Python 2 code from test_print

2013-04-04 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the reviews. Patch updated.

Éric, since the test file is relatively small, I went ahead and made some 
cosmetic fixes, but I can open a new issue for them :)

--
Added file: http://bugs.python.org/file29680/test_print_v2.diff

___
Python tracker 

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



[issue17634] Win32: shutil.copy leaks file handles to child processes

2013-04-04 Thread R. David Murray

R. David Murray added the comment:

Unless I'm misunderstanding something, this has already been fixed in python3, 
where subprocess closes any open files (other than stdin/stdout/stderr) by 
default.  In Python2.7 (and possibly earlier, I haven't checked) you can get 
the same effect by specifying close_fds=True in the Popen call.

I don't see any reason why shutil should take any special action in this case, 
this is a general problem with open file descriptors and subprocess.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue17634] Win32: shutil.copy leaks file handles to child processes

2013-04-04 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo, hynek, sbt, tarek
versions: +Python 3.4 -Python 2.6, Python 3.1, Python 3.2

___
Python tracker 

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



[issue13966] Add disable_interspersed_args() to argparse.ArgumentParser

2013-04-04 Thread paul j3

paul j3 added the comment:

Looking further at test_argparse.py, I should say that the behavior of multiple 
positionals when there is one cluster of positional argstrings is well 
illustrated in the tests.  It's the behavior when there are multiple clusters 
(interspersed positionals) that can go against some intuitions.

--

___
Python tracker 

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



[issue17628] str==str: compare the first and last character before calling memcmp()

2013-04-04 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 04.04.2013 19:00, Eric Snow wrote:
> 
> Eric Snow added the comment:
> 
>> Marc-Andre Lemburg added the comment:
>> Same here. The heuristic may work for short strings that easily fit
>> into the CPU cache, but as soon as you use it on longer strings,
>> this will result in much slower comparisons.
> 
> When testing both, would it help to test the end of the string before the 
> beginning?  I'd expect that be more likely to leave the beginning in the 
> cache for any subsequent memcmp() call.

Again: this depends a lot on what strings you are dealing with. If
you are comparing strings that only vary in the first few characters,
testing the last character first would not be ideal :-)

Given that CPUs are optimized to read ahead in memory, it's always
better to avoid jumping around too much when accessing memory.

http://en.wikipedia.org/wiki/CPU_cache
http://en.wikipedia.org/wiki/Locality_of_reference
http://lwn.net/Articles/252125/

Ideally, you want to stay within a cache line, typically 64 bytes.

--

___
Python tracker 

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



[issue17628] str==str: compare the first and last character before calling memcmp()

2013-04-04 Thread Eric Snow

Eric Snow added the comment:

> Marc-Andre Lemburg added the comment:
> Same here. The heuristic may work for short strings that easily fit
> into the CPU cache, but as soon as you use it on longer strings,
> this will result in much slower comparisons.

When testing both, would it help to test the end of the string before the 
beginning?  I'd expect that be more likely to leave the beginning in the cache 
for any subsequent memcmp() call.

--
nosy: +eric.snow

___
Python tracker 

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



[issue17635] Doc of multiprocessing.connection mentions answerChallenge instead of answer_challenge

2013-04-04 Thread Antony Lee

New submission from Antony Lee:

The documentation for multiprocessing.connection mentions the answerChallenge 
function, but it is actually called answer_challenge in 2.6, 2.7 and 3.3 -- I 
guess it's also the case in 3.1 and 3.2 but I didn't check.

--
assignee: docs@python
components: Documentation
messages: 186043
nosy: Antony.Lee, docs@python
priority: normal
severity: normal
status: open
title: Doc of multiprocessing.connection mentions answerChallenge instead of 
answer_challenge
versions: Python 2.6, Python 2.7, Python 3.3

___
Python tracker 

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



[issue1387483] sys.path[0] when executed thru a symbolic link

2013-04-04 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

There is no "binary" here contributing to the problem.  The particular case is 
a the hadoop runtime engine which creates a "virtual" folder of your working 
directory.  We have set up a directory of .py files:

foo/
 a.py
 b.py
 c.py

The hadoop job is then to run a.py.  It is run simply as python a.py.  In this 
case, by cd-ing into the dir and running the file.  hadoop knows nothing of 
python and merely executes the given file.

Now, what this hadoop implementation does, however, is to create a virtual 
symlink image of your project directory, and duplicate this in various places, 
e.g.:

tmp1/
 a.py -> /secret/filecache/0001/a.py
 b.py -> /secret/filecache/0002/b.py
 c.py -> /secret/filecache/0003/c.py

tmp2/
 a.py -> /secret/filecache/0001/a.py
 b.py -> /secret/filecache/0002/b.py
 c.py -> /secret/filecache/0003/c.py

Notice how each file, previously together in a folder, now pyhysically resides 
in a unique place.
now, when you run a.py from either tmp1 or tmp2, it will contain
sys.path[0] == "/secret/filecache/0001"

This means that a.py can no longer import b.py.  I am unaware of a workaround 
for this issue which does not involve modifying the individual .py files 
themselves to set up a path.

Fixing this would mean that rather than to
- get the absolute path of the .py file, and extract the path from it
you would
- extract the relative path of the .py file and retrieve the absolute path for 
it.

I am not sure about what use cases could be broken by the above change, do you 
have examples?
Normal use cases of symbolic links have to do with linking entire folders, not 
individual files, and that behaviour would not be broken by  such a 
hypothetical change, I think.

--

___
Python tracker 

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



[issue17634] Win32: shutil.copy leaks file handles to child processes

2013-04-04 Thread Andrej Krpic

New submission from Andrej Krpic:

Function shutil.copy opens source file with open('rb') and destination file 
with open('wb') and then proceeds to copy the content.

If you create child process from the same python process during that time, that 
process will inherit open file handles.

This could lead to situation when parent process tries to delete the file, but 
child process prevents that by holding an open handle to the file (Windows XP, 
Windows 7).
 
This is not expected side effect for copy file operation.
Win32's native CopyFile API call doesn't leak file handles to child processes.

Python's open function behavior is defined by platform's implementation, which 
translates C function fopen with 'rb' and 'wb' modes to CRT open call without 
O_NOINHERIT flag, which creates inheritable Win32 HANDLEs.

Possible fix would be to add 'N' to mode string in calls to open function in 
shutil.copy.

--
components: Library (Lib), Windows
messages: 186041
nosy: akrpic77
priority: normal
severity: normal
status: open
title: Win32: shutil.copy leaks file handles to child processes
type: security
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue16893] Create IDLE help.txt from Doc/library/idle.rst

2013-04-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I just discovered that on Windows, the 3rd help option "Python Docs - F1" opens 
the local doc set whatever.chm in the Windows Help (HTML) Viewer. This is the 
same as the start menu choice. So on Windows, opening the same offline copy to 
the IDLE page, if possible, would be the thing to do. Perhaps the Windows code 
for opening the docs to the toc page can be reused to open them to the IDLE 
page.

--

___
Python tracker 

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



[issue1387483] sys.path[0] when executed thru a symbolic link

2013-04-04 Thread Charles-François Natali

Charles-François Natali added the comment:

> You would have expected "/home/kristjan/pydir" since this is the
> apparent directory of the file.

That's questionable.
You usually have the libraries along with the binary: that's for example the 
case when you do a CPython checkout.

Changing this to not resolve the symlink would break some use cases. An 
alternative would be to add both the original and target directory if they 
differ, hoping that there's no conflict in the modules.

--
nosy: +neologix

___
Python tracker 

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



[issue16480] pyvenv 3.3 fails to create symlinks for /local/{bin, lib} to /{bin, lib}

2013-04-04 Thread Éric Araujo

Éric Araujo added the comment:

>From Python’s viewpoint this is closed, please follow up on the Debian bug 
>tracker.

--

___
Python tracker 

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



[issue1387483] sys.path[0] when executed thru a symbolic link

2013-04-04 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

The haddoop thingie in question is called cloudera CDH4

--

___
Python tracker 

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



[issue17386] Bring Doc/make.bat as close to Doc/Makefile as possible

2013-04-04 Thread Zachary Ware

Zachary Ware added the comment:

Any comments?  Christian, I'd especially like to hear from you since it looks 
like you were the original author of Doc/make.bat (issue1472).

--

___
Python tracker 

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



[issue16893] Create IDLE help.txt from Doc/library/idle.rst

2013-04-04 Thread Zachary Ware

Zachary Ware added the comment:

Defaulting to opening a browser window sounds great to me.  In those cases 
where there is no network access, though, I think we should keep a fallback 
help.txt, and I think the Sphinx text rendering is about the simplest and 
easiest fallback we can get.  Shall we open another issue for using a browser 
for Help, and should this issue wait on that one, or can this go ahead in the 
meantime?

--

___
Python tracker 

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



[issue1387483] sys.path[0] when executed thru a symbolic link

2013-04-04 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Just came across this when running hadoop jobs
it takes your .py script folder, puts each file in its own cache folder, then 
recreates the script folder populating it with individual symlinks.
When run like this, the scripts can no longer import each other, because 
sys.path[0] is set to the "real" place of the file, rather than the place it 
was invoked from.

I just reproed this with python 2.7.3 on a new ubuntu system:

repro:
mkdir pydir
mkdir pydir/lnk
echo "import sys; print ">", sys.path[0]" >> pydir/lnk/test.py
lndir -s lnk/test.py pydir/test.py
python pydir/test.py
> /home/kristjan/pydir/lnk

You would have expected "/home/kristjan/pydir" since this is the apparent 
directory of the file.  When "pydir" contains many .py files, each residing in 
their own unique real target directories, then they cannot import each other.

--
nosy: +kristjan.jonsson
status: closed -> open
versions: +Python 2.6

___
Python tracker 

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



[issue6143] IDLE - an extension to clear the shell window

2013-04-04 Thread Roger Serwy

Roger Serwy added the comment:

In #17632, Raymond suggests adding a "Restart and Clear" menu item under the 
Shell menu.

--
nosy: +rhettinger

___
Python tracker 

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



[issue17632] IDLE: Add clear-window option to the Shell menu.

2013-04-04 Thread Roger Serwy

Roger Serwy added the comment:

This is a different spin on issue6143. Here the suggestion is to combine the 
clear function with the restart option for a new menu option.

I am closing this one as a duplicate of #6143, but adding the Shell "restart 
and clear" suggestion.

--
nosy: +roger.serwy
resolution:  -> duplicate
status: open -> closed
superseder:  -> IDLE - an extension to clear the shell window

___
Python tracker 

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



[issue1721083] Add File - Reload

2013-04-04 Thread Roger Serwy

Roger Serwy added the comment:

Raymond, I can pick this up. I might as well work on #6699 at the same time.

--

___
Python tracker 

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



[issue6699] IDLE: Warn user about overwriting a file that has a newer version on filesystem

2013-04-04 Thread Roger Serwy

Changes by Roger Serwy :


--
assignee:  -> roger.serwy

___
Python tracker 

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



[issue17633] zipimport's handling of namespace packages is incorrect

2013-04-04 Thread Eric V. Smith

Eric V. Smith added the comment:

Could you construct a test (that would fail without your patch)?

Thanks.

--

___
Python tracker 

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



[issue17633] zipimport's handling of namespace packages is incorrect

2013-04-04 Thread Eric V. Smith

Changes by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue17633] zipimport's handling of namespace packages is incorrect

2013-04-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue16480] pyvenv 3.3 fails to create symlinks for /local/{bin, lib} to /{bin, lib}

2013-04-04 Thread Marten Lehmann

Marten Lehmann added the comment:

Could you please tell me, in which exact release or commit this is resolved?

I'm using Python 3.3.0 on Ubuntu Precise and I noticed like the others, that 
e.g. easy_install and pip are installed to venv/local/bin instead of venv/bin 
and the site-packages folder being used is 
venv/local/lib/python3.3/dist-packages instead of 
venv/lib/python3.3/site-packages.

Are both issues solved in experimental? So far I only saw a symlink-patch for 
virtualenv but that doesn't actually fix the problem of being double-local 
(venv and local-folder within venv), neither dist-packages:

https://github.com/pypa/virtualenv/commit/285679cfd326c918676e765e06ed142db66efde0

--
nosy: +marten

___
Python tracker 

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



[issue17633] zipimport's handling of namespace packages is incorrect

2013-04-04 Thread Phil Connell

Changes by Phil Connell :


--
nosy: +isoschiz

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Georg Brandl

Georg Brandl added the comment:

Thanks for the confirmation!

--
status: open -> closed

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Martin Gfeller

Martin Gfeller added the comment:

Sorry for passing on my confusion, and thanks for your help!

There was indeed an old python.dll lying in one of the places Windows likes to 
put DLLs. Deleting it resolved the problem. 

Thanks again and sorry to use your valuable time. 
Best regards, Martin

--
status: pending -> open

___
Python tracker 

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



[issue14905] zipimport.c needs to support namespace packages when no 'directory' entry exists

2013-04-04 Thread Phil Connell

Phil Connell added the comment:

I've raised issue17633 to track the issue in my last message.

--

___
Python tracker 

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



[issue17633] zipimport's handling of namespace packages is incorrect

2013-04-04 Thread Phil Connell

New submission from Phil Connell:

Only one level of namespace package nesting is handled correctly:

$ unzip -l foo.zip
Archive:  foo.zip
  Length  DateTimeName
-  -- -   
0  2013-04-03 17:28   a/b/c/foo.py
0  2013-04-03 17:34   a/
0  2013-04-03 17:34   a/b/
0  2013-04-03 17:34   a/b/c/
- ---
0 4 files
$ ls
foo.zip
$ PYTHONPATH=foo.zip ~/dev/cpython/python
Python 3.4.0a0 (default:3b1dbe7a2aa0+, Apr  3 2013, 17:31:54) 
[GCC 4.8.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import a
>>> import a.b
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named 'a.b'
>>>


The problem appears to be that check_is_directory constructs the wrong 
directory path (it should be 'a/b'):

check_is_directory (self=0x76d3dc88, prefix='a/', path='a.b')
at ./Modules/zipimport.c:280
280 dirpath = PyUnicode_FromFormat("%U%U%c", prefix, path, SEP);
(gdb) n
281 if (dirpath == NULL)
(gdb) p dirpath
$11 = 'a/a.b/'


I've attached a tentative initial patch that appears to fix the issue, although 
it probably needs some more thought (and definitely some more testing - the 
existing tests still pass though).

--
components: Extension Modules
files: zipimport_ns.diff
keywords: patch
messages: 186025
nosy: brett.cannon, eric.snow, ncoghlan, pconnell
priority: normal
severity: normal
status: open
title: zipimport's handling of namespace packages is incorrect
versions: Python 3.4
Added file: http://bugs.python.org/file29679/zipimport_ns.diff

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Ezio Melotti

Ezio Melotti added the comment:

IIRC a few days ago I've seen a similar issue and the cause was that they did 
something wrong while porting the rc to Debian, but I don't remember the 
details.  If I'm not mistaken they also fixed it shortly after.

--

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Georg Brandl

Georg Brandl added the comment:

Just tested with 2.7.4rc1 32bit on Windows 7; no problem here.

I suspect your 2.7.4rc1 install picks up a python27.dll from an earlier version.

--
resolution:  -> fixed
status: open -> pending

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Georg Brandl

Georg Brandl added the comment:

And this happens when you simply start Python, not executing any code?

Can you start with "python -S", then do "import _sre", and see if it has a 
_sre.MAXREPEAT attribute?

--

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Martin Gfeller

Martin Gfeller added the comment:

@Georg, the referenced Debian issue 
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704084) already contains the 
stack.

--

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Georg Brandl

Georg Brandl added the comment:

"Python refuses to start." is not a very good description.

* What script are you running/module are you importing?
* What is the traceback/error message?

--

___
Python tracker 

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



[issue17628] str==str: compare the first and last character before calling memcmp()

2013-04-04 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 04.04.2013 11:21, STINNER Victor wrote:
> 
> STINNER Victor added the comment:
> 
> By the way, my initial concern was to merge unicode_compare_eq() and
> unicode_eq() functions.
> 
> unicode_compare_eq() only uses memcmp(), whereas unicode_eq() checks
> if the first byte is different before calling memcmp(). So the
> question is to decide which one is faster ;-)

The second one was faster a couple of years ago. Things may have
changed since then (better compilers, CPUs, etc.). Perhaps you
could run a benchmark with increasing sizes of strings, one set
with mismatches in the last character, the other with matching
strings.

--

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread STINNER Victor

STINNER Victor added the comment:

"Python refuses to start. 2.7.4.rc1 Windows 32-bit."

Oh oh. I reopen the issue and set its priority to release blocker.

--
nosy: +benjamin.peterson, georg.brandl, larry
priority: normal -> release blocker
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue17628] str==str: compare the first and last character before calling memcmp()

2013-04-04 Thread STINNER Victor

STINNER Victor added the comment:

By the way, my initial concern was to merge unicode_compare_eq() and
unicode_eq() functions.

unicode_compare_eq() only uses memcmp(), whereas unicode_eq() checks
if the first byte is different before calling memcmp(). So the
question is to decide which one is faster ;-)

--

___
Python tracker 

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



[issue17628] str==str: compare the first and last character before calling memcmp()

2013-04-04 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 04.04.2013 10:33, STINNER Victor wrote:
>>> I don't understand why the patch makes the comparaison much slower,
>>> since most time is supposed to be spend in memcmp()?
>>
>> Because reading the last character evicts useful data from the CPU cache, 
>> just before memcmp() reads it again from memory?
>>
>> In other words, I'm not convinced this is a useful heuristic.

Same here. The heuristic may work for short strings that easily fit
into the CPU cache, but as soon as you use it on longer strings,
this will result in much slower comparisons.

Whether this results in a speedup or not also depends a lot
on the domain of where you need to run comparisons, e.g. if you have
run the heuristic on Python's special method names (such as "__init__")
it won't give you any benefit. OTOH, it's easy to construct strings
that benefit a lot from it :-)

Something that typically works well in practice is to inline
the comparison of the first few characters and then call memcmp()
on the remaining ones. This avoids cache corruption and safes
a few cycles setup costs for memcmp() for short strings.

--
nosy: +lemburg

___
Python tracker 

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



[issue17625] IDLE regression -- Search and Replace Window doesn't automatically clear

2013-04-04 Thread Georg Brandl

Georg Brandl added the comment:

Done, thanks.

--

___
Python tracker 

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



[issue6743] Add function compatible with print to pprint module

2013-04-04 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

-1 from me as well. Such kind of debatable (in terms of usefulness and 
inclusion) things are usually better off being served by a custom function in 
user's code.

--

___
Python tracker 

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2013-04-04 Thread Martin Gfeller

Martin Gfeller added the comment:

I see (under Windows) the same symptoms as reported for Debian under 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704084. 

Python refuses to start. 

2.7.4.rc1 Windows 32-bit.

--
nosy: +Martin.Gfeller

___
Python tracker 

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



[issue17628] str==str: compare the first and last character before calling memcmp()

2013-04-04 Thread STINNER Victor

STINNER Victor added the comment:

> In other words, I'm not convinced this is a useful heuristic.

Me neither, but we should use the same optimization strategy for all
functions. If we don't compare first and/or last character for
str==str, we should do the same for bytes==bytes and Py_UNICODE_MATCH.

str==str performances depends on the compiler and the libc. So
performances may be very different on Windows, I will try to run the
benchmark on Windows.

GCC has also a known performance issue on memcmp. Its builtin memcmp
implementation is slower than glibc >= 2.10, especiall glibc >= 2.13.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
"GCC can't beat glibc if function call overhead is low."

2013/4/4 Antoine Pitrou :
>
> Antoine Pitrou added the comment:
>
>> I don't understand why the patch makes the comparaison much slower,
>> since most time is supposed to be spend in memcmp()?
>
> Because reading the last character evicts useful data from the CPU cache, 
> just before memcmp() reads it again from memory?
>
> In other words, I'm not convinced this is a useful heuristic.
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue17094] sys._current_frames() reports too many/wrong stack frames

2013-04-04 Thread Charles-François Natali

Charles-François Natali added the comment:

> Here is an updated patch.

_PyThreadState_DeleteExcept uses HEAD_LOCK: ISTM that
PyThreadState_Clear() can trigger arbitrary code execution: if a
thread ends up being created/destroyed, I think we can get a deadlock
when trying to acquire the head lock. I think it should be turned into
an open call if possible.

Also, as noted by Stefan, shouldn't we also iterate over other interpreters?

> Note that I think this patch could break some programs. For example, if you 
> have a thread in your main process which has a database connection open, 
> deleting the thread state in a child process might shutdown the database 
> connection (depending on the exact protocol). Therefore, I think it would be 
> better to only apply the patch in 3.4.

Indeed. For the database example, there's this other issue where the
database connection is stored in a thread-local storage... Some people
will definitely get bitten by this...

--

___
Python tracker 

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



[issue17615] String comparison performance regression

2013-04-04 Thread STINNER Victor

STINNER Victor added the comment:

"For 32-bit Windows, the code generated for unicode_compare is quite
slow. There are either 1 or 2 kind checks in each call to
PyUnicode_READ (...)"

Yes, PyUnicode_READ() *is* slow. It should not be used in a loop. And
unicode_compare() uses PyUnicode_READ() in a loop.

An improvment would be to write specialized version of each
combinaison of Unicode kinds:
(UCS1, UCS2), (UCS1, UCS4),
(UCS2, UCS1), (UCS2, UCS2), (UCS2, UCS4)
(UCS4, UCS1), (UCS4, UCS2), (UCS4, UCS4)
# (UCS1, UCS1) uses memcmp()

But I am not convinced that the gain would be visible, and I don't
know how to factorize the code. We should probably use a huge macro.

2013/4/4 Neil Hodgson :
>
> Neil Hodgson added the comment:
>
> For 32-bit Windows, the code generated for unicode_compare is quite slow.
>
> There are either 1 or 2 kind checks in each call to PyUnicode_READ and 2 
> calls to PyUnicode_READ inside the loop. A compiler may decide to move the 
> kind checks out of the loop and specialize the loop but MSVC 2010 appears to 
> not do so. The assembler (32-bit build) for each PyUnicode_READ looks like
>
> movecx, DWORD PTR _kind1$[ebp]
> cmpecx, 1
> jneSHORT $LN17@unicode_co@2
> leaecx, DWORD PTR [ebx+eax]
> movzxedx, BYTE PTR [ecx+edx]
> jmpSHORT $LN16@unicode_co@2
> $LN17@unicode_co@2:
> cmpecx, 2
> jneSHORT $LN15@unicode_co@2
> movzxedx, WORD PTR [ebx+edi]
> jmpSHORT $LN16@unicode_co@2
> $LN15@unicode_co@2:
> movedx, DWORD PTR [ebx+esi]
> $LN16@unicode_co@2:
>
>The kind1/kind2 variables aren't even going into registers and at least 
> one test+branch and a jump are executed for every character. Two tests for 2 
> and 4 byte kinds. len1 and len2 don't get to go into registers either.
>
>My system isn't set up for 64-bit MSVC 2010 but looking at the code from 
> 64-bit MSVC 2012 shows that all the variables have been moved into registers 
> but the kind checking is still inside the loop. This accounts for better 
> results with 64-bit Python 3.3 on Windows but isn't as good as Unix or Python 
> 3.2.
>
> ; 10431: c1 = PyUnicode_READ(kind1, data1, i);
>
> cmp rsi, 1
> jne SHORT $LN17@unicode_co
> lea rax, QWORD PTR [r9+rcx]
> movzx   r8d, BYTE PTR [rax+rbx]
> jmp SHORT $LN16@unicode_co
> $LN17@unicode_co:
> cmp rsi, 2
> jne SHORT $LN15@unicode_co
> movzx   r8d, WORD PTR [r9+r11]
> jmp SHORT $LN16@unicode_co
> $LN15@unicode_co:
> mov r8d, DWORD PTR [r9+r10]
> $LN16@unicode_co:
>
>Attached the 32-bit assembler listing.
>
> --
> Added file: http://bugs.python.org/file29673/unicode_compare.asm
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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