[issue7733] asyncore docs reference is unclear

2010-01-18 Thread djc

New submission from djc :

http://docs.python.org/library/asyncore.html has this bit (for bind()):

(The format of address depends on the address family — see above.)

The only way this makes sense is if it points back to the "family" argument 
used in the create_socket() documentation, but even there the term "family" 
isn't actually used in the description, and it's unclear that the reference to 
the socket module documentation "for information on creating sockets" will have 
more information about the address constraints for bind(). It would probably be 
better if the bind() description referred to the socket documentation directly.

--
assignee: georg.brandl
components: Documentation
messages: 98008
nosy: djc, georg.brandl
severity: normal
status: open
title: asyncore docs reference is unclear
versions: Python 2.6

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



[issue7730] ssl has bad coding style

2010-01-18 Thread djc

djc  added the comment:

Thanks!

--

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



[issue7730] ssl has bad coding style

2010-01-18 Thread djc

Changes by djc :


--
type:  -> feature request

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



[issue7730] ssl has bad coding style

2010-01-18 Thread djc

New submission from djc :

Sorry to be nitpicking here, but it kind of sticks out when you take your first 
look at ssl.py. While PEP 8 only talks about whitespace before the function 
call argument list parenthesis, I think this should also go for function 
definition. ssl has a lot of definitions like this:

def send (self, data, flags=0):

(But not all of them.) Maybe that should be fixed up (I can do it myself, if 
that's alright), and maybe PEP 8 should be clarified as well?

--
components: Library (Lib)
messages: 97993
nosy: djc, janssen
severity: normal
status: open
title: ssl has bad coding style
versions: Python 2.7

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



[issue7619] imaplib shouldn't use cause DeprecationWarnings in 2.6

2010-01-02 Thread djc

djc  added the comment:

Perfect.

--

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



[issue7619] imaplib shouldn't use cause DeprecationWarnings in 2.6

2010-01-02 Thread djc

djc  added the comment:

Awesome, thanks! Will this be ported to the 2.6.x branch?

--

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



[issue7619] imaplib shouldn't use cause DeprecationWarnings in 2.6

2010-01-01 Thread djc

New submission from djc :

imaplib still calls os.popen2(), which has been deprecated in 2.6. It
should probably use subprocess instead, even in 2.6, IMO.

See http://bugs.gentoo.org/show_bug.cgi?id=282859

--
components: Library (Lib)
messages: 97121
nosy: djc
severity: normal
status: open
title: imaplib shouldn't use cause DeprecationWarnings in 2.6
versions: Python 2.6

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



[issue1537721] csv module: add header row to DictWriter

2009-12-07 Thread djc

djc  added the comment:

Skip, I agree that it's hard to decide if we should have the class write
the header on __init__(). I figured starting off with a method to make
doing it "manually" is a good start; people can start using that, and if
it's deemed useful we can always add the auto-write later.

--

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



[issue1537721] csv module: add header row to DictWriter

2009-12-07 Thread djc

djc  added the comment:

I'd like to commit this, but it would be nice to get a review first:

Index: Lib/csv.py
===
--- Lib/csv.py  (revision 76697)
+++ Lib/csv.py  (working copy)
@@ -132,6 +132,10 @@
 self.extrasaction = extrasaction
 self.writer = writer(f, dialect, *args, **kwds)
 
+def writeheader(self):
+header = dict(zip(self.fieldnames, self.fieldnames))
+self.writerow(header)
+
 def _dict_to_list(self, rowdict):
 if self.extrasaction == "raise":
 wrong_fields = [k for k in rowdict if k not in self.fieldnames]
Index: Lib/test/test_csv.py
===
--- Lib/test/test_csv.py(revision 76697)
+++ Lib/test/test_csv.py(working copy)
@@ -598,8 +598,10 @@
 fileobj = os.fdopen(fd, "w+b")
 try:
 writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2",
"f3"])
+writer.writeheader()
 writer.writerow({"f1": 10, "f3": "abc"})
 fileobj.seek(0)
+self.assertEqual(fileobj.readline(), "f1,f2,f3\r\n")
 self.assertEqual(fileobj.read(), "10,,abc\r\n")
 finally:
 fileobj.close()

(I think I have commit privileges already.)

--

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



[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc

djc  added the comment:

Also, it might be useful here if it showed repr(line) instead of just
line, but that'd just be icing on the cake.

--

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



[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc

New submission from djc :

For whatever reason, BadStatusLine tracebacks often don't show the line
passed into them. Given the errr, heavy architecture of httplib, this
makes it pretty bad to debug. It's not clear to me why this is:

Traceback (most recent call last):
  File "/home/djc/src/couchdb-python/couchdb/tests/client.py", line 138,
in test_attachment_crud_with_files
doc = self.db['foo']
  File "/home/djc/src/couchdb-python/couchdb/client.py", line 293, in
__getitem__
_, _, data = self.resource.get(id)
  File "/home/djc/src/couchdb-python/couchdb/http.py", line 333, in get
return self._request('GET', path, headers=headers, **params)
  File "/home/djc/src/couchdb-python/couchdb/http.py", line 350, in _request
credentials=self.credentials)
  File "/home/djc/src/couchdb-python/couchdb/http.py", line 179, in request
resp = _try_request()
  File "/home/djc/src/couchdb-python/couchdb/http.py", line 167, in
_try_request
return conn.getresponse()
  File "/usr/lib/python2.6/httplib.py", line 950, in getresponse
  File "/usr/lib/python2.6/httplib.py", line 390, in begin
  File "/usr/lib/python2.6/httplib.py", line 354, in _read_status
BadStatusLine

However, some interactive testing shows that this should work:

d...@enrai couchdb-python $ python
Python 2.6.2 (r262:71600, Oct  5 2009, 12:18:48)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class CrapShoot(Exception):
... def __init__(self, a):
... self.args = a,
...
>>> raise CrapShoot('a')
Traceback (most recent call last):
  File "", line 1, in 
__main__.CrapShoot: a
>>> class ParentExc(Exception):
... pass
...
>>> class CrapShoot(ParentExc):
... def __init__(self, a):
... self.args = a,
...
>>> raise CrapShoot('a')
Traceback (most recent call last):
  File "", line 1, in 
__main__.CrapShoot: a
>>>

Definition of BadStatusLine:

class BadStatusLine(HTTPException):
def __init__(self, line):
self.args = line,
self.line = line

class HTTPException(Exception):
# Subclasses that define an __init__ must call Exception.__init__
# or define self.args.  Otherwise, str() will fail.
pass

The note here seems like a cautionary but insufficient tale...

--
components: Library (Lib)
messages: 95934
nosy: djc
severity: normal
status: open
title: BadStatusLine is hell to debug
versions: Python 2.6

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



[issue7252] list().index() should provide better error reporting

2009-11-02 Thread djc

djc  added the comment:

I want the actual value in there, though! So I can spot the bug.

--

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



[issue7252] list().index() should provide better error reporting

2009-11-02 Thread djc

djc  added the comment:

FWIW, quickly grepping through the raises of ValueErrors in the 2.6
stdlib doesn't bring up any other usage of repeat-with-fake-variable-x.

--

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



[issue7252] list().index() should provide better error reporting

2009-11-02 Thread djc

New submission from djc :

>>> a = 'b'
>>> [].index(a)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: list.index(x): x not in list

This is suboptimal. IMO it would be much more useful if the ValueError
reported the actual value that wasn't in the list, like this:

Traceback (most recent call last):
  File "", line 1, in 
ValueError: list.index('b'): 'b' not in list

The error in general doesn't really seem to fit in, repeating the code
but with a fake variable name in it. In real contexts, it's mostly just
repeating what's there on a previous line:

 File "/home/watt/src/dawkins/ttlib.py", line 86, in shift
   bits.append(SHIFTS.index(rest.split('_')[0]))
 ValueError: list.index(x): x not in list

So maybe just make it "'b' not in list"? Or do we really need a
reference to the index() method in there?

--
components: Library (Lib)
messages: 94825
nosy: djc
severity: normal
status: open
title: list().index() should provide better error reporting
versions: Python 2.6

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



[issue6965] tmpnam should not be used if tempfile or mkstemp are available

2009-09-22 Thread djc

New submission from djc :

I have a bug report in the Gentoo tracker
(http://bugs.gentoo.org/show_bug.cgi?id=221183):

"This is a rather strange request, but please bear me.
While building Posix module, python checks (among others) for
tmpfile, tmpnam and tmpnam_r
however man pages state explicitly, that in case tmpfile is available, other
two should not be used
if libpython2.5.a is built with either of them, linker complains each
time it's
added

While this doesn't break anything, it's still a bit annoying.
so I propose to remove functionality as an enhancement:
to change in Modules/posixmodule.c
#ifdef HAVE_TMPNAM
to
#ifdef HAVE_TMPNAM && !defined(HAVE_TMPFILE)

Your thoughts?"

man 3 tmpnam state "Never use this function.  Use mkstemp(3) or
tmpfile(3) instead.".

Not sure whether this is exposed anywhere, but I figured this bug would
be better handled upstream from Gentoo.

--
components: Extension Modules
messages: 92975
nosy: djc
severity: normal
status: open
title: tmpnam should not be used if tempfile or mkstemp are available
versions: Python 2.7

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



[issue1537721] csv module: add header row to DictWriter

2009-08-06 Thread djc

Changes by djc :


--
nosy: +djc

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



[issue6491] Improve --with-dbmliborder option

2009-07-20 Thread djc

Changes by djc :


--
nosy: +djc

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



[issue6119] Confusing DeprecationWarning

2009-07-02 Thread djc

Changes by djc :


--
nosy: +djc

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



[issue1731717] race condition in subprocess module

2009-05-07 Thread djc

Changes by djc :


--
nosy: +djc

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



[issue5853] mimetypes.guess_type() hits recursion limit

2009-04-27 Thread djc

djc  added the comment:

This could well be due to the SocketServer.ThreadingMixIn that's being
used by the hg serve built-in web server (since it doesn't show on REPL
or, as far as I can see, when used from within Apache + mod_wsgi).

--

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



[issue5853] mimetypes.guess_type() hits recursion limit

2009-04-27 Thread djc

djc  added the comment:

georg.brandl remarked it might be due to demandimport. That doesn't seem
to be the case:

>>> from mercurial import demandimport
>>> demandimport.enable()
>>> import mimetypes
>>>
mimetypes.guess_type('/home/djc/src/hg/crew/templates/static/hglogo.png')
('image/png', None)

--

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



[issue5853] mimetypes.guess_type() hits recursion limit

2009-04-27 Thread djc

New submission from djc :

I've got hgweb (the Mercurial web app) crashing on guess_type() in
2.6.2, but not in 2.5.4. I'm passing in a filename like
'/home/djc/src/hg/crew/templates/static/hglogo.png'. Doesn't happen on
the REPL, but happens in side the hg serve web server.

Traceback (most recent call last):
  File "/home/djc/src/hg/crew/mercurial/hgweb/server.py", line 67, in
do_POST
    self.do_write()
  File "/home/djc/src/hg/crew/mercurial/hgweb/server.py", line 60, in
do_write
self.do_hgweb()
  File "/home/djc/src/hg/crew/mercurial/hgweb/server.py", line 124, in
do_hgweb
for chunk in self.server.application(env, self._start_response):
  File "/home/djc/src/hg/crew/mercurial/hgweb/hgwebdir_mod.py", line 91,
in __call__
return self.run_wsgi(req)
  File "/home/djc/src/hg/crew/mercurial/hgweb/hgwebdir_mod.py", line
132, in run_wsgi
return (staticfile(static, fname, req),)
  File "/home/djc/src/hg/crew/mercurial/hgweb/common.py", line 73, in
staticfile
ct = mimetypes.guess_type(path)[0] or "text/plain"
  File "/usr/lib/python2.6/mimetypes.py", line 244, in guess_type
return guess_type(url, strict)
(... snip ...)
  File "/usr/lib/python2.6/mimetypes.py", line 244, in guess_type
return guess_type(url, strict)
RuntimeError: maximum recursion depth exceeded

--
components: Library (Lib)
messages: 86649
nosy: djc, georg.brandl
severity: normal
status: open
title: mimetypes.guess_type() hits recursion limit
versions: Python 2.6

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-04-09 Thread djc

djc  added the comment:

I'll take a stab at doing it Raymond's way this weekend.

--

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



[issue4136] merge json library with latest simplejson 2.0.x

2009-04-09 Thread djc

Changes by djc :


--
nosy: +djc

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



[issue4753] Faster opcode dispatch on gcc

2009-01-03 Thread djc

Changes by djc :


--
nosy: +djc

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



[issue3187] os.listdir can return byte strings

2008-10-02 Thread djc

Changes by djc <[EMAIL PROTECTED]>:


--
nosy: +djc

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3187>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3723] Py_NewInterpreter does not work

2008-09-25 Thread djc

Changes by djc <[EMAIL PROTECTED]>:


--
nosy: +djc

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3723>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue648658] xmlrpc can't do proxied HTTP

2008-09-05 Thread djc

djc <[EMAIL PROTECTED]> added the comment:

Would this be solved by issue1424152?

--
nosy: +djc

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue648658>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2534] Restore isinstance and issubclass speed in 2.6

2008-08-25 Thread djc

Changes by djc <[EMAIL PROTECTED]>:


--
nosy: +djc

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2534>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3123] 2to3 fails

2008-06-16 Thread djc

New submission from djc <[EMAIL PROTECTED]>:

2to3 fails in recent CPython trunk. This is because lib2to3 got some
merges, but the 2to3 script wasn't updated to match.
lib2to3.refactor.main() now requires a first argument which isn't given
by the 2to3 script.

--
assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool)
messages: 68267
nosy: benjamin.peterson, collinwinter, djc
severity: normal
status: open
title: 2to3 fails
versions: Python 2.6, Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3123>
___
___
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-08 Thread djc

Changes by djc <[EMAIL PROTECTED]>:


--
nosy: +georg.brandl -birkenfeld

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2585>
__
___
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-08 Thread djc

New submission from djc <[EMAIL PROTECTED]>:

[EMAIL PROTECTED] tests $ python2.6
Python 2.6a2+ (trunk, Apr  4 2008, 20:21:45)
[GCC 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2
p1.0.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> try:
... urllib2.urlopen('http://example.com/weird')
... except urllib2.HTTPError, inst:
... print inst.code
...
None
>>>

urllib.addinfourl.__init__() was changed in r60133 to set self.code.
Unfortunately, this overrides HTTPError.code, which is probably not good.

--
components: Library (Lib)
messages: 65168
nosy: birkenfeld, djc
severity: normal
status: open
title: urllib2.HTTPError broken due to urllib.addinfourl changes
versions: Python 2.6

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2585>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2008-04-03 Thread djc

Changes by djc <[EMAIL PROTECTED]>:


--
nosy: +djc

_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1424152>
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2444] Adding __iter__ to class Values of module optparse

2008-03-23 Thread djc

djc <[EMAIL PROTECTED]> added the comment:

I'd like this. I had one instance where a number of options where
dynamically added to the OptionParser based on loadable modules, so that
I wanted to dynamically iterate over the Values returned as well.

------
nosy: +djc

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2444>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2189] urllib.quote() throws KeyError when passed an iterator

2008-02-25 Thread djc

New submission from djc:

>>> urllib.quote(['', 'aa'])
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.5/urllib.py", line 1205, in quote
res = map(safe_map.__getitem__, s)
KeyError: ''

I think this is a weird error message to throw. quote() is obviously
assuming that the param passed is a one-character string iterator or
something. It should either accept just strings or come up with a better
error message when confronted with an iterator element that is not a
one-character string, IMO.

------
components: Library (Lib)
messages: 62978
nosy: djc
severity: minor
status: open
title: urllib.quote() throws KeyError when passed an iterator
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2189>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com