[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

What about requiring maxsize to be convertible to an int?
This would allow dynamic objects, if they define an __int__ method.
I join a patch.

--
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file9473/queue_maxsize_2.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2127] sqlite3 docs should mention utf8 requirement

2008-02-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

IMO, connect() should accept unicode strings, and encode them to utf-8
when calling the C function.
Patch attached.

--
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file9474/sqlite_connect.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2150] Broken Link to New Style Classes Documentation

2008-02-21 Thread Neil Roques

New submission from Neil Roques:

http://docs.python.org/ref/node33.html (also packaged in the Python
documentation which comes with Python) links to:

http://www.python.org/doc/newstyle.html for information on new style classes

However, this link has moved, as should now read:

http://www.python.org/doc/newstyle/

--
components: Documentation
messages: 62612
nosy: passage
severity: normal
status: open
title: Broken Link to New Style Classes Documentation
type: behavior
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



[issue2151] no way to get http result status from urllib

2008-02-21 Thread paul rubin

New submission from paul rubin:

I don't see any way in the docs to get the status of an http request, in
particular I want to know whether it's a 404.  It does show up in the
guts of the library so maybe I can extract it somehow, but there should
be a simple documented way.

Also, the urllib doc says the info() method returns a mimetools.Message
instance, but what actually comes back is an httplib.HTTPMessage
instance.  I guess that's a subclass, but it's confusing.  The doc
should describe what actually comes back.

--
components: Library (Lib)
messages: 62613
nosy: phr
severity: normal
status: open
title: no way to get http result status from urllib
type: feature request
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



[issue2129] Link error of gethostbyaddr and gethostname in Python Manuals (the chm file)

2008-02-21 Thread Martin v. Löwis

Martin v. Löwis added the comment:

That's difficult to fix. Notice that this page does reference
gethostbyaddr (in the uname documentation), and that the online HTML
version links to both the socket and the os modules. Apparently, the CHM
generation picks up the first link.

--
nosy: +loewis

__
Tracker <[EMAIL PROTECTED]>

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



[issue2152] make sqlite.Row hashable correctly

2008-02-21 Thread Thomas Heller

New submission from Thomas Heller:

The attached patch implements hash and cmp for sqlite3.Row objects.

--
files: sqliterow.patch
keywords: patch
messages: 62615
nosy: theller
severity: normal
status: open
title: make sqlite.Row hashable correctly
type: behavior
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file9475/sqliterow.patch

__
Tracker <[EMAIL PROTECTED]>

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



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

2008-02-21 Thread Rafael Zanella

Rafael Zanella added the comment:

FWIW, using xrange() it seems to give the proper error message:

Traceback (most recent call last):
  File "bad_range.py", line 12, in 
print xrange(MyInt(2**64), MyInt(2**64+10))
OverflowError: long int too large to convert to int

--
nosy: +zanella

__
Tracker <[EMAIL PROTECTED]>

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



[issue1621] Do not assume signed integer overflow behavior

2008-02-21 Thread Ismail Donmez

Ismail Donmez added the comment:

Any news on this? Also gcc 4.3 & gcc 4.2.3 fixed the -Wall clobbering -
Wstrict-overflow problem, which is good news.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2079] UserDict documentation typo

2008-02-21 Thread Jeroen Ruigrok van der Werven

Jeroen Ruigrok van der Werven added the comment:

Patch for against 2.6 trunk @ r60910.

--
nosy: +asmodai
Added file: http://bugs.python.org/file9476/userdict.rst.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2079] UserDict documentation typo

2008-02-21 Thread Jeroen Ruigrok van der Werven

Jeroen Ruigrok van der Werven added the comment:

Patch against 2.5 trunk @ r60911.

Added file: http://bugs.python.org/file9477/libuserdict.tex.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Rafael Zanella

Rafael Zanella added the comment:

@gutworth: Since one of the main uses of Queue is with threads, I think
it *really* should acquire the mutex before changing the maxsize;

@amaury.forgeotdarc: Your patch makes the point of allowing the size to
be changed at some other place (e.g.: an attribute of an instance passed
as the maxsize), but as stated above I think (am not an expert) the
mutex really should be held before the maxsize change, another point:
using an instance on your patch a call to Queue.maxsize would return
something like:
"""
Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class C:
...   def __init(self): self.n = 1;
...   def __int__(self): return int(self.n);
...
>>> c = C()
>>> import Queue
>>> q = Queue.Queue(c)
>>> q.maxsize
<__main__.C instance at 0xb7c341ac>
>>>
"""
wich would force to have a get() to the maxsize attribute;

I have added a diff;

Added file: http://bugs.python.org/file9478/queue_maxsize_3.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2153] unittest.py modernization

2008-02-21 Thread Virgil Dupras

New submission from Virgil Dupras:

What prompted me to do these changes is that "Backward compatibility" 
section for 2.1 and earlier. How long are we going to keep this? According 
to svn, no commit has been made on the 2.1 branch since 2003. Is it safe 
to assume no unittest change is ever going to be backported to 2.1?

Then, while I was in it, I made other changes:

 - dict.has_key(key) --> key in dict
 - raise Exception, args --> raise Exception(args)
 - try..except KeyboardInterrupt: raise except: do_stuff() --> try..except 
Exception: do_stuff()
 - __metaclass__ = type --> all classes are now object subclasses

I'm not sure about the last one. Are those 2 equivalent? Is there a reason 
to keep is as "__metaclass__ = type"?

regrtest passed for me.

--
components: Tests
files: unittest_modern.diff
messages: 62622
nosy: vdupras
severity: minor
status: open
title: unittest.py modernization
type: feature request
versions: Python 2.6
Added file: http://bugs.python.org/file9479/unittest_modern.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I like it.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2154] doc: better detection of python snippets for highliting

2008-02-21 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc:

The new doc framework highlights python code, and looks very nice.
However, some snippets are not parseable by the compiler, and are thus
left unhighlighted. For example:
http://docs.python.org/dev/whatsnew/2.6.html#the-contextlib-module

The vast majority of misses is because of lines containing "...", which
is not a valid expression (except in slices).
The attached patch tries to recognize some common patterns, and replaces
"..." by some valid identifier; "... continue processing ..." is also
transformed. 

Note that the replacements are done only to get a better answer to "is
this block a python code"; pygment still works on the original string.

I checked that all new highlighted blocks are actually python snippets.
(actually, except one in configfile.rst; but others similar blocks on
the same page were already wrongly given to the python lexer)

The patch also corrects some easy syntax errors in samples.

--
components: Documentation, Documentation tools (Sphinx)
files: doc_highlight.patch
keywords: patch
messages: 62623
nosy: amaury.forgeotdarc, georg.brandl
severity: normal
status: open
title: doc: better detection of python snippets for highliting
versions: Python 2.6
Added file: http://bugs.python.org/file9480/doc_highlight.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Rafael Zanella

Rafael Zanella added the comment:

Mine patch doesn't address the "hold the mutex before changing the
maxsize" guess it would then force a get()?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2155] optparse.OptionGroup with_statement context handling

2008-02-21 Thread Michael Hoffman

New submission from Michael Hoffman:

Adding these four lines to optparse.OptionGroup makes using option
groups vastly easier:

def __enter__(self):
return self

def __exit__(self, *exc_info):
self.parser.add_option_group(self)

You can then do things like:

with OptionGroup(parser, "Group name") as group:
group.add_option(...)

--
components: Library (Lib)
messages: 62625
nosy: hoffman
severity: normal
status: open
title: optparse.OptionGroup with_statement context handling
type: feature request

__
Tracker <[EMAIL PROTECTED]>

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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Virgil Dupras

New submission from Virgil Dupras:

I've been using unittest for quite a while. One thing I got tired with is 
the code duplication for file management and mocking. A few months ago I 
created this nifty little TestCase subclass and I've been using it ever 
since. It works quite well.

Am I the only one to extensively use temporary files and mocking in my 
tests? If not, I would suggest integrating my little subclass to 
unittest.Testcase, or if people think these functionalities out-scope 
unittest.TestCase, maybe we could put it in a separate unit.

Here's the unit I have here.

--
components: Tests
files: testcase.py
messages: 62627
nosy: vdupras
severity: minor
status: open
title: TestCase.tmpdir(), TestCase.mock()
type: feature request
versions: Python 2.6
Added file: http://bugs.python.org/file9481/testcase.py

__
Tracker <[EMAIL PROTECTED]>

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



[issue2130] [feature-request] Please add bool data type to "optparse" module

2008-02-21 Thread Michael Hoffman

Michael Hoffman added the comment:

As gpolo points out, this facility already exists. This RFE should be
closed.

--
nosy: +hoffman

__
Tracker <[EMAIL PROTECTED]>

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



[issue2153] unittest.py modernization

2008-02-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

À propos modernizing unittest, may I suggest taking a look at #1034053. :)

--
nosy: +pitrou

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

It's probably best to close this as "won't fix".  Each of the patches 
limits the module or complicates it a bit.  I'm not sure there's even a 
real problem here.  My preference is to leave this code untouched.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Maybe, we should change change the constructor to use self.maxsize =
int(maxsize). Then we can provide a set_maxsize method that will acquire
the mutex and preform the change. This is will restrict the type of
maxsize and allow for easy dynamic changing.

__
Tracker <[EMAIL PROTECTED]>

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



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

2008-02-21 Thread Robert Bradshaw

Robert Bradshaw added the comment:

Yes, the error for xrange is more illustrative of the problem, but just
shows that xrange has this a too. Why should xrange be invalid for
non-word sized values (especially as range works)? Incidentally, just a
week ago I had to write my own iterator for a project because xrange
couldn't handle large values.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Raymond, are you referring to the int checking, my new method, or both?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Both.  There is no issue here worth adding a new method.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Ok. I agree that we shouldn't muddy the waters of Queue by checking for
int. (set_maxsize would be unneeded) Go ahead and close.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Raymond Hettinger

Changes by Raymond Hettinger:


--
resolution:  -> wont fix
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



[issue2149] Queue.maxsize, __init__() accepts any value as maxsize

2008-02-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Recommend closing this.  No need to muck-up a clean module to solve a 
non-problem.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2153] unittest.py modernization

2008-02-21 Thread Benjamin Peterson

Changes by Benjamin Peterson:


--
nosy: +purcell

__
Tracker <[EMAIL PROTECTED]>

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



[issue799428] tk_focusNext() fails

2008-02-21 Thread Russell Owen

Russell Owen added the comment:

The bug still exists. Please assign this bug and patch to Martin Loewis if 
possible (I don't have privileges for that).

--
nosy: +reowen
type:  -> behavior
versions: +Python 2.5 -Python 2.3
Added file: http://bugs.python.org/file9483/Tkinter_patch.txt


Tracker <[EMAIL PROTECTED]>


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



[issue1777134] minidom pretty xml output improvement

2008-02-21 Thread Teajay

Teajay added the comment:

Thanks for the feedback. I looked at the issues you mentionned and tried
to sort that out. You might want to have a look it this new patch. I ran
the tests, added a new test case and hopefully managed to get the code
style right this time :-)

Let me know if there is anything else I need to improve.

Added file: http://bugs.python.org/file9482/minidom_output_improvement.patch

_
Tracker <[EMAIL PROTECTED]>

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



[issue1292] libffi needs an update to support mips64, arm and armeabi on linux

2008-02-21 Thread Thomas Heller

Thomas Heller added the comment:

I'm reopening this.  libffi 3 has been released; I have created the
libffi3-branch for this work in Python svn.

--
status: closed -> open

__
Tracker <[EMAIL PROTECTED]>

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



[issue2127] sqlite3 docs should mention utf8 requirement

2008-02-21 Thread Virgil Dupras

Virgil Dupras added the comment:

Shouldn't we apply this patch directly on pysqlite? Any change made to 
the sqlite3 module will be overwritten in the next "refresh", right? 
Anyway, I'm not 100% sure, but it might already be fixed:

http://www.initd.org/tracker/pysqlite/changeset/452

So, maybe create a ticket to use the latest version of pysqlite?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2157] sqlite numeric type conversion problems

2008-02-21 Thread wrobell

New submission from wrobell:

Numeric type conversion does not always work when using SQLite module.

Let's assume schema:

create table test_num(no numeric);

Fetching a `test_num.no` table gives float by default.

Now, let's register some converter

sqlite3.register_converter('numeric', lambda d: Decimal(d))

Fetching `test_num.no` gives Decimal.

But change `test_num.no` type to `numeric(10, 2)`. Float is returned.
This can be fixed by

sqlite3.register_converter('numeric(10,', lambda d: Decimal(d))

But above will fail for `test_num.no: numeric(10,2)', which works in
case of

sqlite3.register_converter('numeric(10,2)', lambda d: Decimal(d))

SQLite module's cursor object type cast mechanism breaks declared
type after first space {i.e. "numeric(10, 2)" -> "numeric(10,"} and
then looks up registered type converter using the first "word".

The simple fix for above could be to perform the break after space
or "(" character. Patch attached.

--
components: Library (Lib)
files: python-sqlite-numeric.patch
messages: 62640
nosy: wrobell
severity: normal
status: open
title: sqlite numeric type conversion problems
versions: Python 2.5
Added file: http://bugs.python.org/file9484/python-sqlite-numeric.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue2153] unittest.py modernization

2008-02-21 Thread Steve Purcell

Steve Purcell added the comment:

Hi Virgil; thanks for stepping up to this.  Backward compatibility was 
largely for the sake of compatibility with Jython, which was always 
lagging far behind CPython.  I doubt it's a concern these days, and the 
unittest.py in the Python source repository should probably always be 
implemented in the nicest, cleanest way possible with the latest 
CPython.

Your changes look good to me, except for the KeyboardInterrupt one -- 
unless the way Ctrl-C is handled by Python has changed in the last 
couple of years, changing this "except:" clause will stop the text-mode 
test runner from being interruptible.  Admittedly the TextTestRunner 
should somehow be given an opportunity to detect Ctrl-C in order to stop 
when asked, but this diff does not allow for that.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2153] unittest.py modernization

2008-02-21 Thread Virgil Dupras

Virgil Dupras added the comment:

Isn't it why KeyboardInterrupt is a subclass of BaseException instead of 
Exception (along with SystemExit)? so that "except Exception:" doesn't 
catch it?

__
Tracker <[EMAIL PROTECTED]>

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



[issue2158] confusing exception when opening a filename with nonprintable characters

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I can confirm on the trunk with Mac OSX 10.4.

--
nosy: +benjamin.peterson

__
Tracker <[EMAIL PROTECTED]>

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



[issue2158] confusing exception when opening a filename with nonprintable characters

2008-02-21 Thread Benjamin Peterson

Changes by Benjamin Peterson:


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



[issue2153] unittest.py modernization

2008-02-21 Thread Christian Heimes

Christian Heimes added the comment:

All changes are looking fine to me but I haven't looked at the patch so far.

"__metaclass__ = type" is easier to write than subclassing from object.
Both are equivalent. 

>>> __metaclass__ = type
>>> class Foo: pass
...
>>> Foo

>>> Foo.__bases__
(,)
>>> type(Foo)


--
nosy: +tiran

__
Tracker <[EMAIL PROTECTED]>

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



[issue2158] confusing exception when opening a filename with nonprintable characters

2008-02-21 Thread Geoffrey Irving

Geoffrey Irving added the comment:

It works fine for me on Linux as well, and on FreeBSD.  I expect it's
a mac specific bug.

Geoffrey

On Thu, Feb 21, 2008 at 12:00 PM, Christian Heimes
<[EMAIL PROTECTED]> wrote:
> Christian Heimes added the comment:
>
>  I've tried the example with Python 2.6 + 3.0 on Linux and Windows. No
>  errors here.
>
>  --
>  nosy: +tiran
>  priority:  -> normal
>
>
>
>  __
>  Tracker <[EMAIL PROTECTED]>
>  
>  __
>

__
Tracker <[EMAIL PROTECTED]>

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



[issue2129] Link error of gethostbyaddr and gethostname in Python Manuals (the chm file)

2008-02-21 Thread Georg Brandl

Georg Brandl added the comment:

I think you get two links in the CHM generated by Sphinx. Can somebody
with a working HTML Help Compiler check that?

--
assignee:  -> georg.brandl
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



[issue2158] confusing exception when opening a filename with nonprintable characters

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

The problem appears to be that Mac's strerror doesn't return a good
error message. We could try to detect this sort of thing, but I'm not
sure how.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2150] Broken Link to New Style Classes Documentation

2008-02-21 Thread Georg Brandl

Georg Brandl added the comment:

This link has already been fixed in SVN.

--
nosy: +georg.brandl
resolution:  -> out of date
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



[issue2151] no way to get http result status from urllib

2008-02-21 Thread Georg Brandl

Georg Brandl added the comment:

I've committed a patch for this in the trunk, the addinfourl object has
a "code" attribute there.

--
nosy: +georg.brandl
resolution:  -> out of date
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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

The Path class of hs.path is, I assume, a nice wrapper around a file or
directory. However, Python does not have something like this, so it's
probably more useful to just return the raw path.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

First, is hs a company package? You'll most likely want to remove it.

Otherwise, this looks useful. I wonder if this is something we could use
in test.test_support. I'd like it for some of Python's regression tests.
Brett, what do you think about that?

--
nosy: +benjamin.peterson, brett.cannon

__
Tracker <[EMAIL PROTECTED]>

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



[issue2153] unittest.py modernization

2008-02-21 Thread Steve Purcell

Steve Purcell added the comment:

Yes indeed - you're exactly right; just checked now.  Then disregard my 
previous comment!

__
Tracker <[EMAIL PROTECTED]>

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



[issue799428] tk_focusNext() fails

2008-02-21 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
keywords: +patch


Tracker <[EMAIL PROTECTED]>


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



[issue2158] confusing exception when opening a filename with nonprintable characters

2008-02-21 Thread Christian Heimes

Christian Heimes added the comment:

I've tried the example with Python 2.6 + 3.0 on Linux and Windows. No
errors here.

--
nosy: +tiran
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Virgil Dupras

Virgil Dupras added the comment:

Oh, you meant hs.path? ah yeah, it's just for tmppath(), which is of no 
use except in my own stuff.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2158] confusing exception when opening a filename with nonprintable characters

2008-02-21 Thread Geoffrey Irving

New submission from Geoffrey Irving:

On Mac OS X with python 2.5.1, I get

>>> open(chr(212),'w')
Traceback (most recent call last):
  File "", line 1, in 
IOError: invalid mode: w

The error should be more like "filename contains nonprintable characters."

Thanks,
Geoffrey

--
components: Macintosh
messages: 62644
nosy: irving
severity: normal
status: open
title: confusing exception when opening a filename with nonprintable characters
type: behavior
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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Virgil Dupras

Virgil Dupras added the comment:

Well, yeah, but I'm the owner, it's not like if the copyright was a 
problem. I'd gladly release it (and the test unit that goes with it) under 
BSD.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2153] unittest.py modernization

2008-02-21 Thread Christian Heimes

Changes by Christian Heimes:


--
keywords: +patch
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue2128] sys.argv is wrong for unicode strings

2008-02-21 Thread Martin v. Löwis

Martin v. Löwis added the comment:

I dislike the double decoding, and would prefer if sys.argv would be
created directly from the wide command line.

In addition, I think the patch is incorrect: it ignores the arguments to
Py_Main, which is a documented API function.

One solution might be to declare all these functions (Py_Main,
SetProgramName, GetArgcArgv) to operate on Py_UNICODE*, and then
convert the POSIX callers of Py_Main to use mbstowcs when going
from the command line to Py_Main. WinMain could then become 
recompiled for Unicode directly, likewise Modules/python.c

--
nosy: +loewis

__
Tracker <[EMAIL PROTECTED]>

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



[issue2154] doc: better detection of python snippets for highliting

2008-02-21 Thread Georg Brandl

Georg Brandl added the comment:

Committed as r60938 (python) and r60939 (sphinx). Thanks for the nice patch!

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



[issue2079] UserDict documentation typo

2008-02-21 Thread Georg Brandl

Georg Brandl added the comment:

Committed in r60936, r60937. Thanks!

--
nosy: +georg.brandl
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



[issue1038909] pydoc method documentation lookup enhancement

2008-02-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I agree this behaviour would definitely be useful.

--
nosy: +pitrou

_
Tracker <[EMAIL PROTECTED]>

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



[issue1038909] pydoc method documentation lookup enhancement

2008-02-21 Thread Antoine Pitrou

Changes by Antoine Pitrou:


--
type:  -> feature request
versions: +Python 2.6 -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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

-1 on adding these to unittest. The module is already too complex.

Mock objects have been rejected previously and the rationale still
holds.  There is no standardized approach that meets everyone's needs.
It doesn't make sense to lock in one of the many ways of doing it.

The tmpdir() method also locks-in one of many approaches.

I recommend against both additions.

--
assignee:  -> purcell
nosy: +purcell, rhettinger

__
Tracker <[EMAIL PROTECTED]>

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



[issue2127] sqlite3 docs should mention utf8 requirement

2008-02-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

> So, maybe create a ticket to use the latest version of pysqlite?
I don't think so. While the change you are pointing to does deal with
the same problem, the base versions seems to have substantial differences.
I still prefer my patch.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2128] sys.argv is wrong for unicode strings

2008-02-21 Thread Giovanni Bajo

Giovanni Bajo added the comment:

mbstowcs uses LC_CTYPE. Is that correct and consistent with the way
default encoding under UNIX is handled by Py3k?

Would a Py_MainW or similar wrapper be easier on the UNIX guys? I'm just
asking, I don't have a definite idea.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2128] sys.argv is wrong for unicode strings

2008-02-21 Thread Martin v. Löwis

Martin v. Löwis added the comment:

> mbstowcs uses LC_CTYPE. Is that correct and consistent with the way
> default encoding under UNIX is handled by Py3k?

It's correct, but it's not consistent with the default encoding - there
isn't really any default encoding in Py3k. More specifically,
PyUnicode_FromString uses UTF-8, but not as a (changeable) default,
but as part of its API specification.
Command line arguments are in the locale's charset, so the LC_CTYPE
must be used to convert them.

> Would a Py_MainW or similar wrapper be easier on the UNIX guys? I'm just
> asking, I don't have a definite idea.

See above. The current POSIX implementation is incorrect also. It should
use the locale's encoding, but doesn't.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2158] confusing exception when opening a filename with nonprintable characters

2008-02-21 Thread Ned Deily

Ned Deily added the comment:

I cannot reproduce the problem on Intel OSX 10.5.2 (Leopard) with either 
the built-in 2.5.1 or with the MacPython 2.5.1:
$ /usr/bin/python
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> open(chr(212),'w')


However, I can reproduce it on a 10.4.11 system (PPC) with the built-in 
2.3.5 or an earlier MacPython 2.4.4.

Further investigation with a simple C program shows similar behavior.

#include 
#include 
#include 
#include 
#define PMODE 0644

int main(argc, argv)
int argc;
char *argv[];
{
int f1;
if ((f1 = creat(argv[1], PMODE))  == -1) {
printf("can't create %s \n", argv[1]);
exit(1);
}
printf("OK\n");
exit(0);
}

On the 10.4.11 system, a creat fails with a similar file name:

$ cc --version
powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 
5367)
...
$ ./Testtest a
OK
pbg3:~ nad$ ./Testtest $'\xd4'
can't create ? 
pbg3:~ nad$

but on 10.5.2, it works:
$ cc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
...
$ ./Testtest a
OK
fimt:d nad$ ./Testtest $'\xd4'
OK

So perhaps this issue should be closed?

--
nosy: +nad

__
Tracker <[EMAIL PROTECTED]>

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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Steve Purcell

Steve Purcell added the comment:

I agree with Raymond: -1 from me.  There isn't a consensus on what "mock 
object" means*, and trying to provide a standardised mock object 
facility is a quagmire*, hence the prior rejections to which Raymond 
refers.

It's easy to roll your own simple mock objects as needed, e.g. for 
whichever Python regression tests might need them.


* Note, for instance, that mock object libraries variously provide 
support for record/playback of calls, partial replacement of methods in 
existing classes or instances, and subtle distinctions between "stubs" 
and "mocks".  I'm aware of at least three wildly different yet equally 
popular mock object libraries in the Java world, each with its own 
uniquely opinionated user base.

--
resolution:  -> rejected

__
Tracker <[EMAIL PROTECTED]>

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



[issue2156] TestCase.tmpdir(), TestCase.mock()

2008-02-21 Thread Steve Purcell

Changes by Steve Purcell:


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



[issue1110705] list comprehension scope

2008-02-21 Thread Daniel Stutzbach

Daniel Stutzbach added the comment:

The resolution on this bug reads, "In future versions of Python, Guido
would like to change the design to hide the induction variable.  So,
someday, you'll get your wish."

Can this bug be re-opened and the wart removed in 3.0?

--
nosy: +stutzbach

_
Tracker <[EMAIL PROTECTED]>

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



[issue1110705] list comprehension scope

2008-02-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

It's already been implemented for Py3.0.

_
Tracker <[EMAIL PROTECTED]>

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



[issue2159] dbmmodule inquiry function is performance prohibitive

2008-02-21 Thread johansen

New submission from johansen:

We've been using Python 2.4 to build the new package management software
for OpenSolaris.  We use a ndbm database to hold keywords about
packages, and found that each time we added a new OpenSolaris build to
our package repository, the time to import would increase by about 1/3
of the previous time.

It turns out that we were continually invoking a function in the
dbmmodule that walked the entire database every time the function was
called.

Looking at dbmmodule.c, the source for dbm.so, is instructive:

This is dbm_length, the function that we're _always_ calling.

static int
dbm_length(dbmobject *dp)
{
if (dp->di_dbm == NULL) {
 PyErr_SetString(DbmError, "DBM object has already been
closed"); 
 return -1; 
}
if ( dp->di_size < 0 ) {
datum key;
int size;

size = 0;
for ( key=dbm_firstkey(dp->di_dbm); key.dptr;
  key = dbm_nextkey(dp->di_dbm))
size++;
dp->di_size = size;
}
return dp->di_size;
}

It's a knock-off of function shown in ndbm(3C) that traverses the
database.  It looks like this function walks every record in the
database, and then returns that as its size.

Further examination of dbmmodule shows that dbm_length has been assigned
as the function for the inquiry operator:

static PyMappingMethods dbm_as_mapping = {
(inquiry)dbm_length,/*mp_length*/
(binaryfunc)dbm_subscript,  /*mp_subscript*/
(objobjargproc)dbm_ass_sub, /*mp_ass_subscript*/
};


It looks like dbm_length stashes the size of the database, so it doesn't
always have to traverse it.  However, further examination of the source
shows that an insertion doesn't update the di_size counter.  Worse yet,
an update or a delete will cause the counter to be set to -1.  This
means that the next call to dbm_length will have to walk the entire
database all over again.  Ick.

One of the problem parts of the code is this line in catalog.py:
update_searchdb():

if fmri_list:
if not self.searchdb:
self.searchdb = \
dbm.open(self.searchdb_file, "c")

This if not triggers the PyObject_IsTrue that invokes the inquiry operator
for the dbm module.  Every time we run this code, we're going to walk
the entire database.  By changing this to:

if fmri_list:
if self.searchdb is None:
self.searchdb = \
dbm.open(self.searchdb_file, "c")

We were able to work around the problem by using the is None check,
instead of if not self.searchdb; however, this seems like it is really a
problem with the dbmmodule and should ultimately be resolved there.

--
components: Extension Modules
messages: 62668
nosy: johansen
severity: normal
status: open
title: dbmmodule inquiry function is performance prohibitive
type: resource usage
versions: 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



[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.

2008-02-21 Thread Mark Dickinson

Mark Dickinson added the comment:

> Okay.  I'll stop now :)

So I lied.  In a spirit of enquiry, I implemented math.gcd, and wrote a 
script (lehmer_gcd.py, attached) to produce some relative timings.  Here 
are the results, on my MacBook Pro (OS X 10.5):

An explanation of the table:  I'm computing gcd(a, b) for randomly 
chosen a and b with a_digits and b_digits decimal digits, respectively.   
The times in the 5th and 6th columns are in seconds; the last column 
gives the factor by which math.gcd is faster than the direct Euclidean 
Python implementation.

Even for quite small a and b, math.gcd(a, b) is around 10 times faster 
than its Python counterpart.  For large, roughly equal-sized, a and b, 
the C version runs over 30 times faster.

The smallest difference occurs when the two arguments are very different 
sizes;  then both versions of gcd essentially do one time-consuming 
divmod, followed by a handful of tiny operations, so they take 
essentially the same time.  For Fraction, the arguments will tend to be 
around equal size for many applications:  this assumes that the actual 
real number represented by the Fraction is within a sensible range, even 
when the numerator and denominator have grown huge.

For random a and b, gcd(a, b) tends to be very small.  So for the last 
few entries in the table, the gcds have been artifically inflated (by 
calling gcd(g*a, g*b) for some largish g).

On to the results.

a_digits b_digits g_digits  ntrials   C_Lehmer  Py_Euclid Factor
    ---     - --
   110   10   0.066856   0.240867   3.602780
   220   10   0.070256   0.314639   4.478466
   440   10   0.075708   0.466596   6.163087
   770   10   0.082714   0.681443   8.238537
  10   1001   0.022336   0.318501  14.259532
  20   2001   0.045209   0.752662  16.648436
  50   5001   0.128269   2.167890  16.901128
 100  1000 1000   0.028053   0.511769  18.242906
1000 10000 1000   0.709453  18.867336  26.594197
   110  100   4.215795 148.597223  35.247736

Lopsided gcds
-
  20  1000  100   0.000889   0.007659   8.616953
 100   200  100   0.000887   0.007665   8.642473
100030  100   0.000727   0.001387   1.908167
   3 10000  100   0.000754   0.001457   1.932027
   110  100   0.004689   0.004948   1.055219
   110  100   0.004691   0.005038   1.073948
 500  4000  100   0.020289   0.388080  19.127665
 400  5000  100   0.020271   0.389301  19.204768

Large gcd
-
  10   10   10 1000   0.005235   0.043507   8.310880
  20   20   20 1000   0.008505   0.095732  11.256167
 100  100  100 1000   0.041734   0.812656  19.472284

Added file: http://bugs.python.org/file9485/lehmer_gcd.py

__
Tracker <[EMAIL PROTECTED]>

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



[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.

2008-02-21 Thread Mark Dickinson

Mark Dickinson added the comment:

And here's the diff for math.gcd.  It's not production quality---it's just 
there to show what's possible.

Added file: http://bugs.python.org/file9486/lehmer_gcd.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1110705] list comprehension scope

2008-02-21 Thread Daniel Stutzbach

Daniel Stutzbach added the comment:

Wonderful!

_
Tracker <[EMAIL PROTECTED]>

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



[issue2059] OptionMenu class is defined both in Tkinter and Tix

2008-02-21 Thread Ilya Sandler

Ilya Sandler added the comment:

I understand your argument. Yet, I am not sure classes with the same
name are reasonable here. Tix is too intertwined with Tkinter:

E.g a Tix user user can just access Tkinter widgets via Tix:

>>> import Tix
>>> print Tix.Canvas   # This is TkInter's widget
Tkinter.Canvas

>> import Tix.ComboBox #whoops, we've got Tix's combobox
Tix.ComboBox

As a matter of fact, Tix docs seem to explicitly recommend accessing
Tkinter stuff through Tix:

"""The former imports the latter, so to use Tix with Tkinter, all you
need to do is to import one module. In general, you can just import Tix,
and replace the toplevel call to Tkinter.Tk with Tix.Tk"""

__
Tracker <[EMAIL PROTECTED]>

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



[issue2138] Factorial

2008-02-21 Thread paul rubin

paul rubin added the comment:

I like the idea of having some integer math functions like this in the
stdlib; whether in the math module or elsewhere doesn't matter much.  In
particular I remember having to implement xgcd on several separate
occasions for unrelated applications, each time requiring about the same
head scratching as before, and wishing it was in the stdlib so that
could be avoided.  This type of function is complicated enough to not
rattle immediately off the fingertips, but not complicated enough to be
worth looking up in a reference book.

http://bugs.python.org/issue457066 has some discussion of xgcd and
modular inverses.

--
nosy: +phr

__
Tracker <[EMAIL PROTECTED]>

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



[issue1742669] "%d" format handling for long values

2008-02-21 Thread paul rubin

paul rubin added the comment:

I would prefer that %d signal an error 100% of the time if you give it a
float.  It should not accept 42.0.  It is for printing integers.

--
nosy: +phr

_
Tracker <[EMAIL PROTECTED]>

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



[issue1877] unhelpful error when calling "python "

2008-02-21 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Actually, a very simple change restores python2.5 behavior:

===
--- Modules/main.c  (revision 60941)
+++ Modules/main.c  (working copy)
@@ -187,6 +187,7 @@
 
if ((argv0 = PyString_FromString(filename)) && 
(importer = PyImport_GetImporter(argv0)) &&
+   (importer != Py_None) &&
(importer->ob_type != &PyNullImporter_Type))
{
 /* argv0 is usable as an import source, so

$ ./python.exe .   
./python.exe: '.' is a directory, cannot continue
$ ./python.exe abc
./python.exe: can't open file 'abc': [Errno 2] No such file or directory

I'm not sure, however that PyImport_GetImporter is behaving correctly in 
this case.  (For one, it should INCREF Py_None before returning it.)

I could not find any documentation for PyImport_GetImporter.  Can 
someone enlighten me what Py_None (instead of NULL) return from 
yImport_GetImporter signifies?

--
nosy: +belopolsky

__
Tracker <[EMAIL PROTECTED]>

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



[issue1877] unhelpful error when calling "python "

2008-02-21 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I have found relevant documentation in a comment preceding get_path_importer 
definition:

   ... traverse path_hooks until a hook is found 
   that can handle the path item. Return None if no hook could; 
   this tells our caller it should fall back to the builtin 
   import mechanism.

Therefore, Py_None return is legitimate and should be handled the way I 
suggested in my previous message.  The same comment explains that 
get_path_importer "Returns a borrowed reference," so my criticism of 
return Py_None was misplaced.

I will submit a documentation patch adding PyImport_GetImporter 
documentation.

__
Tracker <[EMAIL PROTECTED]>

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



[issue2160] Document PyImport_GetImporter

2008-02-21 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

See attached patch.

--
components: Documentation
files: doc-import.diff
messages: 62678
nosy: belopolsky
severity: normal
status: open
title: Document PyImport_GetImporter
versions: Python 2.6
Added file: http://bugs.python.org/file9487/doc-import.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2051] PYO file permission problem

2008-02-21 Thread Alexander Belopolsky

Changes by Alexander Belopolsky:


Added file: http://bugs.python.org/file9488/issue2051.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue2051] PYO file permission problem

2008-02-21 Thread Alexander Belopolsky

Changes by Alexander Belopolsky:


--
nosy: +belopolsky

__
Tracker <[EMAIL PROTECTED]>

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



[issue1481296] long(float('nan'))!=0L

2008-02-21 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

FYI: IEEE Standard 754 requires an invalid operation exception when 
inf/nan conversion to integer is attempted.

--
nosy: +belopolsky

_
Tracker <[EMAIL PROTECTED]>

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