[issue2602] importing gtk hangs (freebsd 7.0)

2008-04-09 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

You should report this to the FreeBSD team, because I think importing
gtk works on most platforms. Also, gtk is not part of the Python
standard library, and since it's a very large package I doubt people
here are wanting to debug it.

Of course, if it is indeed a bug in the Python interpreter (rather than
in the FreeBSD package or the gtk package), it is fine to report it
here. :-)

--
nosy: +pitrou

__
Tracker <[EMAIL PROTECTED]>

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



[issue2523] binary buffered reading is quadratic

2008-04-09 Thread Antoine Pitrou

Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

By the way, a simple way to fix it would be to use a native BytesIO
object (as provided by Alexandre's patch in #1751) rather than a str
object for the underlying buffer.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1751] Fast BytesIO implementation + misc changes

2008-04-09 Thread Antoine Pitrou

Changes by Antoine Pitrou <[EMAIL PROTECTED]>:


--
type:  -> performance

__
Tracker <[EMAIL PROTECTED]>

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



[issue2602] importing gtk hangs (freebsd 7.0)

2008-04-09 Thread Taavi Repän

New submission from Taavi Repän <[EMAIL PROTECTED]>:

Python 2.5.3a0 (release25-maint:62241, Apr  9 2008, 11:26:27) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>> import gtk
[hangs here]

--
files: backtrace
messages: 65233
nosy: trepan
severity: normal
status: open
title: importing gtk hangs (freebsd 7.0)
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file9991/backtrace

__
Tracker <[EMAIL PROTECTED]>

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



[issue2541] Unicode escape sequences not parsed in raw strings.

2008-04-09 Thread Marc-Andre Lemburg

Marc-Andre Lemburg <[EMAIL PROTECTED]> added the comment:

While that's true for cPickle, it is not for pickle. The pickle protocol
itself is defined in terms of the "raw-unicode-escape" codec (see
pickle.py).

Besides, you cannot assume that the Python interpreter itself is the
only use-case for these codecs. The "raw-unicode-escape" codec is well
usable for other purposes where you need a compact way of encoding
Unicode, especially if you're strings are mostly Latin-1 and only
include non-UCS2 code points every now and then. That's also the reason
why pickle uses it.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

I agree that PySSL_SSLread should check that its argument is >= 0.  I 
don't think this check belongs to PyString_FromStringAndSize.   It 
should be the responsibility of the caller to verify that the 
precondition size >= 0 is satisfied before calling PyString_FromStringAndSize.  
Oftentimes the caller can ascertain size >= 
0 without an explicit check, for example, if size is the size of a 
buffer or length of a valid string object.

On the other hand, an external input such as the len argument to the 
read function should be checked before used.

I would also suggest changing the len type from int to Py_ssize_t.

I agree with Amaury that assert(size>=0) is sufficient in 
PyString_FromStringAndSize(), but its documentation should emphasize 
that the caller is responsible for assuring that the requested length is  
nonnegative.

I don't think the upper bound check is necessary: sizeof(PyStringObject) 
+ size will not wrap around as long as size >= 0.

--
nosy: +belopolsky

__
Tracker <[EMAIL PROTECTED]>

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



[issue2602] importing gtk hangs (freebsd 7.0)

2008-04-09 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

I'm going to close this, since it is probably a gtk or FreeBSD problem.
Please report if this it not so.

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue2585] urllib2.HTTPError broken due to urllib.addinfourl changes

2008-04-09 Thread Guilherme Polo

Guilherme Polo <[EMAIL PROTECTED]> added the comment:

It seems the fix is just passing code to addinfourl __init__, not sure
if someone forgot this or this is just totally wrong.

Patch added.

--
keywords: +patch
nosy: +gpolo
Added file: http://bugs.python.org/file9992/urllib2_2585.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2578] Figure out what to do with unittest's redundant APIs

2008-04-09 Thread Guido van Rossum

Guido van Rossum <[EMAIL PROTECTED]> added the comment:

>  Steve Purcell <[EMAIL PROTECTED]> added the comment:
>  Hey, I'm open to anything.  If I started writing unittest from scratch
>  knowing what I know now, I'd probably have kept the API a little
>  slimmer.  Oh, and I'd have named everthing according to Python
>  conventions; my deepest and belated apologies for that.

I think the current consensus is to start trimming the API in 3.1. We
could start documenting best practices in 2.6 and 3.0 though.

>  I think the design has held up pretty well, even if it's arguably not
>  the most pythonic.  Its familiarity to users of other xUnit frameworks
>  really does help new Pythoneers start writing tests immediately.

Though I wonder how common that use case is. Not all new Pythoneers
come from Java, you know... Many come from Perl, PHP, even C++, and
more and more come from not programming at all before.

>  And as
>  for the TestLoader stuff, it looks (and perhaps is) a bit overblown, but
>  I can't count the number of times people have asked me how to do obscure
>  or unusual things with the module and I've been able to respond with
>  something like, "just write a custom TestLoader/TestRunner".

I hope we can add more custom TestLoader/TestRunner subclasses for
some of the *common* use cases.

>  I don't intend to take unittest in any particular direction; truth be
>  told, I'm now only an occasional visitor to the land of Python, and I
>  don't think I've had commit rights since the move to subversion.  My
>  continued involvement with the unittest tickets is mainly to help
>  provide input along the lines of "we discussed this years ago, and
>  decided against it / thought it would be great".  Far be it from me to
>  stand in the way of progress -- I'd be happy to see unittest re-worked
>  in any way that makes sense.

And thanks for your continued involvement! I think the clue the
developer community can take from this is not to worry too much about
changing the original design; you don't seem to have a strong sense of
"ownership", which (in this case) sounds good to me.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Justin Ferguson

Justin Ferguson <[EMAIL PROTECTED]> added the comment:

While I think its a mistake that will cause security concerns in Python
for quite some time to come, thats fair enough.

I will refile all the places that this messes up individually

__
Tracker <[EMAIL PROTECTED]>

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



[issue2588] PyOS_vsnprintf() underflow leads to memory corruption

2008-04-09 Thread Justin Ferguson

Justin Ferguson <[EMAIL PROTECTED]> added the comment:

Actually, I'm not sure things are any better today- even the same
operating system but different versions have inconsistencies, for
instance on some versions of RHEL the vsnprintf() can fail during
unicode conversion. MSVCRT still returns -1 on truncation, et cetera.

That said, theres plenty of other implementations that manage this
without the potential of underflowing a buffer

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Justin Ferguson

Justin Ferguson <[EMAIL PROTECTED]> added the comment:

Do I need to create proof of concepts for each of these bugs, or can I
reference this ticket?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2578] Figure out what to do with unittest's redundant APIs

2008-04-09 Thread Steve Purcell

Steve Purcell <[EMAIL PROTECTED]> added the comment:

Hey, I came to Python from Perl, Java *and* C++!  I'm pretty sure the 
xUnits in all those other languages hold to the same basic API.

Adding more TestLoaders/TestRunners sounds like an excellent move.  I'd 
expect that once those common conveniences have been provided for, the 
core TestSuite/TestCase scheme will continue to be helpful.

I could certainly envisage the provision of convenience decorators that 
would remove some of the typical subclassing boilerplate  by 
transforming plain functions into TestCases.

I was recently sent a fun paper describing a mechanism for transforming 
doctests into 'unittest' tests, so there's obviously a lot of scope for 
fun additions and changes.

I'll be interested to see what people come up with, and to help a little 
if and when I can.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2579] Misleading 'toctree references unknown document' error

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Thanks, fixed in r62245.

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue2588] PyOS_vsnprintf() underflow leads to memory corruption

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

On Wed, Apr 9, 2008 at 1:16 PM, Justin Ferguson <[EMAIL PROTECTED]> wrote:
..
>  That said, theres plenty of other implementations that manage this
>  without the potential of underflowing a buffer
>

Do you have in mind something like the following?

===
--- Python/mysnprintf.c (revision 62211)
+++ Python/mysnprintf.c (working copy)
@@ -88,6 +88,7 @@
PyMem_FREE(buffer);
 Done:
 #endif
-   str[size-1] = '\0';
+   if (size > 0)
+   str[size-1] = '\0';
return len;
 }

I would be +0 on such change.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1184112] Missing trailing newline with comment raises SyntaxError

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

The exec example still presents me a syntax error in 2.5.2.

_
Tracker <[EMAIL PROTECTED]>

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



[issue2585] urllib2.HTTPError broken due to urllib.addinfourl changes

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Thanks Guilherme, that is indeed a detail that I forgot. Fixed in r62246.

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1745] Backport of PEP 3102 "keyword-only arguments" to 2.6

2008-04-09 Thread Eric Smith

Eric Smith <[EMAIL PROTECTED]> added the comment:

The patch doesn't apply cleanly for me.  I can fix the non-clean patch,
but another error is that obj2ast_arguments doesn't call arguments()
with the correct parameters.  If I pass in NULL's for the new params,
all tests pass, but that just tells me it's not being tested thoroughly.

I'll spend some time looking at it, but if anyone else wants to look at
it, go ahead.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2530] Document IO module

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Reviewed, changed a few things and committed as r62252. Thanks!

--
resolution:  -> accepted
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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



[issue2580] Revise builtin class int library manual entry

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Committed as r62253. Thanks!

--
resolution:  -> accepted
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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



[issue2575] Reference manual: production for integer literals is missing "bininteger"

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Thanks, fixed in r62254.

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue2588] PyOS_vsnprintf() underflow leads to memory corruption

2008-04-09 Thread Justin Ferguson

Justin Ferguson <[EMAIL PROTECTED]> added the comment:

Yep, that works for me.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

agreed, the assert in PyString_FromStringAndSize() should be changed to
a non-debug test.

--
nosy: +gregory.p.smith

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Gregory P. Smith

Changes by Gregory P. Smith <[EMAIL PROTECTED]>:


--
priority:  -> high
versions: +Python 2.6

__
Tracker <[EMAIL PROTECTED]>

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



[issue2568] Seconds range in time unit

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Isn't the bug here rather that strptime doesn't allow leap seconds?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2513] 64bit cross compilation on windows

2008-04-09 Thread Martin v. Löwis

Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

> Martin - my patch creates a new executable in Lib\distutils\command, and
> IMO it should be included in binary builds for all windows platforms. 
> Is there something I should change in the MSI process?

Yes, I fixed that in r62255: it now packages wininst*.exe from that
directory.

Regards,
Martin

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

On Wed, Apr 9, 2008 at 1:20 PM, Justin Ferguson <[EMAIL PROTECTED]> wrote:
..
>  Do I need to create proof of concepts for each of these bugs, or can I
>  reference this ticket?
>

It would be best if you could provide a patch complete with additional
unit tests that fail in (or crash) unpatched python and demonstrate
the bugs.  Since the fixes are likely to be one-line changes, I would
say there is no need to create separate issues.  Just post a patch
here for а review.

From your other post, I understand that you are doing a security audit
of the python codebase.  Is this a manual effort (identifying unsafe
constructs and searching for them) or you use some kind of automation?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2221] Py30a3: eval in threaded code raises SystemError

2008-04-09 Thread Kurt B. Kaiser

Kurt B. Kaiser <[EMAIL PROTECTED]> added the comment:

PyObject_CallMethod is actually returning a
non-NULL result for sys.std{out,err}, and 
PyErr_Clear() isn't being run in flush_io.

The problem is deeper.  PyErr is being
used during unexceptional processing in
typeobject.c:slot_tp_getattr_hook() to
indicate that PyObject_GenericGetAttr() failed
and the __getattr__ method (used in IDLE) 
should be called.

Perhaps PyErr should be preserved in
slot_tp_getattr_hook(), instead.  Is this 
possibly a potential 2.6 issue for some uses
of getattr?  Or is the current solution 'good 
enough'?

ref issue1400.

--
nosy: +gvanrossum

__
Tracker <[EMAIL PROTECTED]>

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



[issue1297] pyconfig.h not compatible with MS VC++ Express Edition

2008-04-09 Thread Martin v. Löwis

Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

> Amaury: The file python.hpp, thus basetsd.h, is used by boost-python.

I don't think that was the question. Instead, the question was: why
is basetsd.h needed in the first place, when compiling Python?

Apparently, basetsd was added in r15912. Fred, can you remember what
the rationale was?

--
nosy: +fdrake

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Justin Ferguson

Justin Ferguson <[EMAIL PROTECTED]> added the comment:

Okay, so I'm not sure whose point of view takes precedence here?

Also, to answer the question asked, I'm doing this manually.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2601] [regression] reading from a urllib2 file descriptor happens byte-at-a-time

2008-04-09 Thread Georg Brandl

Changes by Georg Brandl <[EMAIL PROTECTED]>:


--
priority: high -> critical

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

On Wed, Apr 9, 2008 at 3:08 PM, Justin Ferguson <[EMAIL PROTECTED]> wrote:

>  Okay, so I'm not sure whose point of view takes precedence here?

I don't have a strong view on this, but just a few points to consider:

1. If you change PyString_FromStringAndSize, you should change
PyBytes_FromStringAndSize and PyUnicode_FromStringAndSize for
consistency.

2. Non-debug check should probably set a ValueError exception and
return NULL.  Think what kind of message you can generate inside
*_FromStringAndSize that would be helpful to the end user.  The caller
is likely to be able to provide a much better diagnostic.

3. Maybe instead of setting a ValueError, a SystemError should be
raised.  In this case the calle will still be clearly responsible for
the pre-condition, but programming errors will not present security
concerns.

4. You have clearly identified several bugs that are not covered by
unittests.  If you fix them en-mass by making
PyString_FromStringAndSize more forgiving, we will miss an opportunity
to improve the test coverage. (If you take the SystemError approach,
this does not apply.)

__
Tracker <[EMAIL PROTECTED]>

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



[issue2568] Seconds range in time unit

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

On Wed, Apr 9, 2008 at 2:49 PM, Georg Brandl <[EMAIL PROTECTED]> wrote:

>  Isn't the bug here rather that strptime doesn't allow leap seconds?

This is not specific to strptime.  The datetime module does not allow
leap seconds:

Traceback (most recent call last):
  File "", line 1, in 
ValueError: second must be in 0..59

This is intentional and documented. Or maybe I don't understand your question.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Justin Ferguson

Justin Ferguson <[EMAIL PROTECTED]> added the comment:

> 1. If you change PyString_FromStringAndSize, you should change
> PyBytes_FromStringAndSize and PyUnicode_FromStringAndSize for
> consistency.

Okay, if we don't patch the API call itself, I will look at the users of
those two API calls as well, I haven't gone through much of the stuff in
Objects/ yet, I focused on the modules obviously and thus didn't know
about those calls.

> 4. You have clearly identified several bugs that are not covered by
> unittests.  If you fix them en-mass by making
> PyString_FromStringAndSize more forgiving, we will miss an opportunity
> to improve the test coverage. (If you take the SystemError approach,
> this does not apply.)

This is a valid and good point-- I don't mind either way

__
Tracker <[EMAIL PROTECTED]>

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



[issue2599] allow field_name in format strings to default to next positional argument (e.g., "{}")

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

Omitting the ordinals from {} format units will present a problem with
internationalization because the arguments may need to be rendered in
different order in different languages.  This is a frequent problem with
the % formats and it is a good thing that the new format requires
explicit enumeration.  If your argument list grows to the big enough
size that renumbering presents a problem, you should consider using
named rather than positional arguments.

This type of changes should be discussed on python-ideas list first.

--
nosy: +belopolsky

__
Tracker <[EMAIL PROTECTED]>

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



[issue2598] "{ +(}".format(**{' +(': 44}) should produce ValueError: invalid identifier, ' +(' in format

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

This is a feature explained in PEP 3101:

"""
Implementation note: The implementation of this proposal is
not required to enforce the rule about a simple or dotted name
being a valid Python identifier.  Instead, it will rely on the
getattr function of the underlying object to throw an exception if
the identifier is not legal.  The str.format() function will have
a minimalist parser which only attempts to figure out when it is
"done" with an identifier (by finding a '.' or a ']', or '}',
etc.).
""" 


Why is that a problem for you?

--
nosy: +belopolsky

__
Tracker <[EMAIL PROTECTED]>

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



[issue2603] Make range __eq__ work

2008-04-09 Thread Benjamin Peterson

New submission from Benjamin Peterson <[EMAIL PROTECTED]>:

This patch makes this work:
>>> range(4) == range(4)
True

This is in similar fashion to dict.keys
>>> {1:2}.keys() == {1:2}.keys()
True

Tests included.

--
components: Interpreter Core
files: range_eq.patch
keywords: patch
messages: 65266
nosy: benjamin.peterson
severity: normal
status: open
title: Make range __eq__ work
type: feature request
versions: Python 3.0
Added file: http://bugs.python.org/file9993/range_eq.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue2530] Document IO module

2008-04-09 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

Georg, I have a few questions:
Just out of curiosity, what did you change? Are their markup things I
missed or other things you're looking for that I just didn't get?

Are we going to want to push some of this stuff back into the docstrings?

Should I backport this to 2.6?

Mark: It has been checked in.

--
nosy: +mark

__
Tracker <[EMAIL PROTECTED]>

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



[issue2603] Make range __eq__ work

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

Your patch does not check the return values of PyObject_RichCompare
calls for NULL.  This is probably ok given the current restrictions on
the type of start/step/stop, but adding the null checks will make the
code more robust.

--
nosy: +belopolsky

__
Tracker <[EMAIL PROTECTED]>

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



[issue2603] Make range __eq__ work

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

I have no opinion whether the patch should go in, but in any case:

* You should use PyObject_RichCompareBool.
* You should error-check the returns of those.

--
nosy: +georg.brandl

__
Tracker <[EMAIL PROTECTED]>

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



[issue2603] Make range __eq__ work

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Ah yes, and variable declarations must be at the start of a block, else
MSVC (and possible other compilers) will complain.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2530] Document IO module

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Other than the "class.method" change you already noticed, I changed some
"method"s to "attribute"s (since they are @propertied in the source),
removed parens in :meth:`` roles, moved the constructor description into
the .. class block and did some spelling corrections.

A backport to 2.6 would be great. If you also find time to put some
docstrings in, very good.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2568] Seconds range in time unit

2008-04-09 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Okay, sorry that I made uninformed guesses :)

__
Tracker <[EMAIL PROTECTED]>

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



[issue2568] Seconds range in time unit

2008-04-09 Thread Georg Brandl

Changes by Georg Brandl <[EMAIL PROTECTED]>:


--
assignee: georg.brandl -> 

__
Tracker <[EMAIL PROTECTED]>

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



[issue2603] Make range __eq__ work

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

Actually, the patch contains an exploitable bug:

$ cat x.py
class X(int):
def __eq__(self, other):
raise ValueError

x = range(X(1),X(10),X(1))
x == x

$ ./python x.py
Segmentation fault (core dumped)

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

I think I like the SystemError approach for the same reasons.  It still
exposes the caller's bug but no longer does bad things.

Added file: http://bugs.python.org/file9994/unnamed

__
Tracker <[EMAIL PROTECTED]>

__I think I like the SystemError approach for the same reasons.  It still 
exposes the caller's bug but no longer does bad things.
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2256] Install failure of 2.6a1 on Windows XP without VS8 installed

2008-04-09 Thread Jim Kleckner

Jim Kleckner <[EMAIL PROTECTED]> added the comment:

Ping.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Guido van Rossum

Guido van Rossum <[EMAIL PROTECTED]> added the comment:

Cool. Let's make this a SystemError (in both debug builds and non-debug
build). Greg, go ahead and fix it.

--
nosy: +gvanrossum

__
Tracker <[EMAIL PROTECTED]>

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



[issue2256] Install failure of 2.6a1 on Windows XP without VS8 installed

2008-04-09 Thread Jim Kleckner

Jim Kleckner <[EMAIL PROTECTED]> added the comment:

It appears that issue2563 may be a dependency.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2603] Make range __eq__ work

2008-04-09 Thread Alexander Belopolsky

Alexander Belopolsky <[EMAIL PROTECTED]> added the comment:

On Wed, Apr 9, 2008 at 6:08 PM, Georg Brandl <[EMAIL PROTECTED]> wrote:

>  Ah yes, and variable declarations must be at the start of a block

You can avoid the need for extra local variables by declaring
range_richcompare arguments as rangeobject* and casting the function
to richcmpfunc in type initialization.  See for example
weakrefobject.c implementation.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Gregory P. Smith

Changes by Gregory P. Smith <[EMAIL PROTECTED]>:


--
assignee:  -> gregory.p.smith

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Gregory P. Smith

Changes by Gregory P. Smith <[EMAIL PROTECTED]>:


Removed file: http://bugs.python.org/file9994/unnamed

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

python trunk r62261 adds the checks and SystemError.

patches to cleanup modules that inadvertently allow negative values to
be passed into *_FromStringAndSize would still be appreciated.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1049] socket.socket.getsockname() has inconsistent UNIX/Windows behavior

2008-04-09 Thread Bill Janssen

Bill Janssen <[EMAIL PROTECTED]> added the comment:

Here's what the OS X man page says:

The getsockname() function returns the value 0 if successful; otherwise
the value -1 is returned and the global variable errno is set to
indicate the error.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Gregory P. Smith

Gregory P. Smith <[EMAIL PROTECTED]> added the comment:

release25-maint r62262

I'm closing this one.  Please open additional issues with patches and/or
pointers to bad callers of *_FromStringAndSize that let negative values
through.

[*sigh* i wish we didn't use a signed size type all over the place]

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue2587] PyString_FromStringAndSize() to be considered unsafe

2008-04-09 Thread Guido van Rossum

Guido van Rossum <[EMAIL PROTECTED]> added the comment:

>  [*sigh* i wish we didn't use a signed size type all over the place]

What would you use for error returns then?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2603] Make range __eq__ work

2008-04-09 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

Thanks for the help.

Added file: http://bugs.python.org/file9995/range_eq2.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue2530] Document IO module

2008-04-09 Thread Benjamin Peterson

Benjamin Peterson <[EMAIL PROTECTED]> added the comment:

When you remove the class from the method declaration, it shows up in
the html as io.write? Is this correct?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2604] doctest.DocTestCase fails when run repeatedly

2008-04-09 Thread Piet Delport

New submission from Piet Delport <[EMAIL PROTECTED]>:

DocTestCase.tearDown destructively clears its DocTest instance's globs,
preventing the test from being run repeatedly (such as with trial
--until-failure).

There's a fix for this in zope.testing's version of doctest, which
resets the globs instead:

http://svn.zope.org/?view=rev&rev=39023

--
components: Library (Lib)
messages: 65285
nosy: pjd
severity: normal
status: open
title: doctest.DocTestCase fails when run repeatedly
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue2604] doctest.DocTestCase fails when run repeatedly

2008-04-09 Thread Piet Delport

Piet Delport <[EMAIL PROTECTED]> added the comment:

Addendum:  This appears to be a regression in r36809 (Python 2.4+).

__
Tracker <[EMAIL PROTECTED]>

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



[issue2256] Install failure of 2.6a1 on Windows XP without VS8 installed

2008-04-09 Thread Martin v. Löwis

Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

> Ping.

Does the problem still exist in 2.6a2? It shouldn't.

__
Tracker <[EMAIL PROTECTED]>

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