[issue7946] Convoy effect with I/O bound threads and New GIL

2010-04-30 Thread Nir Aides

Nir Aides  added the comment:

Dave, 

The behavior of your patch on Windows XP/2003 (and earlier) might be related to 
the way Windows boosts thread priority when it is signaled. 

Try to increase priority of monitor thread and slice size. Another thing to 
look at is how to prevent Python CPU bound threads from (starving) messing up 
scheduling of threads of other processes. Maybe increasing slice significantly 
can help in this too (50ms++ ?).

XP/NT/CE scheduling and thread boosting affect all patches and the current GIL 
undesirably (in different ways). Maybe it is possible to make your patch work 
nicely on these systems:
http://www.sriramkrishnan.com/blog/2006/08/tale-of-two-schedulers-win_115489794858863433.html

Vista and Windows 7 involve CPU cycle counting which results in more sensible 
scheduling:
http://technet.microsoft.com/en-us/magazine/2007.02.vistakernel.aspx

--

___
Python tracker 

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Paul Moore

New submission from Paul Moore :

test_support.find_unused_port attempts to find an unused port to use. The 
approach is fragile (as noted in the docstring) in certain cases. In 
particular, it appears that Windows takes a short time to free the socket after 
it is closed, meaning that when the caller tries to open a socket on the 
returned port number, it gets permission issues.

A sleep(0.1) just before returning the port number appears to address the 
issue, but this is not a proper solution.

http://msdn.microsoft.com/en-us/library/ms737582%28v=VS.85%29.aspx describes 
the SO_LINGER and SO_DONTLINGER socket options, which may be related, but in my 
initial tests I haven't been able to get these to work.

--
components: Tests, Windows
keywords: buildbot
messages: 104614
nosy: pmoore
priority: normal
severity: normal
status: open
title: test_support.find_unused_port can cause socket conflicts on Windows

___
Python tracker 

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Paul Moore

Changes by Paul Moore :


--
nosy: +pitrou

___
Python tracker 

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +brian.curtin, exarkun, tim.golden
type:  -> behavior
versions: +Python 2.6, Python 2.7, 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



[issue7584] datetime.rfcformat() for Date and Time on the Internet

2010-04-30 Thread anatoly techtonik

anatoly techtonik  added the comment:

The point is that your implementation doesn't allow people to generate 
'Z'-ending timestamp if they need a subset of rfc3339.

--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Ronald Oussoren

New submission from Ronald Oussoren :

When I build the trunk with srcdir != builddir test_distutils fails when 
running tests.

To reproduce:
* Create a checkout of the trunk and chdir into this
* mkdir build
* cd build
* ../configure
* make test

This results in a failure for test_distutils

--
assignee: tarek
components: Distutils, Library (Lib)
messages: 104616
nosy: ronaldoussoren, tarek
priority: normal
severity: normal
stage: needs patch
status: open
title: test_distutils fails if srcdir != builddir
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue4180] warnings.simplefilter("always") does not make warnings always show up

2010-04-30 Thread Tres Seaver

Tres Seaver  added the comment:

This patch tidies up the FilterWarnings tests to nomalize use of 
'self.assertEquals' (matching the rest of the module) and make the 
'test_always' assertions meaningful.

--
Added file: http://bugs.python.org/file17144/issue4180-test_janitorial.diff

___
Python tracker 

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



[issue4180] warnings.simplefilter("always") does not make warnings always show up

2010-04-30 Thread Tres Seaver

Tres Seaver  added the comment:

This patch adds tests for the 'error', 'ignore', and 'always' filters being 
applied *after* the default warning has been issued, and therefore the registry 
populated.  It causes failures for the 'error' and 'always' on both the Python 
and C sides.

--
Added file: 
http://bugs.python.org/file17145/issue4180-test_filter_after_default.diff

___
Python tracker 

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



[issue4180] warnings.simplefilter("always") does not make warnings always show up

2010-04-30 Thread Tres Seaver

Tres Seaver  added the comment:

This patch replaces my earlier 'py_warnings' patch.  It revamps the Python side 
to check filters before deciding not to emit the warning based on the registry. 
 The new "_after_default" tests pass on the Python side with this patch.

--
Added file: http://bugs.python.org/file17146/issue4180-py_warnings2.diff

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

distutils.sysconfig.get_python_inc() uses  
"os.path.dirname(os.path.abspath(sys.executable))" to find the srcdir.

I'll change it to "sysconfig.get_config_var('srcdir')"

--

___
Python tracker 

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



[issue3646] MacOS X framework install to non-standard directory fails

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

In r80647 (trunk) you can use "configure 
--enable-framework=$HOME/Library/Frameworks" to get the right situation:

- Framework in ~/Library/Frameworks
- Apps in ~/Applications/Python 2.7
- Command-line tools in ~/bin

I will port this to 3.2 later on, but won't backport to 2.6 and 3.1.

--
resolution:  -> fixed
versions: +Python 2.7, Python 3.2 -Python 2.4, Python 2.5, Python 2.6

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Mmm, the problem is that srcdir is given by the Makefile. So I need to find the 
Makefile. I don't know how to get these info from a python built in another 
directory. Investigating...

--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

get_config_var('srcdir') should work, with should then be combined with the 
path to the Makefile, something like:

os.path.join(
   os.path.dirname(os.path.abspath(
  _get_makefile_filename(), get_config_var('srcdir')))

The path.join is necessary because srcdir is most likely a relative path (in my 
example the value is 'srcdir')

--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

This won't work because in the build dir, srcdir is set to ".." in the Makefile 
located in the buildir, and the tests are run into a subdir : 
/build/test_python_xxx, so you can't rely on a relative path.


For this to work we would need an absolute path for "srcdir" in the Makefile.

We need to find a way to locate the srcdir with an aboslute path.

--

___
Python tracker 

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



[issue3646] MacOS X framework install to non-standard directory fails

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Als committed this for 3.2: r80648.

--
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Ah, found a way:

buildir = os.path.dirname(sys.executable)
srcdir = os.path.abspath(os.path.join(buildir, get_config_var('srcdir')))

--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Changes by Tarek Ziadé :


--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

It does work just fine, see the attached patch.

--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Actually attaching the patch might help.

With this patch test_distutils passes, without it it doesn't.

--
keywords: +patch
Added file: http://bugs.python.org/file17147/issue8577.patch

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Yes it's pretty similar to what I've done in my earlier message.

No need to call os.path.dirname(get_makefile_filename()),
os.path.dirname(sys.executable) is enough.

I guess the patch part concerning unixcompiler is unrelated to this issue, 
right ?

--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Yes, sorry about that. The patch in unixcompiler is for issue #7724.

--

___
Python tracker 

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



[issue7584] datetime.rfcformat() for Date and Time on the Internet

2010-04-30 Thread Daniel Urban

Daniel Urban  added the comment:

> The point is that your implementation doesn't allow people to generate
> 'Z'-ending timestamp if they need a subset of rfc3339.

That is exactly right. Do you have any suggestion, how to do that? Maybe an 
optional argument to the rfcformat method? Something like:

def new_rfcformat(self, default_utcoffset='-00:00'):
if we_know_the_utc_offset:
return self.rfcformat() # the method in my current patch
else:
return self.isoformat() + default_utcoffset

This way, if somebody want 'Z' instead of '-00:00', just calls the method like 
this:

d.new_rfcformat('Z')

Though this way '+00:00' wouldn't get replaced by 'Z'. 
Any suggestions?

--

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Changes by Tarek Ziadé :


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



[issue8540] Make Context._clamp public in decimal module

2010-04-30 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Fixed in r80649, r80650 

I'll merge in the py3k branch once I've reverted distutils there

--

___
Python tracker 

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



[issue1641] asyncore delayed calls feature

2010-04-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I agree with the points raised against Josiah's patch. I'm not sure O(n) 
cancellation is really a concern. The main focus of optimization should be the 
scheduler's loop itself, and both approaches have an O(log n) complexity there 
AFAICT. Also, the cancellation optimization could be backported into 
Giampaolo's patch.

One area tests should check for is when scheduling operations are done from a 
delayed call. Especially, a delayed call rescheduling itself.

By the way, it's too late for 2.7, so this is only for 3.2 now.

--
stage:  -> patch review
versions: +Python 3.2 -Python 2.7, Python 3.1

___
Python tracker 

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



[issue8578] PyWeakref_GetObject

2010-04-30 Thread Armin Rigo

New submission from Armin Rigo :

PyWeakref_GetObject(wref) returns a borrowed reference, but that's rather 
dangerous.  The fact that wref stays alive does not prevent the returned object 
from being collected (by definition -- wref is a weak reference).  That means 
that either we must explicitly and immediately do a Py_INCREF() (and later 
Py_DECREF()) on the result of the function, or we must use it for a very short 
time.

As an example of why this interface encourages buggy behavior, the sole user of 
PyWeakref_GetObject() in Module/* is Module/_sqlite/connection.c, which does

statement = PyWeakref_GetObject(weakref);

and then call some functions passing 'statement' as argument.  The called 
functions can do anything (because they release the GIL).  So in particular 
they can cause 'statement' to be freed while still in use, either directly or 
indirectly via the cycle-GC.

This should be fixed; I suggest deprecating PyWeakref_GetObject() and adding 
another C API function that does not return a borrowed reference.

--
components: Interpreter Core
messages: 104634
nosy: arigo
priority: normal
severity: normal
status: open
title: PyWeakref_GetObject
type: crash

___
Python tracker 

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



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
> Le lundi 26 avril 2010 13:06:48, vous avez écrit :
>> I don't see what environment variables have to do with the file
>> system.
> 
> A POSIX system only offers *one* function about the encoding: 
> nl_langinfo(CODESET) and Python3 uses it for the filenames, environment 
> variables and the command line arguments.
> 
> Are you suggesting that Python3 should support a encoding different for 
> environment variables and the file system? How would the user configure it?

It's better to let the application decide how to solve this problem
and in order to allow for this, the encodings must be adjustable.

By using fsencode() and fsdecode() in stdlib functions, you basically
prevent this kind of adjustment, since they hardcode the use of
a single encoding which is guessed by looking at nl_langinfo(CODESET).

Note that application may well use completely different encodings
in the environment and for things like pipes than what the user
setup for her GUI environment.

In the end, this will only lead to the same kind of mess we've
had with sys.setdefaultencoding() in Python 2.x, only this
time with sys.setfilesystemencoding() and I'd like to avoid that.

> Since Python3 choosed to store environment variables as unicode string on 
> Windows and POSIX, in this specific case you should reconvert the value to 
> byte strings using fsencode() and then manipulate byte strings. Because 
> Python3 uses surrogateescape, you will get the original byte string values.

Well, yes, but that's a cludge isn't it ?

If you know that e.g. your environment variables are going to have
Latin-1 data (say some content-type variable has this information),
but the user's default LANG setting is UTF-8, Python will fetch the
data as broken Unicode data, you then have to convert it back to bytes
and then back to Unicode using the correct Latin-1 encoding.

It would be a lot better to have the application provide the
encoding to the os.getenv() function and have Python do the
correct decoding right from the start.

--

___
Python tracker 

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



[issue1285086] urllib.quote is too slow

2010-04-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Tres, can you update your patch against SVN trunk?
Also, please do an unified diff, we are mostly used to this format.

--
stage: unit test needed -> patch review
versions: +Python 2.7, Python 3.2

___
Python tracker 

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



[issue8578] PyWeakref_GetObject

2010-04-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> This should be fixed; I suggest deprecating PyWeakref_GetObject() and
> adding another C API function that does not return a borrowed reference.

Another possibility is to document the fact that Py_INCREF() should be called 
in most cases. It would be much lighter than a new API + deprecation process.

In the meantime, the sqlite issue should be fixed of course.

--
components: +Library (Lib)
nosy: +ghaering, haypo, loewis, pitrou
priority: normal -> high
versions: +Python 2.6, Python 2.7, 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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

find_unused_port is the wrong approach altogether.  Uses of it should be 
replaced by bind_port and then find_unused_port should be removed.

--

___
Python tracker 

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



[issue1285086] urllib.quote is too slow

2010-04-30 Thread Tres Seaver

Tres Seaver  added the comment:

Updated patch against the trunk attached.

Note that I prefer unidiff myself, but was following a bit of guidance that 
Guido (used to, anyway) prefer context diffs.

The updated speed test run against the stdlib with this patch shows only a 12% 
to 16% hit against my simpler version (which didn't handle cases where the 
'safe' argument was not the default "/").

--
Added file: http://bugs.python.org/file17148/issue1285086-updated.patch

___
Python tracker 

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



[issue1641] asyncore delayed calls feature

2010-04-30 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

I like the idea of leveraging the sched module.  It encapsulates the priority 
queue, allowing the user to be agnostic to the underlying data structure.  If 
someday we have a data structure in the collections module that provides an 
efficient delete-key operation, we can switch.  Giampaolo's patch forever ties 
us to heapq.

That said, I believe Josiah's patch could be simplified considerably.  Here are 
two ideas, which can be evaluated separately:

- The performance improvements to sched should be part of a separate patch and 
listed under a separate issue in the tracker.

- Let the user leverage the existing scheduler API.  Cut out scheduled_task and 
call_later, which just wraps the scheduler API.  The user can simply call 
scheduled_tasks.enter() or scheduled_tasks.cancel().  It's one less API for 
them to learn and one less for us to maintain.

Also, fix one small bug:

- Add a function to create a sched.scheduler().  Several functions take an 
optional "tasks" parameter, but there's no way to allocate a scheduler without 
peeking at the implementation and duplicating how it allocates the global one.

--

___
Python tracker 

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



[issue5553] Py_LOCAL_INLINE(type) doesn't actually inline except using MSC

2010-04-30 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Attached is a patch.  

The diff to configure is just what autoconf produces as a result of the diff to 
configure.in.

With the patch, pyconfig.h will:
- do nothing if the compiler supports the "inline" keyword
- #define inline to __inline or __inline__ if that's the compiler supports
- #define inline to nothing if the compiler doesn't support inlining

The patch also updates pyport.h and _sre.c appropriately.

--
keywords: +needs review, patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file17149/inline.patch

___
Python tracker 

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



[issue8476] build-installer fix for setIcon when no script path specified

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Committed in r80653 (trunk), r80654 (2.6), r80655 (3.2) and r80656 (3.1)

--
resolution:  -> accepted
stage:  -> 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



[issue1677] Ctrl-C will exit out of Python interpreter in Windows

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Unassigning this issue from myself as I cannot reproduce the issue on OSX.

--
assignee: ronaldoussoren -> 
nosy: +ronaldoussoren

___
Python tracker 

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



[issue5553] Py_LOCAL_INLINE(type) doesn't actually inline except using MSC

2010-04-30 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

I should add that the patch is against the py3k branch, since it's too late for 
performance improvements to land in trunk.

--

___
Python tracker 

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



[issue7107] Missing uninstallation instructions for mac

2010-04-30 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

I've added some notes to Mac/README.

r80657 (trunk)
r80658 (2.6)
r80659 (3.2)
r80660 (3.1)

--

___
Python tracker 

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



[issue7107] Missing uninstallation instructions for mac

2010-04-30 Thread Ronald Oussoren

Changes by Ronald Oussoren :


--
resolution:  -> accepted
stage:  -> 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



[issue8557] subprocess PATH semantics and portability

2010-04-30 Thread R. David Murray

R. David Murray  added the comment:

Well, it seems I was mistaken when I thought I knew how this worked :)
Checking the os.exec documentation linked from the subprocess page, I see that 
when an environment is supplied PATH is indeed checked in it.  The 
documentation for CreateProcess, however, indicates that PATH is ignored, and 
any extension must be supplied explicitly.

At the very least the docs should be updated to clarify that execvpe is used 
when an environment is passed on posix, and to link to the CreateProcess docs.  
A discussion of PATH could perhaps be put in a note or footnote (probably 
footnote, there are enough notes already in those docs!)

I'm not sure how one creates a good portability story out of these pieces.  It 
doesn't seem as though there is any way to harmonize the two, since we are 
dealing with the semantics of system calls over which we have no control.

For reference, here is (a?) link to CreateProcess docs that I found via Google:

http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx

It doesn't look like the kind of link that one could trust to be stable, 
though, so I'm not sure if we should include it in the docs.

I'm adding Brian Curtin as nosy to see if he knows whether or not there are 
permalink-like links to the relevant Microsoft documentation that we could use.

--
nosy: +brian.curtin
stage:  -> needs patch
title: subprocess PATH semantics -> subprocess PATH semantics and portability
versions: +Python 2.7, 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



[issue8557] subprocess PATH semantics and portability

2010-04-30 Thread Brian Curtin

Brian Curtin  added the comment:

You could take the "(VS8.5)" part out of the link which will give the latest 
version, which may not always be the relevant version (although I doubt this 
specific API would change).

That's about the best permalink-like feature you'll find, but overall, leaving 
the link as-is is pretty safe in my experience.

--

___
Python tracker 

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



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-30 Thread STINNER Victor

STINNER Victor  added the comment:

Le vendredi 30 avril 2010 15:58:28, vous avez écrit :
> It's better to let the application decide how to solve this problem
> and in order to allow for this, the encodings must be adjustable.

On POSIX, use byte strings to avoid encoding issues. Examples:

   subprocess.call(['env'], {b'TEST: b'a\xff-'}) # env
   subprocess.call(['echo', b'a\xff-']) # command line
   open('a\xff-') # filename
   os.getenv(b'a\xff-') # get env (result as unicode)

Are you talking about issues on Windows?

> By using fsencode() and fsdecode() in stdlib functions, you basically
> prevent this kind of adjustment, ...

Not if you use byte strings. On POSIX, an unicode string is always converted 
at the end for the system call (using sys.getfilesystemencoding()).

> If you know that e.g. your environment variables are going to have
> Latin-1 data (say some content-type variable has this information),
> but the user's default LANG setting is UTF-8, Python will fetch the
> data as broken Unicode data, you then have to convert it back to bytes
> and then back to Unicode using the correct Latin-1 encoding.
> 
> It would be a lot better to have the application provide the
> encoding to the os.getenv() function and have Python do the
> correct decoding right from the start.

You mean that os.getenv() should have an optionnal argument? Something like:

  def getenv(key, default=None, encoding=None):
 value = environ.get(key, default)
 if encoding:
value = value.encode(sys.getfileystemencoding(), 'surrogateescape')
value = value.decode(encoding, 'surrogateescape')
 return value

There are many indirect calls to os.getenv() (eg. by using os.environ.get()):
 - curses uses TERM
 - webbrowser uses PROGRAMFILES (path)
 - distutils.msvc9compiler uses "VS%0.f0COMNTOOLS" % version (path)
 - wsgiref.util uses HTTP_HOST, SERVER_NAME,  SCRIPT_NAME, ... (url)
 - platform uses PROCESSOR_ARCHITEW6432
 - sysconfig uses PYTHONUSERBASE, APPDATA, ... (path)
 - idlelib.PyShell uses IDLESTARTUP and PYTHONSTARTUP (path)
 - ...

How would you specify the correct encoding in indirect calls?

If your application gets variables in *mixed* encoding, I think that your 
program should start by reencoding variables:

  for name, encoding in (('PATH', 'latin1'), ...):
 value = os.getenv(name)
 value = value.encode(sys.getfileystemencoding(), 'surrogateescape')
 value = value.decode(encoding, 'surrogateescape')
 os.setenv(name, value)

--

___
Python tracker 

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



[issue8513] subprocess: support bytes program name (POSIX)

2010-04-30 Thread STINNER Victor

Changes by STINNER Victor :


--
title: subprocess: support bytes program name -> subprocess: support bytes 
program name (POSIX)

___
Python tracker 

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



[issue8432] buildbot: test_send_signal of test_subprocess failure

2010-04-30 Thread STINNER Victor

Changes by STINNER Victor :


--
title: build: test_send_signal of test_subprocess failure -> buildbot: 
test_send_signal of test_subprocess failure

___
Python tracker 

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



[issue8211] configure: ignore AC_PROG_CC hardcoded CFLAGS

2010-04-30 Thread STINNER Victor

STINNER Victor  added the comment:

Sorry but i don't really understand the problem of my patch, and I don't want 
to spend time of this. Revert my patch if you think that it introduced a 
regression.

--

___
Python tracker 

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



[issue8565] Always run regrtest.py with -bb

2010-04-30 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
> Le vendredi 30 avril 2010 15:58:28, vous avez écrit :
>> It's better to let the application decide how to solve this problem
>> and in order to allow for this, the encodings must be adjustable.
> 
> On POSIX, use byte strings to avoid encoding issues. Examples:
> 
>subprocess.call(['env'], {b'TEST: b'a\xff-'}) # env
>subprocess.call(['echo', b'a\xff-']) # command line
>open('a\xff-') # filename
>os.getenv(b'a\xff-') # get env (result as unicode)
> 
> Are you talking about issues on Windows?

The issues normally occur on the way in, not the way out of Python,
so I don't see how using bytes would help.

>> By using fsencode() and fsdecode() in stdlib functions, you basically
>> prevent this kind of adjustment, ...
> 
> Not if you use byte strings. On POSIX, an unicode string is always converted 
> at the end for the system call (using sys.getfilesystemencoding()).

Right and that's a problem since the file system encoding
doesn't need to have anything to do with what you have in
the environment.

>> If you know that e.g. your environment variables are going to have
>> Latin-1 data (say some content-type variable has this information),
>> but the user's default LANG setting is UTF-8, Python will fetch the
>> data as broken Unicode data, you then have to convert it back to bytes
>> and then back to Unicode using the correct Latin-1 encoding.
>>
>> It would be a lot better to have the application provide the
>> encoding to the os.getenv() function and have Python do the
>> correct decoding right from the start.
> 
> You mean that os.getenv() should have an optionnal argument? Something like:

Yes.

>   def getenv(key, default=None, encoding=None):
>  value = environ.get(key, default)
>  if encoding:
> value = value.encode(sys.getfileystemencoding(), 'surrogateescape')
> value = value.decode(encoding, 'surrogateescape')
>  return value

No, you store the environment data as bytes and only
decode in getenv() based on the given encoding or using
the file system encoding or default encoding (UTF-8)
as default.

It would probably also worthwhile adding the encoding
parameter to os.environ.get().

> There are many indirect calls to os.getenv() (eg. by using os.environ.get()):
>  - curses uses TERM
>  - webbrowser uses PROGRAMFILES (path)
>  - distutils.msvc9compiler uses "VS%0.f0COMNTOOLS" % version (path)
>  - wsgiref.util uses HTTP_HOST, SERVER_NAME,  SCRIPT_NAME, ... (url)
>  - platform uses PROCESSOR_ARCHITEW6432
>  - sysconfig uses PYTHONUSERBASE, APPDATA, ... (path)
>  - idlelib.PyShell uses IDLESTARTUP and PYTHONSTARTUP (path)
>  - ...
> 
> How would you specify the correct encoding in indirect calls?

In all of the above cases, the application (in this case the
various modules) knows which encoding to expect and can
add the right encoding parameter to the os.getenv() call.

E.g. the cgi module can use the content-type passed in as
environment parameter to determine the encoding, most other
modules will just use ASCII or the file system encoding
if they are dealing with paths or file names.

> If your application gets variables in *mixed* encoding, I think that your 
> program should start by reencoding variables:
> 
>   for name, encoding in (('PATH', 'latin1'), ...):
>  value = os.getenv(name)
>  value = value.encode(sys.getfileystemencoding(), 'surrogateescape')
>  value = value.decode(encoding, 'surrogateescape')
>  os.setenv(name, value)

Which is a cludge as I mentioned in my previous comment:

value = os.getenv(name, encoding=encoding)
my_environ[name] = value

reads much better.

Also note that os.setenv() won't work since that'll use the
file system encoding for encoding the value back into the C
process environment array. You'd end up with mojibake in
your C environment array.

The point I want to make is that adding fsencode() and
fsdecode() will help refactor the code a bit, but it
shouldn't be used as excuse for not making the encoding
explicit.

--

___
Python tracker 

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Paul Moore

Paul Moore  added the comment:

OK. I've attached a patch which removes the use of get_unused_port for 
test_smtplib and test_multiprocessing. It doesn't use bind_port as both cases 
test classes that create their own port internally, rather I've used port 0 and 
then introspected the actual port assigned.

The same process could probably be used for the remaining uses of 
get_unused_port, but I haven't tackled them yet.

Tested on my local PC and on the buildbot where I see the bug. Both tests run 
fine in both cases. I'm running the full test suite now.

--
keywords: +patch
Added file: http://bugs.python.org/file17150/unused1.patch

___
Python tracker 

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



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-30 Thread STINNER Victor

STINNER Victor  added the comment:

> No, you store the environment data as bytes and only
> decode in getenv() ...

Yes, this is the best solution for POSIX. We need maybe also a 
os.getenvb()->bytes function, maybe only on POSIX.

But I think that Windows should continue to use unicode environment variables. 
Should os.getenv(key, encoding=...) reencode the value on Windows?

--

___
Python tracker 

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



[issue8211] configure: ignore AC_PROG_CC hardcoded CFLAGS

2010-04-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
> Sorry but i don't really understand the problem of my patch, and I don't want 
> to spend time of this. Revert my patch if you think that it introduced a 
> regression.

See the new implementation for what I meant...

r80665 - in python/trunk: configure configure.in
r80666 - in python/branches/py3k: configure configure.in

[issue8211] configure: ignore AC_PROG_CC hardcoded CFLAGS

Only override the AC_PROG_CC determined CFLAGS if they were set by the user.
This restores the default behavior in the common case of not having CFLAGS
defined when running configure.

--

___
Python tracker 

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



[issue8211] configure: allow user-provided CFLAGS to override AC_PROG_CC defaults

2010-04-30 Thread Marc-Andre Lemburg

Changes by Marc-Andre Lemburg :


--
assignee:  -> lemburg
priority: release blocker -> normal
resolution:  -> fixed
status: open -> closed
title: configure: ignore AC_PROG_CC hardcoded CFLAGS -> configure: allow 
user-provided CFLAGS to override AC_PROG_CC defaults

___
Python tracker 

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



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
>> No, you store the environment data as bytes and only
>> decode in getenv() ...
> 
> Yes, this is the best solution for POSIX. We need maybe also a 
> os.getenvb()->bytes function, maybe only on POSIX.

Yes, plus a os.setenvb() function to pass the data back to the C level
array.

> But I think that Windows should continue to use unicode environment 
> variables. Should os.getenv(key, encoding=...) reencode the value on Windows?

Good idea. That would make applications more easily portable between
Windows and POSIX.

--

___
Python tracker 

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



[issue8579] Add missing tests for FlushKey, LoadKey, and SaveKey in winreg

2010-04-30 Thread Brian Curtin

New submission from Brian Curtin :

Per the comment at the top of Lib/test/test_winreg.py, FlushKey, LoadKey, and 
SaveKey are currently untested.

I have a minimal patch worked up. I'll expand on it and upload shortly.

--
assignee: brian.curtin
components: Extension Modules, Windows
messages: 104655
nosy: brian.curtin
priority: normal
severity: normal
stage: needs patch
status: open
title: Add missing tests for FlushKey, LoadKey, and SaveKey in winreg
type: behavior
versions: Python 2.6, Python 2.7, 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



[issue8037] multiprocessing.Queue's put() not atomic thread wise

2010-04-30 Thread Vilnis Termanis

Changes by Vilnis Termanis :


--
versions: +Python 3.1

___
Python tracker 

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



[issue8525] Small enhancement to help()

2010-04-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

2.5 is frozen. 2.6 and 3.1 are in bug-fix mode only, and 2.7 is in beta so new 
features are unlikely there. So I recommend doing a patch against 3.1 or even 
the 3.2 trunk. And of course, make sure this proposal makes sense for 3.x.

--
nosy: +tjreedy
versions: +Python 3.2 -Python 2.5

___
Python tracker 

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



[issue8525] Small enhancement to help()

2010-04-30 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for your work, Rob. To get reviews and comments, you’ll need to submit a 
patch (a diff) instead of the whole file. This makes it easier to see your 
changes than looking for a special comment :)

This short doc should contain all the information you’ll need: 
http://www.python.org/dev/patches

As Terry said, 2.6 and 3.1 only get bug fixes, 2.7 and 3.2 are in beta stage 
and don’t get new features, so you’ll want to port your changes to the py3k 
branch (the trunk for the 3.x series).

Regards

--
components: +Library (Lib)
nosy: +merwok
stage:  -> needs patch

___
Python tracker 

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



[issue8525] Small enhancement to help()

2010-04-30 Thread Brian Curtin

Brian Curtin  added the comment:

Minor correction to the last comment: 3.2 is not in beta nor feature freeze.

--
nosy: +brian.curtin

___
Python tracker 

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



[issue8547] unittest test discovery can fail when package under test is also installed globally

2010-04-30 Thread holger krekel

holger krekel  added the comment:

FWIW checking if an imported module really comes from a certain location and 
erroring out is also how py.test does it.

--
nosy: +hpk

___
Python tracker 

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



[issue8547] unittest test discovery can fail when package under test is also installed globally

2010-04-30 Thread Michael Foord

Michael Foord  added the comment:

Sounds like the right approach then. :-)

--

___
Python tracker 

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



[issue8564] Update documentation on doctest/unittest2 integration

2010-04-30 Thread holger krekel

Changes by holger krekel :


--
nosy: +hpk

___
Python tracker 

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



[issue8580] Problem urllib2.URLError

2010-04-30 Thread Jorge Bosch

New submission from Jorge Bosch :

hello. Im new on this kind of programation. Well it could sound newbie...but I 
have this error and I dont know how to fix it.

Well its related with an AutoUpdater for a Online Game (GTLegends, Altbierbude 
software) but no one manage to solve it..

Here is the Log of the error:

Traceback (most recent call last):
  File "C:\Download\AutoUpdate\altbierbude_en.pyw", line 134, in 
main()
  File "C:\Download\AutoUpdate\altbierbude_en.pyw", line 93, in main
the_app.myconfig = GetAppConfig(source_url, config_filename)
  File "C:\Download\AutoUpdate\altbierbude_en.pyw", line 52, in GetAppConfig
cfg_data = GetUrlData(url+filename)
  File "C:\Download\AutoUpdate\altbierbude_en.pyw", line 31, in GetUrlData
url_handle = opener.open( url )
  File "C:\Python26\lib\urllib2.py", line 389, in open
response = self._open(req, data)
  File "C:\Python26\lib\urllib2.py", line 407, in _open
'_open', req)
  File "C:\Python26\lib\urllib2.py", line 367, in _call_chain
result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 1146, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python26\lib\urllib2.py", line 1121, in do_open
raise URLError(err)
urllib2.URLError: 

--
messages: 104661
nosy: m_enanos
priority: normal
severity: normal
status: open
title: Problem urllib2.URLError
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



[issue8581] Logging handlers do not handle double-closing very well

2010-04-30 Thread Jason Baker

New submission from Jason Baker :

The logging handler does not handle double-closing very well:

>>> from logging import StreamHandler
>>> h = StreamHandler()
>>> h.close()
>>> h.close()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/logging/__init__.py", line 705, in close
del _handlers[self]
KeyError: 

There are two possible approaches to this:

 1. Raise a better error.
 2. Ignore the duplicate close.

This patch takes option 2 as this is likely not indicative of any kind of 
programmer error, but it shouldn't be too difficult to take option 1 instead.

--
components: Library (Lib)
messages: 104662
nosy: Jason.Baker
priority: normal
severity: normal
status: open
title: Logging handlers do not handle double-closing very well
type: behavior
versions: Python 2.6, Python 3.1

___
Python tracker 

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



[issue8581] Logging handlers do not handle double-closing very well

2010-04-30 Thread Jason Baker

Jason Baker  added the comment:

Adding patch

--
keywords: +patch
Added file: http://bugs.python.org/file17151/logging.patch

___
Python tracker 

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



[issue8581] Logging handlers do not handle double-closing very well

2010-04-30 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> vinay.sajip
nosy: +vinay.sajip

___
Python tracker 

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



[issue8582] urllib.urlretrieve fails with ValueError: Invalid format string

2010-04-30 Thread Jason Gross

New submission from Jason Gross :

When calling urllib.urlretrieve with a data:image/png url (possibly with other 
urls too) and a local file name, it fails with
Traceback (most recent call last):
  File "", line 1, in 
urlretrieve(url, file_name)
  File "D:\Python26\Lib\urllib.py", line 93, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
  File "D:\Python26\Lib\urllib.py", line 237, in retrieve
fp = self.open(url, data)
  File "D:\Python26\Lib\urllib.py", line 205, in open
return getattr(self, name)(url)
  File "D:\Python26\Lib\urllib.py", line 596, in open_data
time.gmtime(time.time(

This can be fixed by replacing %T on line 595 with %H : %M : %S (which I found 
as the definition of %T on 
http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html)

--
components: Library (Lib)
messages: 104664
nosy: Jason.Gross
priority: normal
severity: normal
status: open
title: urllib.urlretrieve fails with ValueError: Invalid format string
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Your patch will break test_parser on Windows.

--

___
Python tracker 

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



[issue1054967] bdist_deb - Debian packager

2010-04-30 Thread Piotr Ożarowski

Changes by Piotr Ożarowski :


--
nosy: +piotr

___
Python tracker 

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



[issue8580] Problem urllib2.URLError

2010-04-30 Thread R. David Murray

R. David Murray  added the comment:

The bug tracker is for bugs in Python itself, and isn't a good place to look 
for help on getting an application program to work.  You should try the python 
email list/newsgroup.  (You can find links to the newsgroup and other resources 
under the 'help' link on the left hand side menu on the python home page).

--
nosy: +r.david.murray
resolution:  -> invalid
stage:  -> 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



[issue8556] Confusing string formatting examples

2010-04-30 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for the suggestion. Two things:
1. Please provide a unified diff, as explained in http://www.python.org/dev/
2. I think “number” would be a better placeholder.

Regards

--
nosy: +merwok

___
Python tracker 

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



[issue8581] Logging handlers do not handle double-closing very well

2010-04-30 Thread Santoso Wijaya

Changes by Santoso Wijaya :


--
nosy: +santa4nt

___
Python tracker 

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



[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Jeffrey Yasskin

Jeffrey Yasskin  added the comment:

In what way will my patch break test_parser on Windows? I preserved the 
behavior of re-opening the file in text mode after determining the encoding. Do 
I need to add 'U' to open()'s mode string?

--

___
Python tracker 

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



[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

2010/4/30 Jeffrey Yasskin :
>
> Jeffrey Yasskin  added the comment:
>
> In what way will my patch break test_parser on Windows? I preserved the 
> behavior of re-opening the file in text mode after determining the encoding. 
> Do I need to add 'U' to open()'s mode string?

Sorry, my mind was in other Python versions. It looks fine.

--

___
Python tracker 

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



[issue8533] regrtest: use backslashreplace error handler for stdout

2010-04-30 Thread STINNER Victor

STINNER Victor  added the comment:

regrtest_traceback_stderr.patch is not enough: support._run_suite() writes 
output to sys.stdout instead of sys.stderr. New version of the patch fixes that.

--
Added file: http://bugs.python.org/file17152/regrtest_traceback_stderr-2.patch

___
Python tracker 

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



[issue8533] regrtest: use backslashreplace error handler for stdout

2010-04-30 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file17093/regrtest_traceback_stderr.patch

___
Python tracker 

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-04-30 Thread Dmitry Chichkov

New submission from Dmitry Chichkov :

The namespace_separator parameter is hard coded in the cElementTree.XMLParser 
class disallowing the option of ignoring XML Namespaces with cElementTree 
library.

Here's the code example:
 from xml.etree.cElementTree import iterparse
 from StringIO import StringIO
 xml = """http://www.very_long_url.com";>"""
 for event, elem in iterparse(StringIO(xml)): print event, elem

It produces:
 end http://www.very_long_url.com}child' at 0xb7ddfa58>
 end http://www.very_long_url.com}root' at 0xb7ddfa40> 

In the current implementation local tags get forcibly concatenated with URIs 
often resulting in the ugly code on the user's side and performance degradation 
(at least due to extra concatenations and extra lengthy compare operations in 
the elements matching code).

Internally cElementTree uses EXPAT parser, which is doing namespace processing 
only optionally, enabled by providing a value for namespace_separator argument. 
This argument is hard-coded in the cElementTree: 
 self->parser = EXPAT(ParserCreate_MM)(encoding, &memory_handler, "}");

Well, attached is a patch exposing this parameter in the 
cElementTree.XMLParser() arguments. This parameter is optional and the default 
behavior should be unchanged.  Here's the test code:

import cElementTree

x = """http://www.very_long_url.com";>text"""

parser = cElementTree.XMLParser()
parser.feed(x)
elem = parser.close()
print elem

parser = cElementTree.XMLParser(namespace_separator="}")
parser.feed(x)
elem = parser.close()
print elem

parser = cElementTree.XMLParser(namespace_separator=None)
parser.feed(x)
elem = parser.close()
print elem

The resulting output:
http://www.very_long_url.com}root' at 0xb7e885f0>
http://www.very_long_url.com}root' at 0xb7e88608>


--
components: Library (Lib)
messages: 104671
nosy: dmtr
priority: normal
severity: normal
status: open
title: Hardcoded namespace_separator in the cElementTree.XMLParser
type: performance
versions: Python 2.5, Python 2.6, Python 2.7

___
Python tracker 

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-04-30 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy: +flox

___
Python tracker 

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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-04-30 Thread Dmitry Chichkov

Changes by Dmitry Chichkov :


--
keywords: +patch
Added file: http://bugs.python.org/file17153/issue-8583.patch

___
Python tracker 

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



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-04-30 Thread STINNER Victor

STINNER Victor  added the comment:

Ok, here is a first version of my patch to implement os.environb:
 - os.environb is the bytes version of os.environ, both are synchronized
 - os.environ(b).data stores bytes keys and values on POSIX (but unicode on 
Windows)
 - create os.getenvb()->bytes
 - os.environb and os.getenvb() are not available on Windows nor OS/2
 - os.environ(b) et os.getenv(b)() accept both byte and unicode keys: that's 
maybe a stupid idea, I don't know yet :-)
 - fix #8513: subprocess: support bytes program name on POSIX
 - create os.fsencode() and os.fsdecode()

The patch is not done (the documentation should be updated), but it's a new 
step to help the discussion. I didn't tried it on Windows.

I already try twice to write os.environb some months ago, but I failed (it was 
too complex for me). os.environ and os.environb now share the same "data" 
dictionary, and their methods converts inputs and outputs if necessary.

--
Added file: http://bugs.python.org/file17154/issue8514.patch

___
Python tracker 

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



[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Jeffrey Yasskin

Jeffrey Yasskin  added the comment:

Thanks. Committed as r80668. May I update http://python.org/dev/peps/pep-0291/ 
to reflect that 2to3 should continue working on python-2.5?

--

___
Python tracker 

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



[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

2010/4/30 Jeffrey Yasskin :
>
> Jeffrey Yasskin  added the comment:
>
> Thanks. Committed as r80668. May I update 
> http://python.org/dev/peps/pep-0291/ to reflect that 2to3 should continue 
> working on python-2.5?

I suppose it can't hurt, but I don't know that anyone actually looks
at the either.

--

___
Python tracker 

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



[issue8584] test_multiprocessing skips some tests

2010-04-30 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Some tests in test_multiprocessing (py3k) are skipped because they "require 
_ctypes", but I do have ctypes. Here are the skipped tests:

test_array (test.test_multiprocessing.WithProcessesTestArray) ... skipped 
'requires _ctypes'
test_getobj_getlock_obj (test.test_multiprocessing.WithProcessesTestArray) ... 
skipped 'requires _ctypes'
test_rawarray (test.test_multiprocessing.WithProcessesTestArray) ... skipped 
'requires _ctypes'

test_copy (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... skipped 
'requires _ctypes'
test_sharedctypes (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... 
skipped 'requires _ctypes'
test_synchronize (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... 
skipped 'requires _ctypes'

test_getobj_getlock (test.test_multiprocessing.WithProcessesTestValue) ... 
skipped 'requires _ctypes'
test_rawvalue (test.test_multiprocessing.WithProcessesTestValue) ... skipped 
'requires _ctypes'
test_value (test.test_multiprocessing.WithProcessesTestValue) ... skipped 
'requires _ctypes'

--
assignee: jnoller
components: Tests
messages: 104675
nosy: jnoller, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: test_multiprocessing skips some tests
type: behavior
versions: 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



[issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser

2010-04-30 Thread Dmitry Chichkov

Dmitry Chichkov  added the comment:

And obviously iterparse can be either overridden in the local user code or 
patched in the library. Here's the iterparse code/test code:

import  cElementTree
from cStringIO import StringIO

class iterparse(object):
root = None
def __init__(self, file, events=None, namespace_separator = "}"):
if not hasattr(file, 'read'):
file = open(file, 'rb')
self._file = file
self._events = events
self._namespace_separator = namespace_separator
def __iter__(self):
events = []
b = cElementTree.TreeBuilder()
p = cElementTree.XMLParser(b, namespace_separator= \
self._namespace_separator)
p._setevents(events, self._events)
while 1:
  data = self._file.read(16384)
  if not data:
break
  p.feed(data)
  for event in events:
yield event
  del events[:]
root = p.close()
for event in events:
  yield event
self.root = root


x = """http://www.very_long_url.com";>text"""
context = iterparse(StringIO(x), events=("start", "end", "start-ns"))
for event, elem in context: print event, elem

context = iterparse(StringIO(x), events=("start", "end", "start-ns"), 
namespace_separator = None)
for event, elem in context: print event, elem


It produces:
start-ns ('', 'http://www.very_long_url.com')
start http://www.very_long_url.com}root' at 0xb7ccf650>
start http://www.very_long_url.com}child' at 0xb7ccf5a8>
end http://www.very_long_url.com}child' at 0xb7ccf5a8>
end http://www.very_long_url.com}root' at 0xb7ccf650>
start 
start 
end 
end 

Note the absence of URIs and ignored start-ns events in the 'space_separator = 
None' version.

--

___
Python tracker 

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> OK. I've attached a patch which removes the use of get_unused_port for 
> test_smtplib and test_multiprocessing.

Great, thank you. It was committed in r80669 (trunk), r80670 (2.6), r80671 
(py3k), r80672 (3.1).
Note that there are still a couple of tests using find_unused_port, depending 
on the branch: test_httplib, test_logging, test_socket.

--

___
Python tracker 

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



[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Jeffrey Yasskin

Jeffrey Yasskin  added the comment:

Done.

--
keywords:  -needs review
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



[issue1540617] Use Py_ssize_t for rangeobject members

2010-04-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Closing as out of date.

--
nosy: +mark.dickinson
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue1533] Bug in range() function for large values

2010-04-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

As far as I can tell there's no bug in 3.x:  the 3.x range happily accepts an 
instance of a  class that defines __index__.

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



[issue1533] Bug in range() function for large values

2010-04-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Currently, in trunk, I get:

>>> range(0.0, 11.0, 1.1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: range() integer start argument expected, got float.

But with Alexander's patch on trunk, I get:

>>> range(0.0, 11.0, 1.1)
[0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L]

I'm not sure whether this is intentional or not, but IIRC it was a very 
deliberate choice not to allow float arguments to range (especially when, as 
here, the arguments are simply being truncated).  I don't think this is an 
acceptable change for 2.7 (still less for 2.6).

Any patch for this issue should not change the behaviour for small arguments.

IMO, the *right* solution is to convert arguments via __index__ when possible 
(as 3.x appears to already do).  However, this would be a new feature.  I 
suggest closing this as a 'won't fix'.

--
stage:  -> unit test needed

___
Python tracker 

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



[issue1533] Bug in range() function for large values

2010-04-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

> IIRC, it was a very deliberate choice not to allow float arguments to range

Ignore this bit.  IDRC.  It was a deliberate choice not to let something 
range(0.0, 1.0, 0.1) work to give [0.0, 0.1, ...], since the usual 
floating-point difficulties give uncertainty about the endpoint.

That float arguments were allowed (and silently truncated to integers) is 
merely unfortunate.  :)  And it's no longer permitted in 2.7;  I wouldn't want 
to go back to permitting float arguments here.

I'll set this to pending;  it should be closed unless someone comes up with a 
simple fix in the near future.

--
resolution:  -> wont fix
status: open -> pending

___
Python tracker 

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



[issue8556] Confusing string formatting examples

2010-04-30 Thread Jeff McNeil

Jeff McNeil  added the comment:

Attaching a patch against the trunk, unified format, changed to 'number' as per 
suggestion.

--
versions: +Python 2.7 -Python 2.6
Added file: http://bugs.python.org/file17155/stdtypes.rst.trunk.patch

___
Python tracker 

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



[issue8585] zipimporter.find_module is untested

2010-04-30 Thread Alex

New submission from Alex :

There are no tests for zipimporter.find_module in the success case, only tests 
that it handles invalid inputs ok.  I'll work up some tests for this tomorrow 
probably.

--
components: Extension Modules
messages: 104684
nosy: alex
priority: normal
severity: normal
status: open
title: zipimporter.find_module is untested

___
Python tracker 

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



[issue8585] zipimporter.find_module is untested

2010-04-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
components: +Tests -Extension Modules
nosy: +brett.cannon, ncoghlan
stage:  -> needs patch
type:  -> behavior
versions: +Python 2.6, Python 2.7, 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



[issue665761] reduce() masks exception

2010-04-30 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am attaching a patch with unit tests that implements the "middle-ground 
approach" making map and reduce behave the way zip is now.

I my view this slightly preferable to the "all the way" approach of letting all 
exceptions to propagate up.  My reasoning is that out of the three functions, 
zip, reduce and map, zip is probably the most common and changing its behavior 
is more likely to affect somebody than a change to the other two.

--
nosy: +Alexander.Belopolsky
Added file: http://bugs.python.org/file17156/issue665761.diff

___
Python tracker 

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



[issue4908] Implement PEP 376

2010-04-30 Thread Dan Buch

Changes by Dan Buch :


--
nosy: +meatballhat

___
Python tracker 

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



[issue8312] Add post/pre hooks for distutils commands

2010-04-30 Thread Dan Buch

Changes by Dan Buch :


--
nosy: +meatballhat

___
Python tracker 

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



[issue8324] add a distutils test command

2010-04-30 Thread Dan Buch

Changes by Dan Buch :


--
nosy: +meatballhat

___
Python tracker 

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



[issue8255] step-by-step tutorial

2010-04-30 Thread Dan Buch

Changes by Dan Buch :


--
nosy: +meatballhat

___
Python tracker 

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



[issue8254] write a configure command

2010-04-30 Thread Dan Buch

Changes by Dan Buch :


--
nosy: +meatballhat

___
Python tracker 

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



[issue8252] add a metadata section in setup.cfg

2010-04-30 Thread Dan Buch

Changes by Dan Buch :


--
nosy: +meatballhat

___
Python tracker 

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



[issue8250] Implement pkgutil APIs as described in PEP 376

2010-04-30 Thread Dan Buch

New submission from Dan Buch :

is this a dupe of 4908?

--
nosy: +meatballhat

___
Python tracker 

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



[issue5302] Allow package_data globs match directories

2010-04-30 Thread Dan Buch

Changes by Dan Buch :


--
nosy: +meatballhat

___
Python tracker 

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



  1   2   >