[issue5986] Avoid reversed() in Random.shuffle()

2009-05-11 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

-1 on this patch.  Reversed has a very low overhead.  Readability if
more important.  The current code is self-evidently correct but the
patched code is less obviously so.

--

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



[issue5752] xml.dom.minidom does not escape newline characters within attribute values

2009-05-11 Thread Francesco Sechi

Francesco Sechi francesco.se...@iet.unipi.it added the comment:

All right, now I understand, thanks. But I think that, for internal
class coherence, it is necessary not to modify toxml method, but the
'setAttribute' one, because this is the source of the problem.

--

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



[issue5986] Avoid reversed() in Random.shuffle()

2009-05-11 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

FWIW, the inefficiency is only in the loop setup, the time to call
reversed() and __reversed__().  The inner loop runs at the same speed
because xrange provides a __reversed__ iterator.

Please do not go through the standard library making these minor tweaks
without making sure there is a significant measured speed-up and do
consider the readability issue.

--
resolution:  - rejected
status: open - closed

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



[issue1759845] subprocess.call fails with unicode strings in command line

2009-05-11 Thread Kuang-che Wu

Kuang-che Wu k...@csie.org added the comment:

ocrean-city's patch applied cleanly with trunk and it works for me.
Could anybody review and commit? I could help if any refinement required.

--
nosy: +kcwu

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



[issue5804] Add an 'offset' argument to zlib.decompress

2009-05-11 Thread Robert Collins

Robert Collins robe...@robertcollins.net added the comment:

Well, I think its relatively uncommon to be doing such a loop with a
static buffer anyway - often you'll instead be reading from disk or a
network stream; if we could make those cases simpler and avoid copying
that would be great.

Anyhow, no strong opinions here, just saw it going by before added my
2c.

-Rob

--

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



[issue5987] Broken link to Curses Programming with Python

2009-05-11 Thread Ralph Corderoy

Ralph Corderoy ralph-pythonb...@inputplus.co.uk added the comment:

Does that mean it's policy not to correct documentation for non-latest
versions?  Fair enough.  But perhaps
http://www.python.org/doc/2.5.2/lib/about.html should be changed to
reflect that, and likewise on other non-latest versions, e.g. If the
problem still exists in the latest documentation, please report it.

--

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



[issue5994] help(marshal) just gives an outline; no help text provided.

2009-05-11 Thread Senthil

New submission from Senthil orsent...@gmail.com:

Help on built-in module marshal:

NAME
marshal

FILE
(built-in)

MODULE DOCS
http://docs.python.org/library/marshal

FUNCTIONS
dump(...)

dumps(...)

load(...)

loads(...)

DATA
version = 2

--
assignee: georg.brandl
components: Documentation
messages: 87570
nosy: georg.brandl, orsenthil
priority: normal
severity: normal
status: open
title: help(marshal) just gives an outline; no help text provided.
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

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



[issue5995] unittest command line behaviour

2009-05-11 Thread Michael Foord

New submission from Michael Foord mich...@voidspace.org.uk:

This patch adds a verbosity keyword argument to unittest.main - so you
can do:

if __name__ == '__main__':
   unittest.main(verbosity=2)

It also has a minor fix allowing you to specify test modules / classes
from the command line. This enables unittest to be used like this:

python -m unittest test_module
python -m unittest test_module.TestClass

Which is quite funky.

--
assignee: michael.foord
components: Library (Lib)
files: unittest.patch
keywords: easy, needs review, patch, patch
messages: 87571
nosy: michael.foord
severity: normal
stage: patch review
status: open
title: unittest command line behaviour
type: feature request
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file13956/unittest.patch

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



[issue5995] unittest command line behaviour

2009-05-11 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

It would be nice to have a test for the command line functionality but
I'm not sure it's easy.
In Misc/NEWS, please add the issue number as in other entries.
Other than that, looks fine.

--
keywords:  -needs review
nosy: +pitrou
priority:  - normal
resolution:  - accepted
stage: patch review - commit review

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



[issue5995] unittest command line behaviour

2009-05-11 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

I didn't add the issue number because I created the patch prior to
creating the issue. Will add when I commit. Would like permission to
commit this from an interested core developer.

--

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



[issue5996] abstract class instantiable when subclassing dict

2009-05-11 Thread johannes raggam

New submission from johannes raggam raggam...@adm.at:

when declaring a abstract base class with an abstract property or method
and subclassing from dict, the class is instantiable (instanceable?).

 import abc
 class A(object):
... __metaclass__ = abc.ABCMeta
... @abc.abstractproperty
... def abstract(self): return True
... 
 a = A()
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: Can't instantiate abstract class A with abstract methods abstract
 
 class A2(dict):
... __metaclass__ = abc.ABCMeta
... @abc.abstractproperty
... def abstract(self): return True
... 
 a2 = A2()
 


although, when using the dict definition from __builtin__.pi directly,
the abc behaves like expected. but this may be a bug in the
c-implementation from dict.

platform:
Python 2.6.2 (r262:71600, Apr 25 2009, 21:56:41) 
[GCC 4.3.2] on linux2

--
components: Library (Lib)
messages: 87574
nosy: thet
severity: normal
status: open
title: abstract class instantiable when subclassing dict
type: behavior
versions: Python 2.6

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



[issue5964] WeakSet cmp methods

2009-05-11 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 2. The current WeakSet implementation returns True if a WeakSet is
 compared to any Iterable which contains the same set of objects:

Sounds bad. It should probably be fixed.

--

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



[issue5964] WeakSet cmp methods

2009-05-11 Thread Robert Schuppenies

Robert Schuppenies robert.schuppen...@gmail.com added the comment:

Sounds right to me. Here is another patch plus tests.

Going through the other tests, I adapted two more tests to actually test
WeakSet. Also, I found the following one and think it is a copypaste
from test_set which is not useful for test_weakset. Should it be removed
(as currently done in the patch)?

def test_set_literal(self):
s = set([1,2,3])
t = {1,2,3}
self.assertEqual(s, t)

--
Added file: http://bugs.python.org/file13957/_weakrefset.patch

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



[issue5964] WeakSet cmp methods

2009-05-11 Thread Robert Schuppenies

Changes by Robert Schuppenies robert.schuppen...@gmail.com:


Removed file: http://bugs.python.org/file13955/_weakrefset.patch

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



[issue5964] WeakSet cmp methods

2009-05-11 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Going through the other tests, I adapted two more tests to actually test
 WeakSet. Also, I found the following one and think it is a copypaste
 from test_set which is not useful for test_weakset. Should it be removed
 (as currently done in the patch)?

Absolutely!

--

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



[issue2708] IDLE subprocess error

2009-05-11 Thread Christopher Altona

Christopher Altona calto...@gmail.com added the comment:

I found that if I go into the Windows Task Manager and end (somtimes 
both of) the Python processes, the program will run properly the next 
time I open it.
Hope this helps.

--
nosy: +ChrisAltona

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



[issue1759845] subprocess.call fails with unicode strings in command line

2009-05-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

The first patch will introduce regressions for strings that cannot be
decoded with the filesystem encoding. It is necessary to provide a
fallback to the CreateProcessA function.

I'd prefer the python-only patch, except for the sys=sys argument to
the function. Is it really needed?

--
nosy: +amaury.forgeotdarc

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



[issue5981] float.fromhex bugs

2009-05-11 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Fixed in r72564 (trunk), r72565 (py3k).  The trailing whitespace bugfix 
was backported in r72566 (2.6) and r72567 (3.0), but those versions still 
use locale-aware isspace and islower.

As a semi-accidental by-product, the fix also changes the behaviour of 
float.fromhex('-nan'): previously, float.fromhex('-nan') and 
float.fromhex('nan') had the same sign;  now they have opposite signs. Sane 
code that's affected by the sign bit of a nan should be extremely 
rare, so I don't think this change is going to bother anyone.

--
resolution:  - fixed
status: open - closed

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



[issue5997] strftime is broken

2009-05-11 Thread Jonathan

New submission from Jonathan jonathan.cervi...@gmail.com:

[...@jaydee Development]$ cat is-strftime-broken.py
#!/usr/bin/env python
import subprocess
import time
date_process = subprocess.Popen(
(date, +%x), stdout=subprocess.PIPE)
from_date_command = date_process.communicate()[0].rstrip()
from_strftime = time.strftime(%x)
print Date command returns %s, strftime returns %s % (
from_date_command, from_strftime )
[...@jaydee Development]$ python ./is-strftime-broken.py
Date command returns 11/05/09, strftime returns 05/11/09

--
components: Library (Lib)
messages: 87582
nosy: jonathan.cervidae
severity: normal
status: open
title: strftime is broken
type: behavior
versions: Python 2.5

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



[issue5995] unittest command line behaviour

2009-05-11 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Committed in revision 72570.

--
status: open - closed

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



[issue5997] strftime is broken

2009-05-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Please read

http://docs.python.org/library/locale.html

specifically the docs for 'setlocale'. Before you call setlocale,
python's locale is 'C', just like for any C program before it calls
setlocale.

Python 2.6.2 (r262:71600, May  2 2009, 15:06:57) 
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 import locale
 import time
 time.strftime(%x)
'05/11/09'
 locale.setlocale(locale.LC_ALL,)
'tr_TR.utf-8'
 time.strftime(%x)
'11-05-2009'

--
nosy: +r.david.murray
resolution:  - invalid
status: open - closed

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



[issue5945] PyMapping_Check returns 1 for lists

2009-05-11 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue5982] classmethod, staticmethod: expose wrapped function

2009-05-11 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue5953] Add to whats new: range(n) != range(n)

2009-05-11 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee: georg.brandl - rhettinger
nosy: +rhettinger

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



[issue3292] Position index limit; s.insert(i,x) not same as s[i:i]=[x]

2009-05-11 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee: georg.brandl - rhettinger
nosy: +rhettinger

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



[issue5238] ssl makefile never closes socket

2009-05-11 Thread Jonathan Hayward

Jonathan Hayward jonathan.hayw...@pobox.com added the comment:

Constantine Sapuntzakis wrote:
 import ssl
 
 # Work around python bug #5328
 def SSLSocket_makefile_fixed(self, mode='r', bufsize=-1):
 from socket import _fileobject
 
 self._makefile_refs += 1
 return _fileobject(self, mode, bufsize, True)
 
 ssl.SSLSocket.makefile = SSLSocket_makefile_fixed

Is it possible this workaround has a bug?

In my production code the socket remains open both after this
monkeypatch and after manually closing the underlying socket. In the
attached test case (TLS certificate and keyfile referenced but not
included), a server does the following:

1: listens to a single HTTPS request on port 8443.
2: Serves a Hello, world! page.
3: Closes the connection.
4: Sleeps for five seconds.
5: Exits the process.

The server incorporates the quoted patch, and the behavior from within
Firefox is that it serves up a Hello world! page via
https://localhost:8443/ and the connection remains open for five seconds
until the server process exits, apparently indicating a connection that
remains open as long as the process is running.

Closing the underlying connection manually seems to work.

--
Added file: http://bugs.python.org/file13958/test.py

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



[issue5752] xml.dom.minidom does not escape newline characters within attribute values

2009-05-11 Thread Francesco Sechi

Francesco Sechi francesco.se...@iet.unipi.it added the comment:

A solution for this issue could be to replace the setAttribute method as
follow:
- d[value] = d[nodeValue] = value
+ d[value] = d[nodeValue] = value.replace('\n',' ')

NOTE: I didn't do a patch, because I don't know which python version you
are using.

Please try this solution and give me a feedback, thanks.

--

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



[issue5998] Add __bool__ to threading.Event and multiprocessing.Event

2009-05-11 Thread Floris Bruynooghe

New submission from Floris Bruynooghe floris.bruynoo...@gmail.com:

I think it would allow for more pythonic code if the threading.Event and
multiprocessing.Event classes had the __bool__ special attribute.  This
would allow doing if e: ... instead of if e.is_set(): 

This could be backported to 2.x really easily by just replacing __bool__
to __nonzero__.

See also the thread starting here:
http://mail.python.org/pipermail/python-ideas/2009-May/004617.html

--
components: Library (Lib)
files: event.diff
keywords: patch
messages: 87587
nosy: flub
severity: normal
status: open
title: Add __bool__ to threading.Event and multiprocessing.Event
type: feature request
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file13959/event.diff

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



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2009-05-11 Thread Sridhar Ratnakumar

New submission from Sridhar Ratnakumar sridh...@activestate.com:

cc +DD64 -Ae -D_REENTRANT +Z -c  -DNDEBUG -O  -I. -IInclude -I./Include
  -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
Error 419: ./Modules/python.c, line 34 # 'mbstate_t' is used as a
type, but has not been defined as a type.
mbstate_t mbs;
^ 
make: *** [Modules/python.o] Error 2


!
!
!

When I get time, I need to create a patch to fix this.. but if somebody
else already figured out what the issue is, that'd be great too.

--
components: Build
messages: 87588
nosy: srid
severity: normal
status: open
title: compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but 
has not been defined as a type
type: compile error
versions: Python 3.1

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



[issue5752] xml.dom.minidom does not escape newline characters within attribute values

2009-05-11 Thread Francesco Sechi

Changes by Francesco Sechi francesco.se...@iet.unipi.it:


Removed file: http://bugs.python.org/file13837/test_toxml.py

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



[issue5752] xml.dom.minidom does not escape newline characters within attribute values

2009-05-11 Thread Francesco Sechi

Changes by Francesco Sechi francesco.se...@iet.unipi.it:


Added file: http://bugs.python.org/file13960/test_toxml.py

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



[issue6000] compile error on AIX and HP-UX 11.00 - PyNumber_InPlaceOr(newfree, allfree) 0

2009-05-11 Thread Sridhar Ratnakumar

New submission from Sridhar Ratnakumar sridh...@activestate.com:

cc_r -qlanglvl=ansi -c  -DNDEBUG -O  -I. -IInclude -I./Include  
-DPy_BUILD_CORE -o Python/symtable.o Python/symtable.c
Python/symtable.c, line 767.50: 1506-068 (S) Operation between types
struct _object* and int is not allowed.
Python/symtable.c, line 826.55: 1506-068 (S) Operation between types
struct _object* and int is not allowed.
make: *** [Python/symtable.o] Error 1

!
!
!

The lines causing the error is:

if (PyNumber_InPlaceOr(newfree, allfree)  0)
goto error;

...

if (PyNumber_InPlaceOr(child_free, temp_free)  0)
goto error;


!
!
!

On HP-UX 11.00 (parisc and parisc2.0), the error message is:

cc +DAportable -Ae -D_REENTRANT +Z -c  -DNDEBUG -O  -I. -IInclude
-I./Include   -DPy_BUILD_CORE -o Python/symtable.o Python/symtable.c
cc: Python/symtable.c, line 767: error 1649: Illegal integer-pointer
combination for .
cc: Python/symtable.c, line 767: error 1563: Expression in if must be
scalar.
cc: Python/symtable.c, line 826: error 1649: Illegal integer-pointer
combination for .
cc: Python/symtable.c, line 826: error 1563: Expression in if must be
scalar.
make: *** [Python/symtable.o] Error 1


!
!
!

When I get time, I need to create a patch to fix this.. but if somebody
else already figured out what the issue is, that'd be great too.

--
components: Build
messages: 87589
nosy: srid
severity: normal
status: open
title: compile error on AIX and HP-UX 11.00 - PyNumber_InPlaceOr(newfree, 
allfree)  0
type: compile error
versions: Python 3.1

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



[issue5752] xml.dom.minidom does not escape newline characters within attribute values

2009-05-11 Thread Francesco Sechi

Francesco Sechi francesco.se...@iet.unipi.it added the comment:

I have uploaded a test script that shows that, without my patch, the
methods setAttribute and parseString work differently; adding my patch,
the behaviour is symmetric.

--

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



[issue6001] Test discovery for unittest

2009-05-11 Thread Michael Foord

New submission from Michael Foord mich...@voidspace.org.uk:

Attached is a patch that implements test discovery for unittest.

It includes command line argument handling (awkward manual handling but
works fine...), so that it can be invoked through:

   python -m unittest discover
   python -m unittest discover start_dir pattern top_level_dir

If the patch is acceptable then I will write docs. Do I need to make a
post to Python-dev or is it ok to have it reviewed here? The basic
mechanism was hammered out on the Testing-in-Python mailing list with a
lot of input from Robert Collins.

Brett Cannon has already looked over the test discovery code (not the
command line handling code though!).

It includes a customization hook both for modules and packages to
customize test loading and discovery. Described below:

Advantage of this: it is simple (easy to extend)
Disadvantage: it is simple (a lot it doesn't do)

Test discovery is provided through the TestLoader.discover method.

It takes three arguments - start directory, pattern to match test files
(defaults to 'test*.py') and the top level directory of the project
(defaults to the start directory).

The main restriction is that all your tests must be importable from the
top level directory of your project. The start directory is then
recursively searched for files and packages that match the pattern you
pass in. Tests are loaded from matching modules, and all tests run.

(A further restriction is that discovery only currently recognises
packages as directories containing __init__.py files and not .pyc etc.)

The load_tests protocol provides a way for packages and modules to
customize test loading. This is inspired by a similar system in use in
the Bzr test suite.

Iff a test module defines a load_tests function then
TestLoader.loadTestsFromModule will call this function with loader,
tests, None. This should return a suite.

An example 'do nothing' implementation of load_tests would be:

   def load_tests(loader, tests, pattern):
   return tests

If a package directory name matches the pattern you pass into discovery
and the __init__.py contains a load_tests function then it will be
called with loader, tests, pattern. No further discovery will be done
into the package, but because it is passed the pattern as an argument it
is free to continue discovery itself. A do nothing load_tests for a
package is:

def load_tests(loader, tests, pattern):
if pattern is None:
return tests
return TestSuite(tests,
loader.discover(os.path.dirname(os.path.abspath(__file__)), pattern))

(The loader stores the top level directory it was originally called with
specifically for this use case. load_tests should not pass in a new top
level directory to the existing loader but create a new loader if it
wants to do this.)

Discovery does not follow the __path__ attribute of packages / modules
and only looks at the filesystem.

I have tested this implementation on the importlib tests (as one
example) and it worked fine.

Many of the restrictions mentioned here would be very easy to solve in
the future, but I think it is important to get some simple version of
test discovery in ASAP.

All I can think of for now...

--
assignee: michael.foord
components: Library (Lib)
files: test_discovery.patch
keywords: needs review, patch, patch
messages: 87591
nosy: benjamin.peterson, michael.foord
severity: normal
stage: patch review
status: open
title: Test discovery for unittest
type: feature request
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file13961/test_discovery.patch

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



[issue5846] Deprecate obsolete functions in unittest

2009-05-11 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Hehe - I wasn't actually doing that, just replacing the use of the
obsolete functions.

--

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



[issue5596] memory leaks in 3.1

2009-05-11 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
dependencies: +test_urlllib2_localnet DigestAuthHandler leaks nonces

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



[issue6002] test_urllib2_localnet DigestAuthHandler leaks nonces

2009-05-11 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
title: test_urlllib2_localnet DigestAuthHandler leaks nonces - 
test_urllib2_localnet DigestAuthHandler leaks nonces

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



[issue5997] strftime is broken

2009-05-11 Thread Jonathan

Jonathan jonathan.cervi...@gmail.com added the comment:

Works perfectly now, thank you and sorry for the inaccurate report.

--

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



[issue5201] Using LDFLAGS='-rpath=\$$LIB:/some/other/path' ./configure breaks the build

2009-05-11 Thread Floris Bruynooghe

Floris Bruynooghe floris.bruynoo...@gmail.com added the comment:

The updated patch inserts the single $ when needed.  I've checked this
on compiling python, stdlib extension modules and custom extension
modules and this gives the correct results in all cases.

--
Added file: http://bugs.python.org/file13962/makevars2.diff

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



[issue1759845] subprocess.call fails with unicode strings in command line

2009-05-11 Thread Greg Couch

Greg Couch gr...@cgl.ucsf.edu added the comment:

I like the C patch better.  It only tries to decode non-unicode objects
with the filesystem (mbcs) encoding.  This fits in with Python 3.0
perfectly where all strings are unicode.  In 2.5, strings are assumed to
be in the mbcs encoding, to match the Windows ANSI API, so decoding
those with the mbcs encoding shouldn't alter the set of acceptable
strings (which is what the C patch is doing if I read the code correctly).

--

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



[issue4066] smtplib SMTP_SSL._get_socket doesn't return a value

2009-05-11 Thread Daniel Diniz

Daniel Diniz aja...@gmail.com added the comment:

Thanks, Marcin!

Same bug seems to apply to py3k, ported patches attached.

--
stage:  - patch review
versions: +Python 3.1
Added file: http://bugs.python.org/file13964/return_socket.diff

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



[issue5265] StringIO can duplicate newlines in universal newlines mode

2009-05-11 Thread Jason R. Coombs

Jason R. Coombs jar...@jaraco.com added the comment:

Although this was fixed for 3.1, it appears not to be fixed for Python
2.6 or 2.7.

PS C:\Users\jaraco python
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import io
 io.StringIO('foo\r\nbar\r\n', newline=None).read()
u'foo\n\nbar\n\n'

Note that this behavior is slightly different from what pitrou reported.

If this cannot be fixed in 2.6, the documentation should at least
reflect that it doesn't work until a later version.

--
nosy: +jaraco

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



[issue5994] help(marshal) just gives an outline; no help text provided.

2009-05-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Patch attached for trunk based on 2.6.2 docs.  I only included what felt
like the essential parts of the module description.

--
assignee: georg.brandl - r.david.murray
keywords: +patch
nosy: +r.david.murray
stage:  - patch review
versions: +Python 3.2
Added file: http://bugs.python.org/file13965/issue5994.patch

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



[issue5957] Possible mistake regarding writeback in documentation of shelve.open()

2009-05-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Fixed in r72572, r72573, r72574, and r72575.

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

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



[issue5994] help(marshal) just gives an outline; no help text provided.

2009-05-11 Thread Senthil

Senthil orsent...@gmail.com added the comment:

David, should the marshal.version be explained as it is present in the docs?

marshal.version

Indicates the format that the module uses. Version 0 is the
historical format, version 1 (added in Python 2.4) shares interned
strings and version 2 (added in Python 2.5) uses a binary format for
floating point numbers. The current version is 2.

Otherwise, the patch is fine and can be applied. Thank you.

--

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



[issue5265] StringIO can duplicate newlines in universal newlines mode

2009-05-11 Thread Alexandre Vassalotti

Alexandre Vassalotti alexan...@peadrop.com added the comment:

The bug shouldn't affect 2.6 and 2.7 unless you backported the now
obsolete _stringio module from 3.0.

I tested 2.6 and 2.7 and as expected I didn't see the bug:

Python 2.6.2+ (release26-maint:72576, May 11 2009, 23:16:48) 
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 import io
 io.StringIO('foo\r\nbar\r\n', newline=None).read()
u'foo\nbar\n'

--

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



[issue5752] xml.dom.minidom does not escape newline characters within attribute values

2009-05-11 Thread Daniel Diniz

Daniel Diniz aja...@gmail.com added the comment:

Francesco,
Your patch still doesn't allow one to add a multiline attribute values
as Tomalak describes:
The catch: This leads to an actual data loss if I *wanted* to store
newline characters in an attribute -- unless the newline characters are
properly encoded. Encoding the newline characters is also valid and
conforms to the spec, so the DOM implementation should do it.

I'm not sure whether the proposed behavior is correct or desirable. Even
if it is correct, it might introduce backwards incompatible changes in
behavior.

Here's a test case for trunk.

--
nosy: +ajaksu2
Added file: http://bugs.python.org/file13966/test_multiline_roundtrip.diff

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



[issue5752] xml.dom.minidom does not escape newline characters within attribute values

2009-05-11 Thread Daniel Diniz

Changes by Daniel Diniz aja...@gmail.com:


--
priority:  - normal
stage: test needed - patch review

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



[issue1759845] subprocess.call fails with unicode strings in command line

2009-05-11 Thread Kuang-che Wu

Kuang-che Wu k...@csie.org added the comment:

There is slight difference between C and python patch.
C version: convert mbcs argument to unicode
py version: convert unicode argument to mbcs

Actually, python version patch may not work if the string is unicode and
cannot encoded by mbcs. For example, my windows system is Chinese
(cp950) and the program I want to execute contains Japanese characters.
Encode Japanese characters with mbcs (in this case, it is cp950) will
fail. This is also what Matt (mclausch) said.

On the other hand, the C version patch. I don't think fall-back is
necessary. If the string is failed to convert from mbcs to unicode, it
will be eventually failed inside CreateProcessA() because CreateProcessA
internally (after win2k) will try to convert from mbcs to unicode and
call CreateProcessW.

--

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



[issue2813] No float formatting in PyString_FromFormat

2009-05-11 Thread Daniel Diniz

Changes by Daniel Diniz aja...@gmail.com:


--
nosy: +eric.smith
priority:  - normal
stage:  - patch review
versions: +Python 2.7, Python 3.2 -Python 2.1.1, Python 2.1.2, Python 2.2, 
Python 2.2.1, Python 2.2.2, Python 2.2.3, Python 2.3, Python 2.4, Python 2.5, 
Python 2.6, Python 3.0

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



[issue1672568] silent error in email.message.Message.get_payload

2009-05-11 Thread Daniel Diniz

Daniel Diniz aja...@gmail.com added the comment:

Renaud,
Here's your patch with a test case against trunk.

--
stage: test needed - patch review
Added file: http://bugs.python.org/file13967/noisy_get_payload.diff

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