[Python-Dev] BZ2File.writelines should raise more meaningful exceptions
In the BZ2File object of bz2 module the writelines() method does not check its closed state before doing the actual work so its behavior it's different from write()'s behavior. See: from bz2 import BZ2File f = BZ2File("foo", "w") f.close() f.closed 1 f.write("foobar") Traceback (most recent call last): File "", line 1, in ValueError: I/O operation on closed file f.closed 1 f.writelines(["foobar"]) Traceback (most recent call last): File "", line 1, in IOError: unknown IO error It also doesn't check if it can write for real: from bz2 import BZ2File f = BZ2File("foo", "r") f.write("foobar") Traceback (most recent call last): File "", line 1, in IOError: file is not ready for writing f.writelines(['foobar']) Traceback (most recent call last): File "", line 1, in RuntimeError: wrong sequence of bz2 library commands used The patch is attached. If you think it's ok to fix this I'll post it to the bug tracker -- Lawrence http://www.oluyede.org/blog Index: Modules/bz2module.c === --- Modules/bz2module.c (revision 51128) +++ Modules/bz2module.c (working copy) @@ -861,6 +861,20 @@ int bzerror; ACQUIRE_LOCK(self); + switch (self->mode) { + case MODE_WRITE: + break; + + case MODE_CLOSED: + PyErr_SetString(PyExc_ValueError, + "I/O operation on closed file"); + goto cleanup; + + default: + PyErr_SetString(PyExc_IOError, + "file is not ready for writing"); + goto cleanup; + } islist = PyList_Check(seq); if (!islist) { iter = PyObject_GetIter(seq); @@ -951,8 +965,12 @@ Py_INCREF(Py_None); ret = Py_None; - error: +cleanup: RELEASE_LOCK(self); + return ret; + +error: + RELEASE_LOCK(self); Py_XDECREF(list); Py_XDECREF(iter); return ret; ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] test_mailbox on Cygwin
I just had a look at the Cygwin buildbot's test log, and noticed that test_mailbox has failures that look very similar to those I addressed in rev 50789 for the OS/2 EMX platform. Hopefully this might give someone with access to Cygwin a starting point in getting this test working on that platform. -- - Andrew I MacIntyre "These thoughts are mine alone..." E-mail: [EMAIL PROTECTED] (pref) | Snail: PO Box 370 [EMAIL PROTECTED] (alt) |Belconnen ACT 2616 Web:http://www.andymac.org/ |Australia ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] BZ2File.writelines should raise more meaningful exceptions
On Sun, Aug 06, 2006, Lawrence Oluyede wrote: > > The patch is attached. If you think it's ok to fix this I'll post it > to the bug tracker Always post patches -- that way they can't get lost. *THEN* post to python-dev with your analysis and explanation (which you presumably also included with the patch), starting with a link to the patch. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian W. Kernighan ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] BZ2File.writelines should raise more meaningful exceptions
> Always post patches -- that way they can't get lost. *THEN* post to > python-dev with your analysis and explanation (which you presumably also > included with the patch), starting with a link to the patch. Thanks for the hint. This is the link: http://sourceforge.net/tracker/index.php?func=detail&aid=1535500&group_id=5470&atid=305470 -- Lawrence http://www.oluyede.org/blog ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] windows 2.5 build: use OpenSSL for hashlib [bug 1535502]
Whoever knows how the windows build process works and controls the python 2.5 windows release builds could you please make sure the hashlib module gets built + linked with OpenSSL rather than falling back to its much slower builtin implementations. http://sourceforge.net/tracker/index.php?func=detail&aid=1535502&group_id=5470&atid=105470 thanks, greg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] More tracker demos online
On 8/5/06, Hernan M Foffani <[EMAIL PROTECTED]> wrote: > > > > Currently, we have two running tracker demos online:> > > >> > > > Roundup:> > > > http://efod.se/python-tracker/ > > > >> > > > Jira:> > > > http://jira.python.atlassian.com/secure/Dashboard.jspa>> > Is anyone looking at the Google Code Hosting tracker, just for fun? =) (> code.google.com/hosting, although performance seems to be an issue for now)It's propietary code, isn't it? http://code.google.com/hosting/faq.html#itselfoss(Is that why you said "just for fun"?)Yes, it's proprietary, but so what? As Bob pointed out, JIRA is as well. Read the call for trackers and you will see we explicitly said closed-source was fine. But Google Code Hosting is not being considered since it won't have data imported by the deadline for accepting test trackers (it currently doesn't have any support for mass issue uploading).-Brett ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cgi.FieldStorage DOS (sf bug #1112549)
[Chris McDonough, on 7/28/06] > From the initial bugreport > (http://sourceforge.net/tracker/index.php? > func=detail&aid=1112549&group_id=5470&atid=105470) > > """ > Various parts of cgi.FieldStorage call its > "read_lines_to_outerboundary", "read_lines" and > "skip_lines" methods. These methods use the > "readline" method of the file object that represents an > input stream. The input stream is typically data > supplied by an untrusted source (such as a user > uploading a file from a web browser). The input data > is not required by the RFC 822/1521/1522/1867 > specifications to contain any newline characters. For > example, it is within the bounds of the specification > to supply a a multipart/form-data input stream with a > "file-data" part that consists of a 2GB string composed > entirely of "x" characters (which happens to be > something I did that led me to noticing this bug). > """ > > This bug has been around for about a year but I just worked up a > patch yesterday that applies OK against current SVN. It's attached > to the issue. Would someone be so kind as to check it in? Guido has > already reviewed it, I believe. Are either of our 2.5 release managers/coordinators on the internal Python security mailing list? I am, but only the list admin can see who's on that list. Since this bug is thought to be a security hole (the "DOS" in the subject line doesn't refer to your favorite operating system -- it's the Denial-Of-Service flavor of DOS), it's important that someone with sufficient power stare at this one and Pronounce on its fate for 2.5c1. Here's a clicky thing: http://www.python.org/sf/1112549 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com