[issue9134] sre bug: lastmark_save/restore

2010-07-01 Thread Armin Rigo

Armin Rigo  added the comment:

It's pretty trivial to turn my x.py into a unit test, of course.

--

___
Python tracker 

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



[issue5315] signal handler never gets called

2010-07-01 Thread Ernesto Menéndez

Changes by Ernesto Menéndez :


--
nosy: +Netto

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

I can't reproduce this on Linux.  However, I've seen an informal report of 
something like this happening before.  It looks a lot like something threading 
related, but I don't see any threads in what you're doing.  (Though I don't 
know the details of how the profile module works, on either Linux or Windows.)

The use of locals() in the Context constructor is an unnecessary hack that's 
easy to fix;  I'll do that.  But it would still be good to understand exactly 
where this is coming from.

--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

BTW, is the behaviour consistent, or does it only occur on some runs?

--

___
Python tracker 

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



[issue1856] shutdown (exit) can hang or segfault with daemon threads running

2010-07-01 Thread Ernesto Menéndez

Changes by Ernesto Menéndez :


--
nosy: +Netto

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Okay, I can reproduce by adding a 'time.sleep(0.01)' delay into the body of the 
'for name, val in locals().items():' loop.  I then get (with py3k):

dicki...@alberti:~/Source/py3k> ./python
Python 3.2a0 (py3k:82413M, Jul  1 2010, 10:21:02)
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal, profile
>>> def show_bug(): decimal.Decimal(1.2)**(-2**31)
...
>>> profile.run('show_bug()')
Traceback (most recent call last):
  File "/home/dickinsm/Source/py3k/Lib/decimal.py", line 447, in getcontext
return _local.__decimal_context__
AttributeError: '_thread._local' object has no attribute '__decimal_context__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/dickinsm/Source/py3k/Lib/profile.py", line 70, in run
prof = prof.run(statement)
  File "/home/dickinsm/Source/py3k/Lib/profile.py", line 442, in run
return self.runctx(cmd, dict, dict)
  File "/home/dickinsm/Source/py3k/Lib/profile.py", line 448, in runctx
exec(cmd, globals, locals)
  File "", line 1, in 
  File "", line 1, in show_bug
  File "/home/dickinsm/Source/py3k/Lib/decimal.py", line , in __pow__
context = getcontext()
  File "/home/dickinsm/Source/py3k/Lib/decimal.py", line 449, in getcontext
context = Context()
  File "/home/dickinsm/Source/py3k/Lib/decimal.py", line 3822, in __init__
for name, val in locals().items():
RuntimeError: dictionary changed size during iteration

--

___
Python tracker 

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



[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-01 Thread Ralph Corderoy

Ralph Corderoy  added the comment:

Google has led me here because I'm trying to see how to process find(1)'s 
-print0 output with Python.  Perl's -0 option and $/ variable makes this 
trivial.

find -name '*.orig' -print0 | perl -n0e unlink

awk(1) has its RS, record separator, variable too.  There's a clear need, and 
it should also be possible to modify or re-open sys.stdin to change the 
existing separator.

--
nosy: +ralph.corderoy

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah

Stefan Krah  added the comment:

Mark Dickinson  wrote:
> I can't reproduce this on Linux.  However, I've seen an informal report of 
> something like this happening before.  It looks a lot like something 
> threading related, but I don't see any threads in what you're doing.  (Though 
> I don't know the details of how the profile module works, on either Linux or 
> Windows.)

I can reproduce it consistently, also --without-threads. I'm lacking knowledge
about the profile module, but it has a comment "(old profiler used to write into
the frames local dictionary!!". Perhaps there's still something like that going 
on.

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Removing the decimal module from the equation, the following is enough to 
trigger this for me.  Stefan's suggestion about the profile module writing to 
locals sounds right on target.


import profile

class Context(object):
def __init__(self):
for name, val in locals().items():
setattr(self, name, val)

profile.run("Context()")

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

class Context(object):
def __init__(self):
for name, val in locals().items():
setattr(self, name, val)


Isn't this dodgy anyway, since 'name' and 'val' end up going into locals()?  I 
wonder why the RuntimeError *isn't* raised for a normal 'Context()' call (i.e., 
not via profile).

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah

Stefan Krah  added the comment:

Still clueless about profile.py, but I think it creates a parallel stack,
and overwriting of locals legitimately occurs in that stack, producing
the Exception.

So it would appear that by design one simply cannot iterate over locals
when using the profile module.

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah

Stefan Krah  added the comment:

Mark Dickinson  wrote:
> 
> Mark Dickinson  added the comment:
> 
> class Context(object):
> def __init__(self):
> for name, val in locals().items():
> setattr(self, name, val)
> 
> 
> Isn't this dodgy anyway, since 'name' and 'val' end up going into locals()?  
> I wonder why the RuntimeError *isn't* raised for a normal 'Context()' call 
> (i.e., not via profile).

Indeed, and it seems to depend on how name and vals are used:

... print(locals())
... 
{'name': '__builtins__', 'val': , '__builtins__': 
, '__package__': None, 'Context': , '__name__': '__main__', '__doc__': None}
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: dictionary changed size during iteration

... pass
... 
>>> locals()
{'name': '__doc__', 'val': None, '__builtins__': , '__package__': None, 'Context': , 
'__name__': '__main__', '__doc__': None}
>>>

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah

Stefan Krah  added the comment:

The tracker doesn't handle code when posted by mail. Here's the
code again:

>>> for name, val in locals().items():
... print(locals())
... 
{'name': '__builtins__', 'val': , '__builtins__': 
, '__package__': None, '__name__': '__main__', 
'__doc__': None}
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: dictionary changed size during iteration

 
>>> for name, val in locals().items():
... pass
... 
>>> 
>>> locals()
{'name': '__doc__', 'val': None, '__builtins__': , '__package__': None, '__name__': '__main__', '__doc__': None}
>>>

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Ah, it looks like 'locals()' is somewhat magical.  Its docstring says:

"Update and return a dictionary containing the current scope's local variables."

So I think this explains your (Stefan's) results:  in either case, you evaluate 
locals() (as the target of the for statement) and get a dictionary back.  But 
that dictionary isn't updated to include 'name' and 'val' until you call 
locals() for a second time.  (And possibly there are other activities besides 
an explicit locals() call that would cause that dict to be updated, but I'm not 
sure.)

I still don't understand how things work when profile is added into the mix, 
but I'm willing to accept that the profile module affects locals() in strange 
and possibly timing-dependent ways.

Anyway, the fix for decimal is clear:  get rid of that locals call.

--
stage: unit test needed -> needs patch

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

> it looks like 'locals()' is somewhat magical

... and Objects/frameobject.c is the place to go for a full understanding.  
PyFrame_FastToLocals is the 'updating' function that updates the locals dict 
from the 'fast locals' object.

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's a patch.  It's a little ugly, but I don't see a better way that avoids 
locals().  Using **kwargs is an option, but would mean abandoning the current 
nice feature that unexpected keyword arguments raise TypeError (or 
alternatively, implementing that check separately).

This should be backported to 2.x after 2.7 has been released;  for that 
backport, the dictionary comprehensions should be replaced by 
dict(), so that the code remains valid with older Python 
versions.

--
keywords: +patch
stage: needs patch -> commit review
versions: +Python 2.6, Python 2.7, Python 3.2
Added file: http://bugs.python.org/file17825/issue9136.patch

___
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-07-01 Thread Éric Araujo

Changes by Éric Araujo :


--
resolution:  -> accepted
stage:  -> needs patch
versions:  -Python 3.3

___
Python tracker 

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



[issue9126] errors='replace' does not work at Windows command line

2010-07-01 Thread John Van Praag

John Van Praag  added the comment:

According to the documentation of the open function:

errors is an optional string that specifies how encoding and decoding
errors are to be handled–this cannot be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
errors. (Note that ignoring encoding errors can lead to data loss.)
'replace' causes a replacement marker (such as '?') to be inserted where
there is malformed data. 

If a replacement marker such as '?' were replacing the bad characters,
the print function would not have a problem. The open function is not
working as described in the documentation.

On Wed, 30 Jun 2010 22:29 +, "Ezio Melotti" 
wrote:
> 
> Ezio Melotti  added the comment:
> 
> The problem is not in the reading part, but in the print().
> Since the default encoding of your terminal is cp437 and cp437 is not
> able to encode the "bad character" (U+2019 RIGHT SINGLE QUOTATION MARK),
> an error is raised.
> 
> --
> nosy: +ezio.melotti
> resolution:  -> invalid
> stage:  -> committed/rejected
> status: open -> closed
> type:  -> behavior
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans

Thomas Jollans  added the comment:

Two more patches:

Firstly, this patch (array_3.2_fromstring.diff) is nearly identical to 
array2.diff. "y*" would (again) have to be changed to "s*" to apply this to 3.1

--
Added file: http://bugs.python.org/file17826/array_3.2_fromstring.diff

___
Python tracker 

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



[issue9126] errors='replace' does not work at Windows command line

2010-07-01 Thread R. David Murray

R. David Murray  added the comment:

The characters are fine when you read them (that is, they decode correctly to 
unicode).  They are only invalid when you write them to the windows terminal, 
which can't handle all the valid characters that are in the file.  The Idle 
output window uses a more capable character set, and can display those 
characters.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans

Thomas Jollans  added the comment:

Secondly, this is my attempt to add the more sensibly named {to|from}bytes 
methods, and to deprecate {to|from}string. 

I doubt it's perfect, maybe there's some policy on deprecating methods that I 
didn't find? This may be better discussed in a separate forum, eg a separate 
issue or python-dev maybe? I wouldn't know.

The unpatched test suite passes with the rest of this patch applied. (unless 
using -Werror)

--
Added file: http://bugs.python.org/file17827/tofrombytes.diff

___
Python tracker 

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



[issue8595] Explain the default timeout in http-client-related libraries

2010-07-01 Thread Eric Smith

Eric Smith  added the comment:

I think you could preserve backward compatibility by doing something like the 
following (in httplib):

_sentinel = object()
__HTTP_DEFAULT_TIMEOUT = _sentinel

In httplib.HTTPConnection.__init__(), in Python 2.6.

   def __init__(self, host, port=None, strict=None,
timeout=None):
  if timeout is None:
 if _HTTP_DEFAULT_TIMEOUT is _sentinel:
timeout = socket._GLOBAL_DEFAULT_TIMEOUT
 else:
timeout = _HTTP_DEFAULT_TIMEOUT

That way, if _HTTP_DEFAULT_TIMEOUT is never set, it will use the the socket 
timeout. Admittedly I'd rather see all uses of module globals go away, but I 
think this would be a good compromise.

--
nosy: +eric.smith

___
Python tracker 

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



[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans

Changes by Thomas Jollans :


Added file: http://bugs.python.org/file17828/tofrombytes.diff

___
Python tracker 

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



[issue8990] array constructor and array.fromstring should accept bytearray.

2010-07-01 Thread Thomas Jollans

Changes by Thomas Jollans :


Removed file: http://bugs.python.org/file17827/tofrombytes.diff

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-07-01 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> You can make the dictionary values as lists for the 'blocked'
> argument for import_fresh_module(). That would work [for io].

I don't understand how having multiple modules in the blocked list will help in 
io case.  io.py will simply not work if _io is blocked.  It does not use 
"define in Python, override with native if available" strategy.  Instead, io.py 
and _pyio.py are independent complete implementations.

I don't like that approach because it makes pure python code hard to discover.  
In the recent discussions, some people were in fact surprised to learn that 
pure python io implementation is still available.  The io/_pyio approach also 
prevents io.py from bring used by alternative python implementations unmodified.


What I can do, is to add an optional "blocked" argument 
import_module_implementations() along the lines of

def import_module_implementations(name, blocked=None):
if blocked is None:
blocked = ('_' + name,)
...

This will not solve the io issue, but will add some flexibility.

Note that import_module_implementations() as designed is not very useful for 
tests of the named module itself.  In that case you need the implementations 
individually rather than as a list.  This is mostly useful in situations like 
pickle where other modules are tested for interoperability with alternative 
pickle implementations.

Of course, I should document the mechanism once we agree on what it should be. 
:-)  (I did not know that test.support had a reST document, but will update it 
for this patch.)

--

___
Python tracker 

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



[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-07-01 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

+1 on using the full name, PyUnicodeObject

The shorthand "PyUnicode" is too easy to confuse with Py_UNICODE (an actual 
type).

--
nosy: +stutzbach

___
Python tracker 

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



[issue9137] x.update(red=5, blue=6, other=7) doesn't work, where x is a MutableMapping

2010-07-01 Thread Daniel Stutzbach

New submission from Daniel Stutzbach :

Simple example, using collections.OrderedDict:

>>> import collections
>>> x = collections.OrderedDict()
>>> x.update(red=5, blue=6, other=7)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/bin/../stow/Python-3.1.1/lib/python3.1/_abcoll.py", line 
490, in update
for key, value in other:
TypeError: 'int' object is not iterable

In MutableMapping.update, the first argument needs to be a positional-only 
argument.  Otherwise, it's impossible to use "other" as keyword argument to 
designate a key-value pair.

--
assignee: stutzbach
messages: 109055
nosy: stutzbach
priority: normal
severity: normal
stage: needs patch
status: open
title: x.update(red=5, blue=6, other=7) doesn't work, where x is a 
MutableMapping
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-07-01 Thread Éric Araujo

Éric Araujo  added the comment:

To avoid the strange-looking “a PyUnicodeObject object”, one can write “an 
instance of PyUnicodeObject”.

Victor, have you kept the  around 0 and 1?

--
resolution:  -> accepted
stage:  -> patch review

___
Python tracker 

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



[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-07-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> To avoid the strange-looking “a PyUnicodeObject object”, one can write
> “an instance of PyUnicodeObject”.

Or simply "a PyUnicodeObject".

--

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> In any case, my threshold for moving this forward is for someone to
> review the code in sandbox.

Ok some comments:

- I find the _cmp() and __cmp() indirection poor style in 3.x, especially when 
you simply end up comparing self._getstate() and other._getstate() (it is also 
suboptimal because it can do more comparisons than needed)

- Shouldn't __eq__ and friends return NotImplemented if the other type 
mismatches, to give the other class a chance to implement its own comparison 
method? that's what built-in types do, as least
(this would also make _cmperror useless)

- Using assert to check arguments is bad. Either there's a risk of bad input, 
and you should raise a proper error (for example ValueError), or there is none 
and the assert can be left out.

- Starting _DAYS_IN_MONTH with a None element and then iterating over 
_DAYS_IN_MONTH[1:] looks quirky

- Using double-underscored names such as __day is generally discouraged, 
simple-underscored names (e.g. _day) should be preferred

- Some comments about "CPython compatibility" should be removed

- Some other comments should be reconsidered or removed, such as "# XXX The 
following should only be used as keyword args" or "XXX Buggy in 2.2.2"

- Some things are inconsistent: date uses bytes for pickle support, time uses 
str for the same purpose

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-07-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> > You can make the dictionary values as lists for the 'blocked'
> > argument for import_fresh_module(). That would work [for io].
> 
> I don't understand how having multiple modules in the blocked list
> will help in io case.  io.py will simply not work if _io is blocked. 

Which you avoid by giving an empty list of blocked modules, using
Alexandre's suggestion.

> I don't like that approach because it makes pure python code hard to
> discover.

Ok, but this code exists and it would be much better if it were
supported.

> The io/_pyio approach also prevents io.py from bring used by
> alternative python implementations unmodified.

It would be foolish to use it unmodified anyway, unless you like
low-speed I/O (and a JIT isn't a magic bullet).

The reason this was done like this is that the io module is imported at
startup: we want to avoid unnecessary parsing of extraneous code (and
unnecessary importing additional dependencies), and we also want to
reduce opportunities for failing to initialize the standard I/O streams
(especially stderr...).

> This will not solve the io issue, but will add some flexibility.

Which is pointless unless such flexibility is needed by someone.

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-07-01 Thread R. David Murray

R. David Murray  added the comment:

Please don't update the reST document.  The support module should never have 
been documented outside the module itself, because now we are pretty much 
committed to otherwise needless backward compatibility for the stuff that is 
documented.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-01 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Thanks a lot for the review.  Please see my replies below.

On Thu, Jul 1, 2010 at 12:09 PM, Antoine Pitrou  wrote:
..
> - I find the _cmp() and __cmp() indirection poor style in 3.x,
> especially when you simply end up comparing self._getstate() and
> other._getstate() (it is also suboptimal because it can do more
> comparisons than needed)
>

I agree.  Do you think I should just define __lt__ and use 
functools.total_ordering decorator?  Note that current implementation mimics 
what is done in C, but I think python should drive what is done in C and not 
the other way around. 

> - Shouldn't __eq__ and friends return NotImplemented if the other type
> mismatches, to give the other class a chance to implement its own
> comparison method? that's what built-in types do, as least
> (this would also make _cmperror useless)

This is a tricky part.  See issue #5516.  I would rather not touch it unless we 
want to revisit the whole comparison design.

>
> - Using assert to check arguments is bad. Either there's a risk of bad > 
> input, and you should raise a proper error (for example ValueError),
> or there is none and the assert can be left out.
>

I disagree.  Asserts as executable documentation are good.  I know, -O is 
disfavored in python, but still you can use it to disable asserts.  Also I 
believe most of the asserts are the same in C version.

> - Starting _DAYS_IN_MONTH with a None element and then iterating over
> _DAYS_IN_MONTH[1:] looks quirky
>
Would you rather start with 0 and iterate over the whole list?  It may be 
better to just define it as a literal list display.  That's what C code does.

> - Using double-underscored names such as __day is generally
> discouraged, simple-underscored names (e.g. _day) should be preferred
>

I think in this case double-underscored names are justified.  Pickle/cPickle 
experience shows that people tend to abuse the freedom that python 
implementations give to subclasses and then complain that C version does not 
work for them.  I think __ name mangling will be a better deterrent than _ is 
private convention.

> - Some comments about "CPython compatibility" should be removed
>

Why?  The goal is to keep datetime.py in sync with datetimemodule.c, not to 
replace the C implementation.  C implementation will still be definitive.


> - Some other comments should be reconsidered or removed, such as
> "# XXX The following should only be used as keyword args"

This one I was actually thinking about making mandatory by changing the 
signature to use keyword only arguments.  I am not sure if that is well 
supported by C API, though.  

> or "XXX Buggy in 2.2.2"

Yes, a review of XXXs is in order.

>
> - Some things are inconsistent: date uses bytes for pickle support,
> time uses str for the same purpose

Already fixed.

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-07-01 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Thu, Jul 1, 2010 at 12:18 PM, Antoine Pitrou  wrote:
..
>> I don't understand how having multiple modules in the blocked list
>> will help in io case.  io.py will simply not work if _io is blocked.
>
> Which you avoid by giving an empty list of blocked modules, using
> Alexandre's suggestion.
>

Yes, you can make import_module_implementations('io') return [io] this way, but 
what the user is likely to expect would be [io, _pyio].


I understand that there are reasons to keep io the way it is, but most of the 
other modules should probably follow pickle approach.  In any case, testing 
alternative io implementations is easy.  No import block trickery is needed - 
just import io and _pyio separately.

I just don't like the idea of having test.support know details about other 
modules and would like to have a clear use case before doing anything more 
sophisticated than blocking '_' + name.

If we end up with a central registry of native optimizations, it should 
probably not be in test.support.

--

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-01 Thread R. David Murray

R. David Murray  added the comment:

If they abuse the _ methods and complain that the C version doesn't work, we 
just say "we *told* you not to do that".  It is not the Python philosophy to 
try to protect users from mistakes that they wilfully make.

--

___
Python tracker 

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



[issue1643370] recursive urlparse

2010-07-01 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

David, Is the stage "unit test needed" proper for this or was it by mistake?

Anatoly, I thought closing this feature request was fine, because I considered 
that with namedtuple the desired attributes of url's were obtained as 
ParsedTuple object (check test_urlsplit_attributes in test_urlparse.py). But as 
you pointed out, I can see that the docs can be improved further.
 
Your suggested approach of dictionary is bit different than the way it is 
currently implemented, a patch might have helped for evaluation.

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah

Stefan Krah  added the comment:

Mark, the patch looks good. I don't find it ugly, but anyway, here's a
bike shed version. :)

The main point is that I'd like the flags and traps sections to be
set apart visually while compressing the boilerplate.

--
Added file: http://bugs.python.org/file17829/issue9136-blue-bikeshed.patch

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Nice shade of blue!  Just a couple of red spots that I'd prefer repainted, 
namely: (1) please put bodies of 'try:' and 'except:' on separate lines, and 
(2) please use 'except NameError' instead of a bare except.

And a couple of points that I think also applied to my patch:

- {s: 0 for s in _signals} could also be spelt dict.fromkeys(_signals, 0)

- I think dict(dc.traps) should be dc.traps.copy() instead.  I can't entirely 
see why it would matter, except that it's conceivable that dc.traps could by a 
dict subclass with its own copy method.

--

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-01 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> R. David Murray  added the comment:
>
> If they abuse the _ methods and complain that the C version doesn't
> work, we just say "we *told* you not to do that".  It is not the Python
> philosophy to try to protect users from mistakes that they willfully
> make.

Let me think some more about this.  Given double underscores in special 
methods, changing this is not a simple s/__/_/ throughout the file.  I am not 
sure _ clearly signals "don't use in subclasses": that's what __ is for.

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Stefan, one other thought: please also bear in mind that we're restricted to 
Python 2.3 syntax in the 2.x version of decimal, so any post-Python 2.3-isms 
will have to be rewritten when the patch is backported.  (E.g., use of 
conditional expressions.)

While I don't see any particular reason for the 3.x version of decimal to 
restrict its syntax in this manner, it might be worth sticking to simple syntax 
just so that the 2.x and 3.x decimal versions don't differ too much, to make 
maintenance easier.

--

___
Python tracker 

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



[issue7989] Add pure Python implementation of datetime module to CPython

2010-07-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I agree.  Do you think I should just define __lt__ and use
> functools.total_ordering decorator?

I had forgotten about functools.total_ordering. Yes, very good idea.

>   Note that current implementation mimics what is done in C, but I
> think python should drive what is done in C and not the other way
> around.

I think the Python version doesn't have to mimic every exact quirk of
the C version. I think it's good if the code is idiomatic Python.

> I disagree.  Asserts as executable documentation are good.

I am talking specifically about this kind of assert:

assert 1 <= month <= 12, 'month must be in 1..12'

I think it should be replaced with:

if month < 1 or month > 12:
raise ValueError('month must be in 1..12')

I don't think it's reasonable to disable argument checking when -O is
given. Furthermore, AssertionError is the wrong exception type for this.

On the other hand, I do agree that most asserts in e.g.
timedelta.__new__ are good.

> > - Starting _DAYS_IN_MONTH with a None element and then iterating
> over
> > _DAYS_IN_MONTH[1:] looks quirky
> >
> Would you rather start with 0 and iterate over the whole list?  It may
> be better to just define it as a literal list display.  That's what C
> code does.

Hmm, I wrote that comment before discovering that it is useful for
actual data to start at index 1. You can forget this, sorry.

> I think in this case double-underscored names are justified.
> Pickle/cPickle experience shows that people tend to abuse the freedom
> that python implementations give to subclasses and then complain that
> C version does not work for them.

Ah, but the Python datetime implementation will be automatically
shadowed by the C one; you won't end up using it by mistake, so people
should not ever rely on any of its implementation details.

To give a point of reference, the threading module used the __attribute
naming style for private attributes in 2.x, but it was converted to use
the _attribute style in 3.x.

(one genuine use for it, by the way, is to make it easy to test
implementation-specific internal invariants in the test suite)

> > - Some comments about "CPython compatibility" should be removed
> 
> Why?  The goal is to keep datetime.py in sync with datetimemodule.c,
> not to replace the C implementation.

Yes, but talking about CPython compatibility in the CPython source tree
looks puzzling. You could reword these statements, e.g. "compatibility
with the C implementation".

> > - Some other comments should be reconsidered or removed, such as
> > "# XXX The following should only be used as keyword args"
> 
> This one I was actually thinking about making mandatory by changing
> the signature to use keyword only arguments.

That would be an API change and would break compatibility. Are you sure
you want to do it?

> I am not sure if that is well supported by C API, though.

Not at all. You would have to analyze contents of the keywords dict
manually.

--

___
Python tracker 

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



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-07-01 Thread Ezio Melotti

Ezio Melotti  added the comment:

Ported to py3k in r82413.
Some test with non-BMP characters should probably be added.
The patch should still be ported to 2.6 and 3.1.

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Stefan Krah

Stefan Krah  added the comment:

Mark, good point about 2.3 compatibility. The unit tests diverge quite a
bit though between 2.5, 2.6 and 2.7.

I like {s: 0 for s in _signals} slightly better here (but I like
dict/list comprehensions in general).


So, the new patch still sets the flags/traps sections apart, doesn't
use the ternary construct and uses traps.copy().


IOW, I only painted the door blue. ;)

--
Added file: http://bugs.python.org/file17830/issue9136-blue-bikeshed-2.patch

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

Looks good to me.  Please go ahead and apply it to the 3.2 and 3.1 branches, if 
you want.  (Or just assign back to me if you prefer.)

It should also be applied to 2.7 and 2.6, eventually, but we should probably 
wait until after the 2.7 release this weekend for that.

--
assignee: mark.dickinson -> skrah

___
Python tracker 

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



[issue1643370] recursive urlparse

2010-07-01 Thread anatoly techtonik

anatoly techtonik  added the comment:

Too bad that request from users who are not eligible to produce a patch are not 
accepted by Python "community". =/

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Stylistically, it would be nice to eliminate the local variable reassignment 
entirely:

self.Emin = DefaultContext.Emin if Emin is None else Emin
self.Emax = DefaultContext.Emax if Emax is None else Emax
self._ignored_flags = [] if _ignored_flags is None else _ignored_flags

Also, to keep the code consistent between versions, it may be better to avoid 
set/dict comprehensions and stick with the old:

dict([(s, int(s in flags)) for s in _signals])

or slightly more modern generator comprehension:

dict((s, int(s in flags)) for s in _signals)

--
nosy: +rhettinger

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

[Raymond]
> self.Emin = DefaultContext.Emin if Emin is None else Emin

I agree that looks better.  But we can't spell it that way in 2.x (since 
conditional expressions aren't 2.3 compatible), and I'd prefer to keep the 2.x 
and 3.x versions reasonably close, at least while 2.x is still being maintained.

Still, no strong feelings either way.

--

___
Python tracker 

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



[issue1643370] recursive urlparse

2010-07-01 Thread Georg Brandl

Georg Brandl  added the comment:

Why shouldn't you be eligible to produce patches to Python?

And yes, requests without patches will sometimes take longer, or be
evaluated differently, since we're all volunteers here, and an existing
patch, even if unusable it the submitted form, often makes working on
a request much more straightforward.

Regarding your ironic quoting of the word "community" -- do not forget
that you are part of the community, and what we are doing here is
exactly what a community does as compared to a company: helping each
other, not because of payment, but because we care for what we do.
Please do not subvert that commitment.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue1643370] recursive urlparse

2010-07-01 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I'm not sure that I care about 2.3 compatibility anymore (I was the one who 
made the rule about 2.3 compatibility and made sure that it was just a 
preference, not an absolute rule -- as time goes on, it is of less and less 
value).  ISTM, 2.5 compatible is probably good enough.

--

___
Python tracker 

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



[issue1643370] recursive urlparse

2010-07-01 Thread R. David Murray

R. David Murray  added the comment:

Anatoly, when I said I was closing the issue for lack of interest, I meant that 
you had not produced a candidate patch, and no one else had shown any interest 
in creating one.  If you wish to produce a candidate patch we can reopen the 
issue (though I do think a full blow URI/IRI module would be better).

--

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Mark Dickinson

Mark Dickinson  added the comment:

> ISTM, 2.5 compatible is probably good enough.

Okay;  that's fine with me.  Now we can finally turn that "from_float = 
classmethod(from_float)" into a proper "@classmethod" decorator.  :)

I also don't think that the 2.x-to-3.x maintenance issue is that big a deal any 
more;  it would be surprising if the 2.x version of Decimal sees anything more 
than minor changes (doc fixes, etc.) from this point on.  So perhaps the 3.x 
version of the decimal module should be free to make full use of 3.x syntax?

--

___
Python tracker 

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



[issue9138] Tutorial: classes intro paragraph icky

2010-07-01 Thread Aahz

New submission from Aahz :

http://docs.python.org/dev/tutorial/classes.html

Chapter 9 of the Tutorial contains this intro paragraph:

Python's class mechanism adds classes to the language with a minimum
of new syntax and semantics. It is a mixture of the class mechanisms
found in C++ and Modula-3. As is true for modules, classes in Python
do not put an absolute barrier between definition and user, but
rather rely on the politeness of the user not to "break into the
definition." The most important features of classes are retained with
full power, however:  the class inheritance mechanism allows multiple
base classes, a derived class can override any methods of its base
class or classes, and a method can call the method of a base class
with the same name.  Objects can contain an arbitrary amount of data.

A coworker found particularly the third sentence incomprehensible, and
even with ten years of Python under my belt, I can't say that it makes
much more sense to me.  I know what it must be trying to say and
therefore proffer this suggested rewrite:

Compared with other programming languages, Python's class mechanism
adds classes with a minimum of new syntax and semantics.  It is a
mixture of the class mechanisms found in C++ and Modula-3.  Python
classes provide all the standard features of Object Oriented
Programming: the class inheritance mechanism allows multiple base
classes, a derived class can override any methods of its base class
or classes, and a method can call the method of a base class with the
same name.  Objects can contain arbitrary amounts and kinds of data.
As is true for modules, classes partake of the dynamic nature of
Python; users of a class can modify or break the class definition
even without changing the source code.

--
assignee: d...@python
components: Documentation
messages: 109080
nosy: aahz, d...@python
priority: critical
severity: normal
stage: patch review
status: open
title: Tutorial: classes intro paragraph icky
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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Yuv Gre

Yuv Gre  added the comment:

Now that we're on the subject of "from_float", I just recalled this slight
issue:

Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import decimal
>>> x = decimal.Decimal()
>>> decimal.Decimal.from_float(x)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python31\lib\decimal.py", line 687, in from_float
n, d = abs(f).as_integer_ratio()
AttributeError: 'Decimal' object has no attribute 'as_integer_ratio'
>>>

It seems from_float doesn't like it when a Decimal arrives. Personally, I
think there should be an idiomatic way of saying "this number must be a
Decimal" without an "isinstance".

Should I open another ticket?

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

___
Python tracker 

___Now that we're on the subject of "from_float", I 
just recalled this slight issue:Python 3.1.2 
(r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on
win32Type "help", "copyright", 
"credits" or "license" for more 
information.>> import 
decimal>>> x = decimal.Decimal()
>>> decimal.Decimal.from_float(x)Traceback (most 
recent call last):  File "", line 1, in 
  File "C:\Python31\lib\decimal.py", line 
687, in from_float
    n, d = abs(f).as_integer_ratio()AttributeError: 
'Decimal' object has no attribute 
'as_integer_ratio'>>>It
 seems from_float doesn't like it when a Decimal arrives. Personally, I 
think there should be an idiomatic way of saying "this number must be a 
Decimal" without an "isinstance".
Should I open another ticket?
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9104] test_exceptions does not test pickling with pickle.py

2010-07-01 Thread R. David Murray

R. David Murray  added the comment:

If not in test.support, then where?  Unless there's some reason for user code 
or other implementations (or stdlib code itself) to access that map, it seems 
to me that test.support is exactly where it belongs.

Generic test support (that isn't specific to Python/stdlib testing) should go 
in unittest (and yes there is stuff currently in test.support that should move 
to unittest after suitable improvement and discussion...there's an issue about 
that.)

--

___
Python tracker 

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



[issue9138] Tutorial: classes intro paragraph icky

2010-07-01 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

+1 on the new wording.

Nits:

* Since many OOP languages don't support multiple inheritance, I don't think we 
can call multiple inheritance one of the "standard features of Object Oriented 
Programming". 

* Eventhough the wording is an improvement, I don't see how this could be 
prioritized as "critical".

--
nosy: +rhettinger

___
Python tracker 

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



[issue9138] Tutorial: classes intro paragraph icky

2010-07-01 Thread anatoly techtonik

anatoly techtonik  added the comment:

Much better definition. I stripped it down a little to avoid
"mechanism" repetition.

   Compared with other programming languages, Python provides
   object oriented approach with a minimum of new syntax and semantics.
   Its class mechanism is a mixture of concepts found in C++ and Modula-3.
   Python classes can be inherited from multiple base classes, a derived
   class can override any methods of its base class or classes, and a
   method can call the method of a base class with the
   same name.  Objects can contain arbitrary amounts and kinds of data.
   As is true for modules, classes partake of the dynamic nature of
   Python; users of a class can modify or break the class definition
   even without changing the source code.

However, the sentence about arbitrary amounts and kinds of data seems
strange to me. I would like to see it like "In comparison to XXX where
there is limitation that YYY Python objects can contain arbitrary
amounts and kinds of data."

"users of a class can modify or break the class definition even
without changing the source code." doesn't sound right to me. How can
I *break* the class definition? Maybe it was meant to

   The dynamic nature of Python allows new classes to be defined and
   existing classes modified at run-time.

--
nosy: +techtonik

___
Python tracker 

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



[issue5673] Add timeout option to subprocess.Popen

2010-07-01 Thread Dave Malcolm

Dave Malcolm  added the comment:

The patch has bitrotted somewhat; I've had a go at reworking it so it applies 
against the latest version of trunk (r82429).

All tests pass (or are skipped) on this x86_64 Linux box --with-pydebug (Fedora 
13)

There are still some TODOs in the code:

Popen.wait():
  # TODO(rnk): Test this on Windows.

Popen._communicate():
# TODO: Somebody needs to research what happens to those
# threads if they are still running.  Also, what happens if
# you close a file descriptor on Windows in one thread?
# Will it interrupt the other, or does the other keep its
# own handle?

--
nosy: +dmalcolm
Added file: http://bugs.python.org/file17832/subprocess-timeout-v3.patch

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-07-01 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> I also don't think that the 2.x-to-3.x maintenance issue 
> is that big a deal any more;  it would be surprising if 
> the 2.x version of Decimal sees anything more than minor 
> changes (doc fixes, etc.) from this point on.  So perhaps 
> the 3.x version of the decimal module should be free to 
> make full use of 3.x syntax?

I would like to still leave us at 2.5 compatible.
The internal comments promise that spec updates
will be treated as bug fixes.  This is all the
more likely if 2.7 is the last, but long lived
version in the 2.x series.

Besides, I don't think the set comprehension
notation was a big win in readability over
what is there now :-)

--

___
Python tracker 

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



[issue9139] Add examples for str.format()

2010-07-01 Thread Ezio Melotti

New submission from Ezio Melotti :

The attached patch adds a section with examples about str.format() after 
http://docs.python.org/library/string.html#format-specification-mini-language .
The patch needs some small improvements:
  1) the examples in the previous sections could be removed and/or a link to 
the new section could be added;
  2) the last example could be improved;
  3) another example using custom formats (e.g. for datetime) should be added;

I'd like to have this in 2.7 (Benjamin said it's OK), please review.

--
assignee: ezio.melotti
components: Documentation
files: issue9139.diff
keywords: patch
messages: 109087
nosy: benjamin.peterson, eric.smith, ezio.melotti
priority: high
severity: normal
stage: patch review
status: open
title: Add examples for str.format()
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17833/issue9139.diff

___
Python tracker 

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



[issue1596321] KeyError at exit after 'import threading' in other thread

2010-07-01 Thread Craig McQueen

Craig McQueen  added the comment:

A follow-on re the cx_Freeze issue: I looked at the source code, and found it 
doesn't seem to be doing any thread creation. But I found that in the 
initscripts/Console.py, there are the following lines:

if sys.version_info[:2] >= (2, 5):
module = sys.modules.get("threading")
if module is not None:
module._shutdown()

If these lines are commented-out, then the error message at exit does not occur.

--

___
Python tracker 

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



[issue9140] SocketServer.BaseRequestHandler not a new-style class?

2010-07-01 Thread Peter Froehlich

New submission from Peter Froehlich :

I tried to do this:

class Handler(SimpleHTTPRequestHandler):
  def do_GET(self):
super(Handler, self).do_GET()
print self.path

However super fails:

TypeError: super() argument 1 must be type, not classobj

Looking up the chain of base classes, I found that 
SocketServer.BaseRequestHandler is defined as follows:

class BaseRequestHandler:

No "(object)" there to make it a new-style class. I think that's wrong? BTW, in 
the 3.1 library it's defined the same way, but I'd assume that all classes are 
"new-style" in 3.1?

--
components: Library (Lib)
messages: 109089
nosy: phf
priority: normal
severity: normal
status: open
title: SocketServer.BaseRequestHandler not a new-style class?
type: behavior
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