[issue5513] "What's New" should say VERY CLEARLY that the type file is gone

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r70536.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5539] open documentation unclear

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r70534.

--
nosy: +benjamin.peterson
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5540] "file objects" in python 3 tutorial

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Why shouldn't it be? One of the goals of 3.x io is to present a more
pythonic interface while preserving a similar interface to 2.x. Users
can learn about the complete io stack later.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue2170] rewrite of minidom.Node.normalize

2009-03-22 Thread Brett Cannon

Changes by Brett Cannon :


--
stage:  -> patch review

___
Python tracker 

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-03-22 Thread Matthew Barnett

Matthew Barnett  added the comment:

Ah, too Perlish! :-)

Another feature request that I've decided not to consider any further is
recursive regular expressions. There are other tools available for that
kind of thing, and I don't want the re module to go the way of Perl 6's
rules; such things belong elsewhere, IMHO.

--

___
Python tracker 

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



[issue1034053] unittest.py patch: add skipped test functionality

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I've attached a new patch which takes into account Antoine's review.

--

___
Python tracker 

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



[issue1034053] unittest.py patch: add skipped test functionality

2009-03-22 Thread Benjamin Peterson

Changes by Benjamin Peterson :


Added file: http://bugs.python.org/file13399/unittest_galore.patch

___
Python tracker 

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



[issue1034053] unittest.py patch: add skipped test functionality

2009-03-22 Thread Benjamin Peterson

Changes by Benjamin Peterson :


Removed file: http://bugs.python.org/file13396/unittest_galore.patch

___
Python tracker 

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



[issue5539] open documentation unclear

2009-03-22 Thread David W. Lambert

Changes by David W. Lambert :


--
assignee:  -> georg.brandl
components: +Documentation
nosy: +georg.brandl
versions: +Python 3.0

___
Python tracker 

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



[issue5540] "file objects" in python 3 tutorial

2009-03-22 Thread David W. Lambert

New submission from David W. Lambert :

http://docs.python.org/dev/py3k/tutorial/inputoutput.html#methods-of-
file-objects

Is it proper to discuss file objects in py3K?

--
assignee: georg.brandl
components: Documentation
messages: 83991
nosy: LambertDW, georg.brandl
severity: normal
status: open
title: "file objects" in python 3 tutorial
versions: Python 3.0

___
Python tracker 

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



[issue5539] open documentation unclear

2009-03-22 Thread David W. Lambert

New submission from David W. Lambert :

See thread
http://groups.google.com/group/comp.lang.python/browse_thread/thread/85e
c714aa6898d84#


En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson   
 escribió: 
> Gabriel Genellina  yahoo.com.ar> writes: 
>> The undocumented behavior is relying on the open() builtin to return 
a 
>> BufferedReader for a binary file. 
> I don't see the problem. open() will return some BufferedIOBase   
> implmentor, and 
> that's all that TextIOWrapper needs. 


How do you know? AFAIK, the return value of open() is completely   
undocumented: 
http://docs.python.org/3.0/library/functions.html#open 
And if you open the  file in text mode, the return value isn't a   
BufferedIOBase. 
-- 
Gabriel Genellina 

The return value of open() is a "stream", according to 
http://docs.python.org/dev/py3k/library/io.html#module-io

--
messages: 83990
nosy: LambertDW
severity: normal
status: open
title: open documentation unclear

___
Python tracker 

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-03-22 Thread Robert Xiao

Robert Xiao  added the comment:

Frankly, I don't really like that idea; I think it muddles up the RE
syntax to have such a group-modifying operator, and seems rather
unpythonic: the existing way to do this --  use .upper(), .lower() or
.title() to format the groups in a match object as necessary -- seems to
be much more readable and reasonable in this sense.

I think the proposed changes look good, but I agree that the focus
should be on breaking up the megapatch into more digestible feature
additions, starting from the barebones engine. Until that's done, I
doubt *anyone* will want to review it, let alone merge it into the main
Python distribution. So, I think we should hold off on any new features
until this raft of changes can be properly broken up, reviewed and
(hopefully) merged in.

--

___
Python tracker 

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2009-03-22 Thread Matthew Barnett

Matthew Barnett  added the comment:

An additional feature that could be borrowed, though in slightly
modified form, from Perl is case-changing controls in replacement
strings. Roughly the idea is to add these forms to the replacement string:

\g<1> provides capture group 1

\u\g<1> provides capture group 1 with the first character in uppercase

\U\g<1> provides capture group 1 with all the characters in uppercase

\l\g<1> provides capture group 1 with the first character in lowercase

\L\g<1> provides capture group 1 with all the characters in lowercase

In Perl titlecase is achieved by using both \u and \L, and the same
could be done in Python:

\u\L\g<1> provides capture group 1 with the first character in
uppercase after putting all the characters in all lowercase

although internally it would do proper titlecase.

I'm suggesting restricting the action to only the following group. Note
that this is actually syntactically unambiguous.

--

___
Python tracker 

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



[issue5538] tearDown in unittest should be executed regardless of result in setUp

2009-03-22 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

It's up to Steve to decide wheter to commit.  I presume that he will
want to stay true to JUnit and to avoid risk of breaking existing test
suites.

--
assignee:  -> purcell
keywords: +needs review -patch
nosy: +purcell, rhettinger

___
Python tracker 

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



[issue5538] tearDown in unittest should be executed regardless of result in setUp

2009-03-22 Thread Garrett Cooper

Garrett Cooper  added the comment:

If someone will provide a link to a page with instructions on how to
checkout python from cvs / svn / etc I'll gladly apply a patch to the
sources on 2.x and 3.x HEAD.

Thanks,
-Garrett

--

___
Python tracker 

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



[issue5538] tearDown in unittest should be executed regardless of result in setUp

2009-03-22 Thread Garrett Cooper

Changes by Garrett Cooper :


Removed file: http://bugs.python.org/file13397/issue-blah-2.4.5.diff

___
Python tracker 

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



[issue5538] tearDown in unittest should be executed regardless of result in setUp

2009-03-22 Thread Garrett Cooper

Garrett Cooper  added the comment:

That patch wasn't complete -_-... here's a more complete 2.4.x patch.

--
Added file: http://bugs.python.org/file13398/issue-5538-2.4.5.diff

___
Python tracker 

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



[issue1501108] Add write buffering to gzip

2009-03-22 Thread Lukas Lueg

Lukas Lueg  added the comment:

This is true for all objects whose input could be concatenated.

For example with hashlib:

data = ['foobar']*10
mdX = hashlib.sha1()
for d in data:
mdX.update(d)
mdY = hashlib.sha1()
mdY.update("".join(data))

mdX.digest() == mdY.digest()

the second version is multiple times faster...

--
nosy: +ebfe

___
Python tracker 

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



[issue5538] tearDown in unittest should be executed regardless of result in setUp

2009-03-22 Thread Garrett Cooper

Changes by Garrett Cooper :


--
type:  -> behavior

___
Python tracker 

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



[issue5538] tearDown in unittest should be executed regardless of result in setUp

2009-03-22 Thread Garrett Cooper

New submission from Garrett Cooper :

While trying to deal with some annoying issues with setting up and
tearing down consoles via pexpect, I noticed that the teardown functions
/ methods weren't being executed via nose.

After applying this change to 2.4.5 and 2.6.1, things work as expected
(note: this patch only applies cleanly with 2.4.5 AFAICT -- it didn't
work with 2.6.1).

My expectations are:



I'd expect that the best fix would be for tearDown to be unconditionally
called if setUp is called, s.t. testers can ensure that the operating
state of the UUT and testbed are at a predefined state.

So in my testcase provided, I would expect the following flow:

1. Keeping assert False in setup_module...
`Calling setup_module'

`Calling teardown_module'

2. Removing assert False from setup_module...

`Calling setup_module'
- `Calling function_setup'

- `Calling function_teardown'
- `Calling TestClass:setUp'

- `Calling TestClass:tearDown'
`Calling teardown_module'

If this isn't done, it makes some operations, like tearing down consoles
with pexpect _extremely_ painful to perform...



Please see 
for more details.

--
components: Tests
files: issue-blah-2.4.5.diff
keywords: patch
messages: 83983
nosy: yaneurabeya
severity: normal
status: open
title: tearDown in unittest should be executed regardless of result in setUp
versions: Python 2.4, Python 2.5, Python 2.6
Added file: http://bugs.python.org/file13397/issue-blah-2.4.5.diff

___
Python tracker 

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



[issue5068] tarfile loops forever on broken input

2009-03-22 Thread Lars Gustäbel

Lars Gustäbel  added the comment:

I just checked in a fix for the problem, r70523-70527. Thank you very
much for your report.

--
resolution:  -> fixed
status: open -> closed
versions: +Python 2.5

___
Python tracker 

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



[issue5535] json custom encoder not fully functionnal

2009-03-22 Thread Bob Ippolito

Bob Ippolito  added the comment:

The documentation says "If specified, default is a function that gets 
called for objects that can’t otherwise be serialized. It should return a 
JSON encodable version of the object or raise a TypeError."

*can't otherwise be serialized* means that the object must not be a 
subtype of something that is serializable. The implementation is correct 
and this behavior is documented. Documentation patches to make this more 
obvious are acceptable, but it's not a bug so it can't be fixed as such.

--

___
Python tracker 

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



[issue5535] json custom encoder not fully functionnal

2009-03-22 Thread Pierre Hanser

Pierre Hanser  added the comment:

you realize that the current handling is incorrect and also not documented?

and that the described case is from the real world: it prevents using pydbus
and dbus.Boolean type to send a json boolean

I don't take your argument about performance:
i would like to have the choice between correctness and performance

--

___
Python tracker 

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



[issue5537] LWPCookieJar cannot handle cookies with expirations of 2038 or greater on 32-bit platforms

2009-03-22 Thread Chris Hollenbeck

New submission from Chris Hollenbeck :

The LWPCookieJar can be saved on 64-bit Ubuntu, but not on 32-bit Ubuntu
when the expiration year is greater than 2038.  This has not been tested
on any other Intel-compatible Linux platform, though it appears related
to the Year 2038 bug.  The MozillaCookieJar does not have a problem
saving on either architecture.

A sample crash is shown below:

  File "/home/user/xblstatus/LiveConnect.py", line 189, in connect
self.cookiejar.save(self.cookieFile)
  File "/usr/lib/python2.5/_LWPCookieJar.py", line 89, in save
f.write(self.as_lwp_str(ignore_discard, ignore_expires))
  File "/usr/lib/python2.5/_LWPCookieJar.py", line 75, in as_lwp_str
r.append("Set-Cookie3: %s" % lwp_cookie_str(cookie))
  File "/usr/lib/python2.5/_LWPCookieJar.py", line 35, in lwp_cookie_str
time2isoz(float(cookie.expires
  File "/usr/lib/python2.5/cookielib.py", line 98, in time2isoz
year, mon, mday, hour, min, sec = time.gmtime(t)[:6]
ValueError: timestamp out of range for platform time_t

---

The cookie jar and urllib2 integration was done with:

self.cookiejar = cookielib.LWPCookieJar()

self.opener =
urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookiejar))

urllib2.install_opener(self.opener)

---

The code used to save the cookie after accessing the web page was:

self.cookiejar.save(self.cookieFile)

The cookieFile variable is simply the default location of the cookie
file for saving in the program.

--
components: Library (Lib)
messages: 83979
nosy: hollec
severity: normal
status: open
title: LWPCookieJar cannot handle cookies with expirations of 2038 or greater 
on 32-bit platforms
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



[issue5536] urllib: urlretrieve() does not close file objects on failure

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r70521.

--
nosy: +benjamin.peterson
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue1034053] unittest.py patch: add skipped test functionality

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Here's the patch on Rietveld: http://codereview.appspot.com/27095

--

___
Python tracker 

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



[issue5532] imap usage in itertools unique_justseen recipe

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Done in r70520.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue1034053] unittest.py patch: add skipped test functionality

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Ok, here's my unittest skipping patch. It supports skipping classes and
expected failures and includes skipping decorators.

I had to employ a little evil to make test skipping work for classes.
The made a new TestSuite class called ClassTestSuite, to contain the
tests for one class. It pretends to be a TestCase enough that in can be
completely skipped.

--
Added file: http://bugs.python.org/file13396/unittest_galore.patch

___
Python tracker 

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



[issue5531] unittest: allow failures in tearDown method

2009-03-22 Thread Brett Cannon

Brett Cannon  added the comment:

Thanks for the patch and the attempt, Tim!

--
Added file: http://bugs.python.org/file13395/unnamed

___
Python tracker 

___Thanks for the patch and the attempt, Tim!
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5531] unittest: allow failures in tearDown method

2009-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I concur with other developers. In strict unittesting, assertions of
correct behavior should only ever happen in the test not during set up
or tear down.

--
nosy: +benjamin.peterson
resolution:  -> 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



[issue5535] json custom encoder not fully functionnal

2009-03-22 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
status: open -> closed

___
Python tracker 

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



[issue5535] json custom encoder not fully functionnal

2009-03-22 Thread Bob Ippolito

Bob Ippolito  added the comment:

It is common to specify a default function but it would be terrible for 
performance if this function was called for every single object passed 
through to the decoder.

If you want a serialization different from a primitive type you'll have to  
choose a different base class.

--
resolution:  -> wont fix

___
Python tracker 

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



[issue1974] email.MIMEText.MIMEText.as_string incorrectly folding long subject header

2009-03-22 Thread Martin von Gagern

Changes by Martin von Gagern :


--
nosy: +gagern

___
Python tracker 

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-22 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
assignee:  -> pitrou
resolution:  -> accepted

___
Python tracker 

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



[issue5535] json custom encoder not fully functionnal

2009-03-22 Thread Georg Brandl

Changes by Georg Brandl :


--
assignee:  -> bob.ippolito
nosy: +bob.ippolito

___
Python tracker 

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



[issue5502] io-c: TextIOWrapper is faster than BufferedReader but not protected by a lock

2009-03-22 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
assignee:  -> pitrou
priority:  -> normal
stage:  -> needs patch
type:  -> performance

___
Python tracker 

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



[issue5529] Backport sys module docs involving import to 2.7

2009-03-22 Thread Georg Brandl

Georg Brandl  added the comment:

Oh, it's nice to have something to do at PyCon. :)

--
assignee:  -> georg.brandl

___
Python tracker 

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



[issue5536] urllib: urlretrieve() does not close file objects on failure

2009-03-22 Thread Petr Dolezal

New submission from Petr Dolezal :

urllib.request.urlretrieve() does not close the file object created for
the retrieval when it fails during processing of the incoming data and
raises an exception (e.g. on HTTP 404 response). Therefore the file
remains opened until the process terminates and the OS itself closes the
orphaned file handle.

This behaviour may result in orphaned temporary/incomplete files. It is
also not just a resource leak, but it has another bad side effect on
Windows platform (at least): the file can't be deleted (due to the used
creation mode) before the handle is closed. But the entire file object,
including the handle, is lost due to the exception, thus nobody
(including the process itself) is able to delete the file until the
process terminates.

Consider this code snippet demonstrating the described behaviour:
import os
import urllib.request
FILENAME = 'nonexistent.html'
try:
# The host must be valid, else the address resolving fails
# before the target file is even created. But existing host
# and non-existent resource is exactly what's the problem.
NON_EXISTENT_URL = 'http://www.python.org/nonexistent.html'
urllib.request.urlretrieve(NON_EXISTENT_URL, FILENAME)
except Exception:
if os.path.exists(FILENAME):
print('File exists! Attempting to delete.')
os.unlink(FILENAME)
print('Succeeded.')

On Windows, following output appears:
File exists! Attempting to delete.
Traceback (most recent call last):
  File "test.py", line 6, in 
urllib.request.urlretrieve(NON_EXISTENT_URL, FILENAME)
  File "C:\Program Files\Python\lib\urllib\request.py", line 134, in
urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
  File "C:\Program Files\Python\lib\urllib\request.py", line 1502, in
retrieve
block = fp.read(bs)
  File "C:\Program Files\Python\lib\io.py", line 572, in read
self._checkClosed()
  File "C:\Program Files\Python\lib\io.py", line 450, in _checkClosed
if msg is None else msg)
ValueError: I/O operation on closed file.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 10, in 
os.unlink(FILENAME)
WindowsError: [Error 32] The process cannot access the file because it
is being used by another process: 'nonexistent.html'

As a quick fix it is possible to ensure closing both source and target
file objects in finally blocks. I also assume the function should delete
the target file on an exception: the file is not only incomplete, but
its name is also unknown to the client code in the case of the temporary
file made by urlretrieve() itself. If the client code is interested in
partial downloads, I guess it should take another way to retrieve the
resource as urlretrieve() interface doesn't look like supporting
something like partial download.

Anyway, the proposed solution is still not the optimal one: ValueError
with message "I/O operation on closed handle" is really nothing I would
expect as a valid error when downloading a non-existent web page. I
guess a check on the source file object before reading begins would
discover the problem early and raise more appropriate IOError or
something like that.

Note:
This bug report probably applies to older versions of urllib, but I
can't verify it now. I know at least I spotted it in 2.6 just before I
upgraded to 3.0.1.

--
components: Library (Lib)
messages: 83970
nosy: pdolezal
severity: normal
status: open
title: urllib: urlretrieve() does not close file objects on failure
type: behavior
versions: Python 3.0

___
Python tracker 

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



[issue5531] unittest: allow failures in tearDown method

2009-03-22 Thread Tim Cuthbertson

Tim Cuthbertson  added the comment:

In my mind, an error means something is wrong. A failure just means a
test case hasn't been implemented yet, or has regressed. For me it's
misleading to have an AssertionError reported as a failure. It's not as
if changing the reporting in this way could cause tests to succeed when
they should fail (or vice versa) - so it seems like there is no downside
to including this behaviour.

--

___
Python tracker 

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



[issue1501108] Add write buffering to gzip

2009-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Although the script does not work as-is (missing import of "string",
typo between "frags" and "wfrags"), I can conform the 3x ratio.

--
nosy: +pitrou

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-22 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> marketdickinson
components: +Interpreter Core
priority:  -> normal
type:  -> feature request

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

A few comments:

I think PyLong_SIGN and PyLong_EQUALS_ZERO should go in 
Include/longobject.h, not Include/longintrepr.h:  these 2 macros have an 
unambiguous meaning for *any* representation of integers.  And 
longintrepr.h is really supposed to be private, for the use of 
longobject.c only.  PyLong_NDIGITS should stay in longintrepr.h, though, 
since it's dependent on the representation.

Perhaps rename PyLong_EQUALS_ZERO to PyLong_IS_ZERO?

Almost all your uses of PyLong_SIGN take the form PyLong_SIGN(X) < 0.  
Maybe it would be better to have a PyLong_IS_NEGATIVE macro instead?

--

___
Python tracker 

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



[issue5531] unittest: allow failures in tearDown method

2009-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Agreed with Brett and Raymond.
Besides, I'm not sure how getting a failure rather an error changes
anything in the big picture (for my non native English-speaking brain,
it certainly doesn't make a difference :-)).

--
nosy: +pitrou

___
Python tracker 

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



[issue4688] GC optimization: don't track simple tuples and dicts

2009-03-22 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

The patch looks fine to me. Some documentation is missing, still:
is_tracked needs to be documented in the regular documentation, and
SHOW_TRACK_COUNT should be documented in SpecialBuilds.txt.

I'm not sure whether you actually want to integrate SHOW_TRACK_COUNT
into the code base. If yes, it should be cleaned up a little. There
should be no default #undef for it, and, IMO, it should count tuples, too.

--

___
Python tracker 

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



[issue3944] faster long multiplication

2009-03-22 Thread Pernici Mario

Pernici Mario  added the comment:

This patch comes from 30bit_longdigit13+optimizations1.patch in issue4258
with modification for the case of multiplication by 0; it passes
test_long.py and pidigits is a bit faster.

--
Added file: http://bugs.python.org/file13394/longobject_diff1

___
Python tracker 

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



[issue5534] Decimal __format__ reverses meaning of '<' and '>' alignment specs

2009-03-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

Yes, it should be fixed already in the release maintenance branches.

See r70430 through r70433.

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



[issue5535] json custom encoder not fully functionnal

2009-03-22 Thread Pierre Hanser

New submission from Pierre Hanser :

The json module provides an encoder python -> json.
The encoding may be specialized by the user, using
the cls parameter of the dumps function.

But all simple types are always handled by the library encoder,
the user encoder is only used as a last resort one, for unknown types.

This is not described nor intuitive, and it prevents specifying a custom
encoder for classes which inherit from simple type.

in the provided example (thanks Raymond) a user defined boolean
type, inheriting from int, is handled as int where you would prefer
it to be handled as a json boolean through a custom encoder.

problem seen on simplejson-2.0.9 or official python 2.6.1

--
components: Library (Lib)
files: jsonCustomEncoder.py
messages: 83962
nosy: phanser
severity: normal
status: open
title: json custom encoder not fully functionnal
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file13393/jsonCustomEncoder.py

___
Python tracker 

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



[issue1497532] C API to retain GIL during Python Callback

2009-03-22 Thread Lukas Lueg

Lukas Lueg  added the comment:

I'm not sure if such a API is feasible. The very nature of Python makes
it impossible to tell in advance what the interpreter will do when
getting called. This is even true for simple functions - think of your
function getting decorated...

Let's consider the following scenario:

- Python-Thread 1 is already running and owns a lock on some object.
While it still owns the lock, it releases the GIL.
- We are executing in Python-Thread 2 and call from Python to C. The C
function has the GIL, "locks" it and calls back to Python.
- The Python function executes in the same thread, still having the GIL.
It tries to acquire the lock on the same object as Thread 1. Preventing
a deadlock between those two threads, it releases the GIL and waits for
the object-lock.
- The GIL is "locked" to the current thread and the current thread is
the only one that we can allow to unlock it again; this narrows our
options down to Py_BEGIN_ALLOW_THREADS becoming a No-Op in such situations.
- Py_BEGIN_ALLOW_THREADS executed in the second C-function is silently
ignored. Thread 2 waits for the object-lock with Thread 1 never having a
chance to release it.
- The interpreter just deadlocked.


AFAICS we can't guarantee not to deadlock if there are other threads
running before we lock the GIL to the current thread.

--
nosy: +ebfe

___
Python tracker 

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



[issue5534] Decimal __format__ reverses meaning of '<' and '>' alignment specs

2009-03-22 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Mark, can you confirm that this is out of date?

--
nosy: +rhettinger

___
Python tracker 

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



[issue4753] Faster opcode dispatch on gcc

2009-03-22 Thread Andrew I MacIntyre

Andrew I MacIntyre  added the comment:

Out of interest, the attached patch against the py3k branch at r70516
cleans up the threaded code changes a little:
- gets rid of TARGET_WITH_IMPL macro;
- TARGET(op) is followed by a colon, so that it looks like a label (for
editors that make use of that).

On my systems (all older AMD with old versions of gcc), this patch has
performance slightly better than SVN r70516, and performance is
usually very close to the NO_COMPUTED_GOTOS build.

--
nosy: +aimacintyre
Added file: http://bugs.python.org/file13392/ceval.c.threadcode-tidyup.patch

___
Python tracker 

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