[issue1159] os.getenv() not updated after external module uses C putenv()
Changes by Raghuram Devarakonda: -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1159> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1159] os.getenv() not updated after external module uses C putenv()
Raghuram Devarakonda added the comment: On 9/13/07, Robert Ancell <[EMAIL PROTECTED]> wrote: > The Python os.getenv() function accesses an Python dictionary which is > mirroring the process environment. This dictionary is populated when the > interpreter starts and updated when os.environ.__setitem__() or > os.putenv() are called. However if the python program imports an As per the document and my simple test (on Linux), os.putenv() does not update os.environ. I think, it should update it. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1159> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1159] os.getenv() not updated after external module uses C putenv()
Raghuram Devarakonda added the comment: > Stefan Sonnenberg-Carstens added the comment: > > > As per the document and my simple test (on Linux), os.putenv() does > > not update os.environ. I think, it should update it. > What would be the benefit ? Symmetrical behaviour. When os.getenv() returns the value from os.environ, one would expect, os.putenv to store the value there (At least, I did). On the other hand, it is also ok for both os.getenv and os.putenv get/set the environment directly instead of going through os.environ. I am sure there was some reason for the current behaviour of os.putenv. Perhaps, because putenv is supposedly not available on all platforms? Any way, I think the OP was asking to always "get" the value dynamically when ever os.environ['VAR'] or os.getenv['VAR'] is done. I don't see any problem with that approach. How ever, if it is considered backwards incompatible, I guess an optional parameter can be added to os.getenv. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1159> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1159] os.getenv() not updated after external module uses C putenv()
Raghuram Devarakonda added the comment: > Robert Ancell added the comment: > > draghuram, unfortunately while os.putenv() can be fixed to be > symmetrical any putenv call from a C module cannot, for example: Hi Robert, I understood the problem from your very first report. I brought up putenv() not updating os.environ only because you mentioned in the original report that it does. All you need is a way to get the current value of an environment variable. The situation is a bit complicated since a cache is in the picture (os.environ). I would suggest that you bring up the topic for discussion on python-dev and once a consensus is reached, some one can come up with a patch (I can try). __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1159> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1181] Redefine clear() for os.environ to use unsetenv() if possible
Changes by Raghuram Devarakonda: -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1181> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1181] Redefine clear() for os.environ to use unsetenv() if possible
Raghuram Devarakonda added the comment: Shouldn't the first clear() in the patch say "del self.data[key.upper()]" instead of "del self.data[key]"? I also think the patch should include doc change. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1181> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1210] imaplib does not run under Python 3
Changes by Raghuram Devarakonda: -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1210> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1210] imaplib does not run under Python 3
Raghuram Devarakonda added the comment: Just to further understand the issue, I added "imaplib.Debug=5" and here is the output preceding the exception stack trace(I replaced the real IMAP server name) *** 20:19.52 imaplib version 2.58 20:19.52 new IMAP4 connection, tag=LOLD 20:19.52 < * OK Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.7638.1 (imapserver.com) ready. 20:19.52 matched r'\* (?P[A-Z-]+)( (?P.*))?' => (b'OK', b' Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.7638.1 (imapserver.com) ready.', b'Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.7638.1 (imapserver.com) ready.') *** So it appears that the response is of type "bytes" which in turn is due to reading the socket in binary mode (self.file = self.sock.makefile('rb')). I would like to see how the problem can be fixed but any pointers are appreciated. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1210> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1210] imaplib does not run under Python 3
Raghuram Devarakonda added the comment: I have gone through the python-3000 discussions about similar problems in other stdlib modules (email, imghdr, sndhdr etc) and found PEP 3137 (Immutable Bytes and Mutable Buffer). Since that work is in progress, I don't think it is worthwhile to fix this problem at this point. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1210> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1231] PEPs 344 and 3134 contain incorrect hyperlinks.
New submission from Raghuram Devarakonda: http://www.python.org/dev/peps/pep-0344/ http://www.python.org/dev/peps/pep-3134/ Check both the PEPs and grep for the first occurrence of "RFC 88" which is a link. The target of the link is http://www.faqs.org/rfcs/rfc88.html which is wrong. The correct value is indicated in footnote [9]. -- components: Documentation messages: 56217 nosy: draghuram severity: minor status: open title: PEPs 344 and 3134 contain incorrect hyperlinks. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1231> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1243] option.dest not set when callback called with optparse
Raghuram Devarakonda added the comment: I have never used callbacks but went through the docs/code and I am not sure if there is a bug here. _check_dest() creates 'dest' only if 'type' is specified for the 'callback' option. With callbacks, it can not guess the type as there is no 'store' action. The document does say that without 'type', optparse does not know how many arguments to consume. I added 'type' to your example add_option() and all is well. Please correct me if I am missing some thing here. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1243> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1243] option.dest not set when callback called with optparse
Raghuram Devarakonda added the comment: > > But what type should I specify? > > I was using a callback to get a datetime object as an option... > If you are looking for a new type of option than what are already supported (string, int, long, choice, float and complex), you need to extend optparse (there is a section for that). I personally prefer a simple approach where the option value is taken as a string and any processing is done on the value to convert to what ever type of object one wants. For example, in this case, you can convert a string, say, 2007-10-8, internally to a datetime object. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1243> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1713041] fix for 1712742: corrects pprint's handling of 'depth'
Raghuram Devarakonda added the comment: I was just searching for all my issues and found this one. Can some one please apply pprint.patch? Thanks. _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1713041> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1287] os.environ.pop doesn't work
Raghuram Devarakonda added the comment: The following patch solves the problem (with the latest from trunk). I only tested on Linux. I couldn't reproduce the problem with latest py3k (again, on Linux). === --- Lib/os.py (revision 58221) +++ Lib/os.py (working copy) @@ -446,6 +446,9 @@ def __delitem__(self, key): unsetenv(key) del self.data[key.upper()] +def pop(self, key): +unsetenv(key) +return UserDict.IterableUserDict.pop(self, key) def clear(self): for key in self.data.keys(): unsetenv(key) @@ -513,6 +516,9 @@ del self.data[key] def copy(self): return dict(self) +def pop(self, key): +unsetenv(key) +return UserDict.IterableUserDict.pop(self, key) environ = _Environ(environ) -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1287> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1290] xml.dom.minidom not able to handle utf-8 data
Raghuram Devarakonda added the comment: I forgot to show dom.py source. marvin:cpython$ cat dom.py import xml.dom.minidom as dom data = open('testdata.txt','r').read() mydom = dom.parseString(data) mydom.firstChild.childNodes __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1290> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1290] xml.dom.minidom not able to handle utf-8 data
Raghuram Devarakonda added the comment: When I run the code in a script, I don't get the error. *** marvin:cpython$ python Python 2.5 (r25:51908, Jan 24 2007, 12:48:15) [GCC 4.1.0 (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import xml.dom.minidom as dom >>> data = open('testdata.txt','r').read() >>> mydom = dom.parseString(data) >>> mydom.firstChild.childNodes Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022' in position 18: ordinal not in range(128) >>> import sys >>> sys.getdefaultencoding() 'ascii' marvin:cpython$ python dom.py marvin:cpython$ *** Can you try and see if you can run it from the script too? -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1290> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: I tested cmd.py on Linux and two things (including the one reported by OP) looked odd to me. 1) CTRL-D produces a message "*** Unknown syntax: EOF". 2) CTRL-C produces a KeyboardInterrupt exception and the session terminates. I am attaching a patch that changes the behaviour to a more typical one (at least, in IMHO). It terminates the session on CTRL-D and it just ignores CTRL-C. Both of these can be overridden, if required. If the patch is accepted, a doc change would be required in addition to the change in doc string. I tested the patch on Linux and Windows. -- nosy: +draghuram Added file: http://bugs.python.org/file8568/cmd.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1294> __Index: Lib/cmd.py === --- Lib/cmd.py (revision 58221) +++ Lib/cmd.py (working copy) @@ -130,6 +130,9 @@ line = raw_input(self.prompt) except EOFError: line = 'EOF' +except KeyboardInterrupt: +line = 'KeyboardInterrupt' + else: self.stdout.write(self.prompt) self.stdout.flush() @@ -403,3 +406,13 @@ for col in range(len(texts)): texts[col] = texts[col].ljust(colwidths[col]) self.stdout.write("%s\n"%str(" ".join(texts))) + +def do_EOF(self, args): +"""default implementation for EOF""" +self.stdout.write('\n') +return True + +def do_KeyboardInterrupt(self, args): +"""default implementation for CTRL-C""" +self.stdout.write('\n') +return False ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1290] xml.dom.minidom not able to handle utf-8 data
Raghuram Devarakonda added the comment: The fact that the problem occurs only from the command line and not when run from a script indicates that the real issue is in trying to print the object. Sure enough, if you modify the script to do repr(mydom.firstChild.childNodes), it gets the same problem. So the issue may have some thing to do with how the object is constructed in repr(). I don't have time right now to dig deeper but the parser itself may not have any encoding/decoding issues (apart of ability to print these high level objects). __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1290> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1256] subprocess Popen wait() function hangs when stdout is > 20480
Raghuram Devarakonda added the comment: PIPE on POSIX are implemented using pipe system call so it will have all the limitations of the system buffering that is used for implementing pipes. The buffer size is system dependent. For example, on my Linux, I hit the hang condition at 64K and not 20480 bytes (as is your case). What basically happens is that the child fills up the pipe buffer and is blocked until space is available. Since the parent in your test script is not reading the bytes, space will never be freed up. I suggest that the bug is closed as invalid. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1256> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1287] os.environ.pop doesn't work
Raghuram Devarakonda added the comment: After reading the change, I think one more small change may be required. Index: Lib/os.py === --- Lib/os.py (revision 58654) +++ Lib/os.py (working copy) @@ -452,7 +452,7 @@ del self.data[key] def pop(self, key, *args): unsetenv(key) -return self.data.pop(key, *args) +return self.data.pop(key.upper(), *args) def has_key(self, key): return key.upper() in self.data def __contains__(self, key): __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1287> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1322] platform.dist() has unpredictable result under Linux
Raghuram Devarakonda added the comment: I think it is safe to ignore lsb-release. In fact, there seems to be a command "lsb_release" that gives information about distribution. On my SuSE box, this is what I get: marvin:~# lsb_release -i Distributor ID: SUSE LINUX marvin:~# lsb_release -d Description:SUSE LINUX 10.1 (i586) marvin:~# lsb_release -r Release:10.1 sapetnioc, can you check if this command exists on your system and if so, it's output? platform.dist() can check for this command's existence and if present, can perhaps use it to glean distro information. Please let me know if you want to write the patch. I will do it otherwise. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1322> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1322] platform.dist() has unpredictable result under Linux
Raghuram Devarakonda added the comment: On 10/25/07, Yann Cointepas <[EMAIL PROTECTED]> wrote: > I can easily do the patch to ignore symlinks and /etc/lsb-release but I am > not sure of the appropriate way to look for lsb_update command, is > distutils.spawn.find_executable( 'lsb_release' ) ok ? You can just execute the command and if there is any error, default to the current code. There is no need to explicitly check for the binary's existence. > If you need the patch earlier than begining of next week, you should do it. > Otherwise I can make it. I don't "need" the patch :-). If you can't get to it some time next week, I will try to come up with the patch. > > On Mandriva 2007.1, the command exists if the package "lsb-release" is > installed. I do not know if it is always installed (I selected a checkbox > "LSB" during install, this checkbox is unchecked by default). > The output is: > > [EMAIL PROTECTED] ~]$ lsb_release -a > LSB Version: > lsb-3.1-ia32:lsb-3.1-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:cxx-3.0-ia32:cxx-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch:lsb-3.0-ia32:lsb-3.0-noarch:qt4-3.1-ia32:qt4-3.1-noarch > Distributor ID: MandrivaLinux > Description:Mandriva Linux > Release:2007.1 > Codename: Official > > [EMAIL PROTECTED] ~]$ lsb_release -i > Distributor ID: MandrivaLinux > > [EMAIL PROTECTED] ~]$ lsb_release -d > Description:Mandriva Linux > > [EMAIL PROTECTED] ~]$ lsb_release -r > Release:2007.1 > > On Fedora 4 (rather old) , the command is in the package "redhat-lsb". > > yc176684:src$ lsb_release -a > LSB Version:1.3 > Distributor ID: FedoraCore > Description:Fedora Core release 4 (Stentz) > Release:4 > Codename: Stentz > > yc176684:src$ lsb_release -i > Distributor ID: FedoraCore > > yc176684:src$ lsb_release -d > Description:Fedora Core release 4 (Stentz) > > yc176684:src$ lsb_release -r > Release:4 > > On Fedora 7, the command is in the package "redhat-lsb" and seem to be > installed by default. > > gargamel:riviere% lsb_release -a > LSB > Version::core-3.1-ia32:core-3.1-noarch: > graphics-3.1-ia32:graphics-3.1-noarch > Distributor ID: Fedora > Description:Fedora release 7 (Moonshine) > Release:7 > Codename: Moonshine > > gargamel:riviere% lsb_release -i > Distributor ID: Fedora > > gargamel:riviere% lsb_release -d > Description:Fedora release 7 (Moonshine) > > gargamel:riviere% lsb_release -r > Release:7 > > On 10/25/07, Raghuram Devarakonda < [EMAIL PROTECTED]> wrote: > > > > > > Raghuram Devarakonda added the comment: > > > > I think it is safe to ignore lsb-release. In fact, there seems to be a > > command "lsb_release" that gives information about distribution. On my > > SuSE box, this is what I get: > > > > marvin:~# lsb_release -i > > Distributor ID: SUSE LINUX > > marvin:~# lsb_release -d > > Description:SUSE LINUX 10.1 (i586) > > marvin:~# lsb_release -r > > Release:10.1 > > > > sapetnioc, can you check if this command exists on your system and if > > so, it's output? platform.dist() can check for this command's existence > > and if present, can perhaps use it to glean distro information. Please > > let me know if you want to write the patch. I will do it otherwise. > > > > -- > > nosy: +draghuram > > > > __ > > Tracker <[EMAIL PROTECTED] > > > <http://bugs.python.org/issue1322 > > > __ > > > > Added file: http://bugs.python.org/file8609/unnamed > > __ > Tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue1322> > __ > __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1322> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1322] platform.dist() has unpredictable result under Linux
Raghuram Devarakonda added the comment: > Ony my Ubuntu box lsb_release is just a small Python script that parses > /etc/lsb-release. I suggest that your read the LSB standards about the > file and use the information to parse it instead of invoking a program. Can you please check if it supports all the options mentioned previously in the bug report? I agree that reading from a file is preferable to running a command, if issues OP mentioned can be addressed. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1322> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1354] windows installer problem
Raghuram Devarakonda added the comment: I installed python 2.5 on multiple windows machines and had no problem. How ever, this doesn't look like it belongs in bug tracker. You will have better chance if you post to comp.lang.python. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1354> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: I think the solution is to do the translation on a bigger chunk than on the string being returned in each read call. For example, the following patch correctly returns "a" and "\n" (instead of "a" and two "\n"s). Index: Lib/io.py === --- Lib/io.py (revision 58874) +++ Lib/io.py (working copy) @@ -1253,8 +1253,9 @@ res += pending if not readahead: break +res = self._replacenl(res) self._pending = res[n:] -return self._replacenl(res[:n]) +return res[:n] def __next__(self): self._telling = False - Of course, we need to take care of the case when the last character in "res" is "\r" to be followed by "\n" in the next read. I just wanted to see if I am on the right track and if so, I can spend more time on this. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: I am attaching the patch io.diff that does the following: - If a chunk ends in "\r", read the next chunk to check if it starts with "\n". This is obviously a very simplified solution that can be optimized. - invoke _replacenl on the complete string read instead of what is being returned in each read call. I also incorporated the test case by Amaury and added one more. With this patch in place, the following tests failed (on SuSE 10.1): test_doctest test_mailbox test_nis test_old_mailbox test_pickletools test_pty test_sys The failures (other than known test_mailbox and test_old_mailbox) didn't look like they are caused by this fix. Added file: http://bugs.python.org/file8703/io.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __Index: Lib/io.py === --- Lib/io.py (revision 58880) +++ Lib/io.py (working copy) @@ -1248,13 +1248,19 @@ self._snapshot = None return self._replacenl(res) else: -while len(res) < n: +nl = False +while nl or len(res) < n: readahead, pending = self._read_chunk() +if pending and pending[-1] == "\r": +nl = True +else: +nl = False res += pending if not readahead: break +res = self._replacenl(res) self._pending = res[n:] -return self._replacenl(res[:n]) +return res[:n] def __next__(self): self._telling = False Index: Lib/test/test_io.py === --- Lib/test/test_io.py (revision 58880) +++ Lib/test/test_io.py (working copy) @@ -741,7 +741,28 @@ print("Reading using readline(): %6.3f seconds" % (t3-t2)) print("Using readline()+tell(): %6.3f seconds" % (t4-t3)) +def testReadOneByOne(self): +txt = io.TextIOWrapper(io.BytesIO(b"AA\r\nBB")) +reads = "" +while True: +c = txt.read(1) +if not c: +break +reads += c +self.assertEquals(reads, "AA\nBB") +# read in amounts equal to TextIOWrapper._CHUNK_SIZE which is 128. +def testReadByChunk(self): +# make sure "\r\n" straddles 128 char boundary. +txt = io.TextIOWrapper(io.BytesIO(b"A" * 127 + b"\r\nB")) +reads = "" +while True: +c = txt.read(128) +if not c: +break +reads += c +self.assertEquals(reads, "A"*127+"\nB") + # XXX Tests for open() class MiscIOTest(unittest.TestCase): ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: On 11/6/07, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: > - it reads a complete chunk for just one more byte > - the re-read should be disabled when lineends are not translated > these two are minor annoyance and can be easily corrected, but: > > - there is no limit to the re-read; it can exhaust the memory if the > source is a big file with many \r (like a Mac text file) Yes. reading another chunk is not an optimal solution but after seeing Guido's comment, I now agree that I shouldn't try to read at all. I will work on modifications. > I will try to write these test cases if you want. That will definitely be useful. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: Hi Amaury and Christian, io3.diff does replacenl() in adjust_chunk() (trying Amaury's suggestion). Can you see if it fixes test_mailbox failures? Added file: http://bugs.python.org/file8708/io3.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __Index: Lib/io.py === --- Lib/io.py (revision 58902) +++ Lib/io.py (working copy) @@ -1075,7 +1075,8 @@ self._pending = "" self._snapshot = None self._seekable = self._telling = self.buffer.seekable() - +self._nl_straddle = False + @property def encoding(self): return self._encoding @@ -1136,16 +1137,35 @@ decoder = self._decoder = make_decoder() # XXX: errors return decoder +def _adjust_chunk(self, readahead, pending): +if self._readtranslate: +if self._nl_straddle and pending and pending[0] == "\n": +pending = pending[1:] +# should not adjust readahead as otherwise, it can become nul and +# terminate read loop in self.read() incorrectly. +# readahead = readahead[1:] +self._nl_straddle = False +if pending and pending[-1] == "\r": +self._nl_straddle = True +else: +self._nl_straddle = False + +pending = self._replacenl(pending) + +return readahead, pending + def _read_chunk(self): if self._decoder is None: raise ValueError("no decoder") if not self._telling: readahead = self.buffer.read1(self._CHUNK_SIZE) pending = self._decoder.decode(readahead, not readahead) -return readahead, pending +return self._adjust_chunk(readahead, pending) + decoder_buffer, decoder_state = self._decoder.getstate() readahead = self.buffer.read1(self._CHUNK_SIZE) pending = self._decoder.decode(readahead, not readahead) +readahead, pending = self._adjust_chunk(readahead, pending) self._snapshot = (decoder_state, decoder_buffer + readahead, pending) return readahead, pending @@ -1244,6 +1264,10 @@ res = self._pending if n < 0: res += decoder.decode(self.buffer.read(), True) +if self._readtranslate: +if self._nl_straddle and res and res[0] == "\n": +res = res[1:] +self._nl_straddle = False self._pending = "" self._snapshot = None return self._replacenl(res) @@ -1253,8 +1277,9 @@ res += pending if not readahead: break +# res = self._replacenl(res) self._pending = res[n:] -return self._replacenl(res[:n]) +return res[:n] def __next__(self): self._telling = False ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: I am attaching another patch (io2.diff). Please review. I am not sure whether _adjust_chunk() should also adjust "readahead". BTW, PEP 3116 says: "If universal newlines without translation are requested on input (i.e. newline=''), if a system read operation returns a buffer ending in '\r', another system read operation is done to determine whether it is followed by '\n' or not. In universal newlines mode with translation, the second system read operation may be postponed until the next read request, and if the following system read operation returns a buffer starting with '\n', that character is simply discarded." I suppose this issue is mainly talking about the latter (newline is None). I don't understand what is meant by "enabling universal new line mode without translation". Isn't the purpose of enabling universal new line mode is to translate line endings? I may be missing something basic, of course. Added file: http://bugs.python.org/file8706/io2.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __Index: Lib/io.py === --- Lib/io.py (revision 58902) +++ Lib/io.py (working copy) @@ -1075,7 +1075,8 @@ self._pending = "" self._snapshot = None self._seekable = self._telling = self.buffer.seekable() - +self._nl_straddle = False + @property def encoding(self): return self._encoding @@ -1136,16 +1137,31 @@ decoder = self._decoder = make_decoder() # XXX: errors return decoder +def _adjust_chunk(self, readahead, pending): +if self._readtranslate: +if self._nl_straddle and pending and pending[0] == "\n": +pending = pending[1:] +# readahead = readahead[1:] +self._nl_straddle = False +if pending and pending[-1] == "\r": +self._nl_straddle = True +else: +self._nl_straddle = False + +return readahead, pending + def _read_chunk(self): if self._decoder is None: raise ValueError("no decoder") if not self._telling: readahead = self.buffer.read1(self._CHUNK_SIZE) pending = self._decoder.decode(readahead, not readahead) -return readahead, pending +return self._adjust_chunk(readahead, pending) + decoder_buffer, decoder_state = self._decoder.getstate() readahead = self.buffer.read1(self._CHUNK_SIZE) pending = self._decoder.decode(readahead, not readahead) +readahead, pending = self._adjust_chunk(readahead, pending) self._snapshot = (decoder_state, decoder_buffer + readahead, pending) return readahead, pending @@ -1244,6 +1260,10 @@ res = self._pending if n < 0: res += decoder.decode(self.buffer.read(), True) +if self._readtranslate: +if self._nl_straddle and res and res[0] == "\n": +res = res[1:] +self._nl_straddle = False self._pending = "" self._snapshot = None return self._replacenl(res) @@ -1253,8 +1273,9 @@ res += pending if not readahead: break +res = self._replacenl(res) self._pending = res[n:] -return self._replacenl(res[:n]) +return res[:n] def __next__(self): self._telling = False Index: Lib/test/test_io.py === --- Lib/test/test_io.py (revision 58902) +++ Lib/test/test_io.py (working copy) @@ -485,6 +485,10 @@ class TextIOWrapperTest(unittest.TestCase): +def setUp(self): +self.testdata = b"AAA\r\nBBB\rCCC\r\nDDD\nEEE\r\n" +self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ASCII") + def tearDown(self): test_support.unlink(test_support.TESTFN) @@ -741,7 +745,59 @@ print("Reading using readline(): %6.3f seconds" % (t3-t2)) print("Using readline()+tell(): %6.3f seconds" % (t4-t3)) +def test_issue1395_1(self): +txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ASCII") +# read one char at a time +reads = "" +while True: +c = txt.read(1) +if not c: +break +reads += c +self.assertEquals(reads, self.normalized) + +def test_issue1395_2(self): +txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ASCII"
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: > The new patch fixes test_netrc for me but test_csv and test_mailbox are > still broken. Unfortunately, I am not able to build python on windows so I can not test there. Can you post the exact errors? You can send me private email as well if you think the test output would clutter this issue. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1210] imaplib does not run under Python 3
Raghuram Devarakonda added the comment: I will see what I can do but it may take a while. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1210> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: Considering that test_csv is failing on windows even without any changes related to this issue, I looked at it and came up with this patch: - Index: Lib/test/test_csv.py === --- Lib/test/test_csv.py(revision 58914) +++ Lib/test/test_csv.py(working copy) @@ -375,7 +375,7 @@ class TestCsvBase(unittest.TestCase): def readerAssertEqual(self, input, expected_result): -with TemporaryFile("w+") as fileobj: +with TemporaryFile("w+", newline='') as fileobj: fileobj.write(input) fileobj.seek(0) reader = csv.reader(fileobj, dialect = self.dialect) - Does this look ok? The tests pass on windows and Linux. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: On 11/8/07, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: > OK, I have taken another approach which seems to work (see io4.diff): > It uses an IncrementalNewlineDecoder, which wraps the initial (e.g. > utf-8) decoder. I like this approach even though I haven't looked at the patch in detail. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: On 11/8/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I do think there is something iffy here -- the 2.x version of this > test opens the files in binary mode. I wonder what end users are > supposed to do. I think that requirement (need to open in binary mode) is no more present in 3.0. As per revision 56777 (#1767398), csv module seems to support unicode strings and as such I would expect that files *should not* be opened in binary mode (This requires doc change both in csv doc and "what's new in 3.0). The tests in test_csv are explicitly writing "\r\n" which seems to be a hangover from 2.x. We seem to have side-stepped the problem by passing "newline=''" at some places but the real fix may be changing "\r\n"s to "\n" now that the temp files are being opened in text mode. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1210] imaplib does not run under Python 3
Raghuram Devarakonda added the comment: Index: Lib/imaplib.py === --- Lib/imaplib.py (revision 58956) +++ Lib/imaplib.py (working copy) @@ -228,7 +228,7 @@ self.port = port self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((host, port)) -self.file = self.sock.makefile('rb') +self.file = self.sock.makefile('r', encoding='ASCII', newline='') def read(self, size): - This patch fixes the issue but I am not entirely sure that it is correct. I quickly looked at IMAP RFC and there does seem to be spec for CHARSET in which case, that will have to be used instead of ASCII. It requires more research and imap knowledge which I can't claim. As for the tests, we need a imap server to connect to. Perhaps, google wouldn't mind being used for this purpose? __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1210> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1429] FD leak in SocketServer
Raghuram Devarakonda added the comment: Please provide a small test code that manifests the problem. It is always the best way to get quick response. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1429> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1466] Special reporting of NotImplementedError in unittest
Raghuram Devarakonda added the comment: I don't think unittest automatically treats all exceptions as failures. Failures are those that are explicitly flagged with assert* and fail* methods. All other exceptions result in "errors". I think what you are asking for is to special case one such error but am not sure if it is worth it. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1466> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1466] Special reporting of NotImplementedError in unittest
Raghuram Devarakonda added the comment: > Possible, but cumbersome. You have to analyze each case and see if it Have you tried to write a Test Runner that ignores NotImplementedError? You may have to override TestResult.addError. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1466> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1467] error in TestResult.addError and TestResult.addFailure
New submission from Raghuram Devarakonda: The page at http://docs.python.org/dev/library/unittest.html#module-unittest says: - TestResult.addError(test, err) Called when the test case test raises an unexpected exception err is a tuple of the form returned by sys.exc_info(): (type, value, traceback). The default implementation appends (test, err) to the instance's errors attribute. -- Starting from 2.2, a formatted traceback is added to the "error" attribute instead of the actual sys.exc_info(). The same error is present for addFailure() as well. -- components: Documentation messages: 57663 nosy: draghuram severity: minor status: open title: error in TestResult.addError and TestResult.addFailure versions: Python 2.6 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1467> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9857] SkipTest in tearDown is reported an as an error
Changes by Raghuram Devarakonda : -- nosy: +draghuram ___ Python tracker <http://bugs.python.org/issue9857> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3002] shutil.copyfile blocks indefinitely on named pipes
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: I am not sure if copyfile() should be trying to copy named pipes (or any other special files for that matter). The best way is perhaps to check and skip such files. -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3002> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3053] test_shutil fails under AIX
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: Is there any particular reason to assert for failed function at all? This test seems to be for 'onerror' function and the test would be valid even without asserting whether the failed API is 'remove' or 'listdir' etc. Isn't it? -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3053> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3058] Let SimpleXMLRPCServer pass client_address to called functions.
Changes by Raghuram Devarakonda <[EMAIL PROTECTED]>: -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3058> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3115] os.listdir randomly fails on occasions when it shouldn't
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: Isn't this similar to #1608818? -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3115> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2571] cmd.py always uses raw_input, even when another stdin is specified
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: Richard, I see the following very clearly mentioned in the doc: "If you want a given stdin to be used, make sure to set the instance’s use_rawinput attribute to False, otherwise stdin will be ignored." Even though this seems like unnecessary, at least it is documented. If you want to push for automatically setting use_rawinput when 'stdin' is not None, you will need to submit a patch and convince some core developer to agree with you. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2571> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3134] shutil references undefined WindowsError symbol
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: This is same as #2549 which also reported the same problem. In fact, the problem was originally found in #1545. As I said there, the proposed patch has a very small problem. Can you please take a look? -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3134> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2571] cmd.py always uses raw_input, even when another stdin is specified
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: On Wed, Jun 18, 2008 at 9:28 PM, Richard King <[EMAIL PROTECTED]> wrote: > > Richard King <[EMAIL PROTECTED]> added the comment: > > There were some other things I wanted too so I just made my own cmd.py. Yes. Lot of people seem to use their own versions of cmd.py. Recently, I also implemented another class on top of cmd.Cmd in order to have more useful functionality. I have seen at least three implementations ('cmdln' on googlecode, 'CommandLoop' and 'cmd2' on pypi). I hope that after some heavy use, I will be able to submit some patches to the standard library module. There is already one in #1294. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2571> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3134] shutil references undefined WindowsError symbol
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: I submitted a patch at http://codereview.appspot.com/2384. Please take a look. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3134> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: I have submitted a patch (http://codereview.appspot.com/2384) for WindowsError issue as it is reported in two other bugs #3134 and #2549. I have only tested on Linux so I would appreciate if some one who have access to windows can test it as well. Considering that the fix is simple and more bugs are being opened for the same problem, it is worthwhile to check this in quickly. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2549] shutil: NameError (WindowsError) when moving from ext3 to fat32 under linux
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: This is duplicate of 3134. I posted a patch there. -- resolution: -> duplicate status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2549> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3134] shutil references undefined WindowsError symbol
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: > Patch works under Windows. Thanks. Can you please commit the change? ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3134> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: WindowsError issue is now fixed in r65644. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3580] failures in test_os
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: > The other failure is trivial, I've fixed it in r65780. #1709112 has been reported earlier in relation to pagefile.sys. Your patch addresses at least part of the problem there. I wonder if that issue can be closed. -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3580> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3580] failures in test_os
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: On Mon, Aug 18, 2008 at 10:28 AM, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > Since the purpose of the test is, allegedly, to "Verify that an open > file can be stat'ed", it may be simpler to create and open a file > ourselves (test_support.TESTFN being an obvious candidate :-)), and No. Any open file does not do. There has been a discussion on python-dev some time back about replacing the use of pagefile.sys with a temporarily created open file. But the problem that spawned this test case does not occur with just any open file. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3580> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3728] imaplib module broken by str to unicode conversion
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: This seems to be duplicate of #1210. -- nosy: +draghuram resolution: -> duplicate status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3728> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3937] platform.dist(): detect Linux distribution version in a robust, standard way
Raghuram Devarakonda <[EMAIL PROTECTED]> added the comment: Please take a look at #1322 for some discussion on this topic. -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3937> ___ ___ 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
Changes by Raghuram Devarakonda <[EMAIL PROTECTED]>: -- nosy: +draghuram ___ 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
[issue8692] Use divide-and-conquer for faster factorials
Changes by Raghuram Devarakonda : -- nosy: +draghuram ___ Python tracker <http://bugs.python.org/issue8692> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda added the comment: I agree with Facundo that it is not good to hide the error. It should be up to the caller to ignore the error. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1706039] Added clearerr() to clear EOF state
Raghuram Devarakonda added the comment: I get an error when I try to read 1523853. Is this not moved to the new tracker or others are able to access it? -- nosy: +draghuram _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1706039> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda added the comment: > try: > > except os.error, err: > if WindowsError is not None or not isinstance(err, WindowsError): > raise # Pretend we didn't catch it > pass # Ignore it All the double negations are hurting when I try to understand above conditions. How about (in addition to the WindowsError name check): if WindowsError and isinstance(err, WindowsError): pass # ignore raise __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda added the comment: > You're right, my code was wrong. Yours will be be correct if you add > "else:" in front of the raise. I also still prefer "WindowsError is Yeah. I was just about to correct my code when I saw your response. I should not post just before leaving work for home :-) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: My patch adds very sensible default behaviour when Ctrl-C or Ctrl-D are entered. It follows the tradition of many unix programs such as bash and bc which exit on Ctrl-D and ignore Ctrl-c in one way or another. Most importantly, a user can always override the behaviour but I expect the added functionality would suffice in most if not all cases. Do you mind opening the issue in the hope that we can have more comments? __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1294> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: > I will look into this for 2.6. No promises. Somebody ought to check > whether this does not cause problems for pdb. Thanks. I will check about pdb tomorrow. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1294> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda added the comment: The change looks fine as per yesterday's discussion. Can you submit the actual patch? it needs to include check for WindowsError name. BTW, I would put a comment when the exception is being ignored on windows. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda added the comment: Some comments about shutil.diff: 1) This seems to be against 2.5. You would be better off submitting a patch against trunk. In case of bug fixes, it will usually be back ported. This particular change is not a bug fix though. 2) patches should be either context diff or preferably unified diffs. In addition, a patch should be a forward diff (diff . It is best to simply do "svn diff". 3) Now for the actual content of the patch, it must be noted that ignoring WindowsError in copy2 breaks compatibility. Not that there is any reason for any one to be depending on it, but I just thought I would point it out. In any case, it will require slight doc change. Lastly, just to be clear, the original problem reported in this bug would still remain. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Raghuram Devarakonda added the comment: There is a mistake in the patch. The line "if WindowsError is not None and isinstance(err, WindowsError):" in copytree() should use the name 'why' and not 'err'. Unfortunately I can't test on windows, but you didn't get NameError when you tested copytree() on windows? __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1545> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1577] shutil.move() does not use os.rename() if dst is a directory
Raghuram Devarakonda added the comment: Since we already have os.rename, wouldn't it be better for shutil.move() to be closer to command line 'mv'? I think Facundo's approach should work. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1577> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1577] shutil.move() does not use os.rename() if dst is a directory
Raghuram Devarakonda added the comment: Then, a small change in the doc might clarify the usage (as OP suggested); "If the destination is on our current filesystem, then simply use rename." can be replaced with: "If the destination is a fiile and is on same filesystem as that of src, then simply use rename." __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1577> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: "Tomorrow" took a while to come by :-) With out the patch, pdb prints this on Ctrl-C: "KeyboardInterrupt Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program" With the patch, pdb prompt appears again. Ctrl-D change doesn't effect pdb because do_EOF() is already implemented. My test was on SuSE 10 Linux. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1294> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1606] Doc: subprocess wait() may lead to dead lock
Raghuram Devarakonda added the comment: Look at #1256 for similar report. A doc change was suggested there as well. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1606> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1669] shutil.rmtree fails on symlink, after deleting contents
Raghuram Devarakonda added the comment: Please try to include stack trace in bug reports. I reproduced the error on my Linux (SuSE 10). marvin:tmp$ ls -l dirlink testdir lrwxrwxrwx 1 raghu users7 2007-12-20 10:10 dirlink -> testdir/ testdir: total 0 -rw-r--r-- 1 raghu users 0 2007-12-20 10:36 testfile shutil.rmtree('dirlink') produces: -- Traceback (most recent call last): File "t.py", line 4, in shutil.rmtree('dirlink') File "/localhome/raghu/localwork/cpython/python/Lib/shutil.py", line 194, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/localhome/raghu/localwork/cpython/python/Lib/shutil.py", line 192, in rmtree os.rmdir(path) OSError: [Errno 20] Not a directory: 'dirlink' -- While we are removing the contents of the target directory as expected, the final 'rmdir' fails on removing the symbolic link. For the sake of consistency, we can explicitly remove the target directory and leave the symbolic link intact. Is this what you are expecting? -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1669> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1669] shutil.rmtree fails on symlink, after deleting contents
Raghuram Devarakonda added the comment: I am ok with disallowing symlinks in rmtree() because if it were to be allowed, the semantics are not clear. In addition, neither 'rmdir' nor 'rm -rf' delete the target directory. The attached patch would raise error if symbolic link is passed to rmtree. Even though there is a parameter 'ignore_errors", I don't think it should be used in suppressing symbolic link error. Comments? Added file: http://bugs.python.org/file9015/rmtree.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1669> __Index: Lib/shutil.py === --- Lib/shutil.py (revision 59581) +++ Lib/shutil.py (working copy) @@ -140,7 +140,8 @@ raise Error, errors def rmtree(path, ignore_errors=False, onerror=None): -"""Recursively delete a directory tree. +"""Recursively delete a directory tree. Fail if path is symbolic +link. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, @@ -150,6 +151,10 @@ is false and onerror is None, an exception is raised. """ + +if os.path.islink(path): +raise ValueError('path can not be symbolic link') + if ignore_errors: def onerror(*args): pass ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1669] shutil.rmtree fails on symlink, after deleting contents
Raghuram Devarakonda added the comment: Index: Lib/shutil.py === --- Lib/shutil.py (revision 59581) +++ Lib/shutil.py (working copy) @@ -156,6 +156,16 @@ elif onerror is None: def onerror(*args): raise + +try: +if os.path.islink(path): +if ignore_errors: +return +else: +raise IOError('path can not be symbolic link') +except IOError, err: +onerror(os.path.islink, path, sys.exc_info()) + names = [] try: names = os.listdir(path) --- How does this look? The error handling is slightly different for this case because it can not continue if 'ignore_errors' is True. I will update the doc if the code change is ok. On Dec 20, 2007 12:43 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Guido van Rossum added the comment: > > Thanks for the patch. I think it should raise IOError, not ValueError, > and it should use the onerror() handling used for all other errors. > Also, can you include an update for the docs in the Doc tree? > > > __ > Tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue1669> > __ > __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1669> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1675] Race condition in os.makedirs
Raghuram Devarakonda added the comment: I don't think os.makedirs() can do anything here. It should be caller's responsibility to check for this kind of issues. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1675> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1728] distutils.cmd breaks inspect
Raghuram Devarakonda added the comment: I can't reproduce it with 2.5.1 on SuSE 10. Can you please report the exact traceback you see? -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1728> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1728] distutils.cmd breaks inspect
Raghuram Devarakonda added the comment: When I printed the file name that is being passed to linecache.getlines() by findsource(), the file name is absolute path. So there may be nothing wrong with linecache itself. Can you see what is the name being passed in your case? We still need to trace what specific setting on OP's system is causing the problem. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1728> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1243] option.dest not set when callback called with optparse
Raghuram Devarakonda added the comment: I was under the impression that no change is necessary but I will take a closer look and will see if something needs to be done. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1243> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1243] option.dest not set when callback called with optparse
Raghuram Devarakonda added the comment: > Hm, perhaps I misinterpreted the discussion. If no patch is necessary, > please close as won't fix or invalid. I spent some time looking at optparse code and OP's request. _check_dest has a clear comment that says "dest" will be set iff a "store" action is selected (which callback is not) or if a "type" is given. But from the code itself, I don't see how setting "dest" in all cases would be bad. Do you want to assign this to Greg Ward to ask his opinion? Also, it doesn't look like we can directly patch optparse.py as it seems to be auto-generated. On a side note, I don't have tracker permissions to change status. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1243> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1243] option.dest not set when callback called with optparse
Raghuram Devarakonda added the comment: FWIW, the change to _check_dest to always set 'dest' breaks quite a few tests. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1243> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1763] Winpath module - easy access to Windows directories like My Documents
Raghuram Devarakonda added the comment: The current 'path' modules such as posixpath and ntpath have functions that operate on a file path. But I see this module more as a way of getting information related to one's profile. So the name 'winpath' may not be a good choice. -- nosy: +draghuram __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1763> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1784] Error with OptionParser.parse_args()
New submission from Raghuram Devarakonda: Sorry for the generic title but I couldn't think of a better one. My attempt to do "svn up && make" failed with the following exception from setup.py: -- File "./setup.py", line 314, in detect_modules if options.dirs: AttributeError: Values instance has no attribute 'dirs' -- I isolated the problem to a small script. -- import optparse parser = optparse.OptionParser() parser.add_option("-I", dest="dirs", action="append") options = parser.parse_args(['-I.', '-IInclude', '-I./Include'])[0] if options.dirs: print "opt = ", options.dirs -- When run with 2.5.1, the script prints "opt = ['.', 'Include', './Include']" but python from trunk gives the error: Traceback (most recent call last): File "../opttest.py", line 6, in if options.dirs: AttributeError: Values instance has no attribute 'dirs' -- components: Library (Lib) messages: 59672 nosy: draghuram severity: normal status: open title: Error with OptionParser.parse_args() type: behavior versions: Python 2.6 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1784> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1784] Error with OptionParser.parse_args()
Raghuram Devarakonda added the comment: It is my mistake. I modified optparse.py for an earlier issue and that change is the cause of the problem reported here. Please close it as invalid. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1784> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1781] ConfigParser: add_section('DEFAULT') causes duplicate sections.
Raghuram Devarakonda added the comment: Please see cfgparser.diff for the fix. It has tests and doc change. -- nosy: +draghuram Added file: http://bugs.python.org/file9118/cfgparser.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1781> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1781] ConfigParser: add_section('DEFAULT') causes duplicate sections.
Raghuram Devarakonda added the comment: I should add that the patch disallows not only 'DEFAULT' but all other variants such as "Default" and "default". I am not entirely sure if my description of this behaviour as "DEFAULT or any of it's case-insensitive variants". __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1781> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1725737] Distutils default exclude doesn't match top level .svn
Raghuram Devarakonda added the comment: I suggest this bug be closed as invalid. _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1725737> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: bugday task? __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1294> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: Ok. BTW, can I get tracker permissions? I will try to check old bugs to update their information and if required, close them. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1294> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: > I've added developer status to your username. Let me know if it doesn't > work. It does. Thanks. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1294> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1781] ConfigParser: add_section('DEFAULT') causes duplicate sections.
Changes by Raghuram Devarakonda: -- keywords: +easy, patch __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1781> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1693149] patch to make 'trace.py --ignore-module' accept module name list.
Raghuram Devarakonda added the comment: The patch trace.diff contains the code and doc change. -- keywords: +easy severity: normal -> title: trace.py --ignore-module should accept module name list. -> patch to make 'trace.py --ignore-module' accept module name list. type: -> rfe Added file: http://bugs.python.org/file9196/trace.diff _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1693149> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1693149] trace.py --ignore-module should accept module name list.
Changes by Raghuram Devarakonda: Removed file: http://bugs.python.org/file7923/trace_patch.diff _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1693149> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1183712] package_data chops off first char of default package
Raghuram Devarakonda added the comment: Closing this as the required code change is committed (as part of #1720897). -- resolution: -> fixed status: open -> closed _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1183712> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1669] shutil.rmtree fails on symlink, after deleting contents
Raghuram Devarakonda added the comment: If rmtree() always returns in case of symbolic links (as it is checked-in), wouldn't it be much simpler to totally do away with 'onerror' handling? I thought 'onerror' gives the user the option how to proceed (which is true in other usages). __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1669> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1577] shutil.move() does not use os.rename() if dst is a directory
Changes by Raghuram Devarakonda: -- components: +Documentation -Library (Lib) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1577> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1669] shutil.rmtree fails on symlink, after deleting contents
Raghuram Devarakonda added the comment: > and it should use the onerror() handling used for all other errors" > which makes sense for me too. Sure. I am ok with using 'onerror'. The point I am trying to make is that there is slight difference between 'onerror' in this case and in the three other places where it is called. In the case of symlink, rmtree() returns even when 'onerror' doesn't raise exception. This is not same in the other cases where rmtree() continues. I am just wondering if this inconsistency is worth it and if it is, an explicit mention in the doc will be nice. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1669> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1706039] Added clearerr() to clear EOF state
Changes by Raghuram Devarakonda: -- nosy: -draghuram _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1706039> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue479195] Put Demo/rpc/rpc.py into standard lib
Raghuram Devarakonda added the comment: I started looking at the bugs in chronological order in the hope that I can close some issues that don't make sense any more. Can I close this one? I am almost sure that this module is not going to be included in stdlib (I myself haven't used this module, though). -- nosy: +draghuram, gvanrossum Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue479195> ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue479195] Put Demo/rpc/rpc.py into standard lib
Raghuram Devarakonda added the comment: Closing as there is no activity for long time and the request is unlikely to be accepted, anyway. -- resolution: -> rejected status: open -> closed Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue479195> ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue491331] request sys.required_version
Raghuram Devarakonda added the comment: should have been closed long time back :-). -- nosy: +draghuram resolution: -> rejected status: open -> closed Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue491331> ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com