[issue12381] bytearray methods count, find, index don't support None as in slice notation

2011-06-21 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue12381> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue10376] ZipFile unzip is unbuffered

2011-06-06 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue10376> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue12170] Bytes.index() and bytes.count() should accept byte ints

2011-06-06 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue12170> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue9938] Documentation for argparse interactive use

2011-05-29 Thread Xuanji Li
Xuanji Li added the comment: Updated previous patch with test cases and renamed exit_on_argument_error flag to exit_on_error. -- Added file: http://bugs.python.org/file22172/issue9938_with_test.patch ___ Python tracker <http://bugs.python.

[issue9723] Add shlex.quote

2011-04-27 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue9723> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11874] argparse assertion failure with brackets in metavars

2011-04-27 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue11874> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11588] Add "necessarily inclusive" groups to argparse

2011-04-27 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue11588> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue3451] Asymptotically faster divmod and str(long)

2011-04-27 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue3451> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue9938] Documentation for argparse interactive use

2011-04-27 Thread Xuanji Li
Xuanji Li added the comment: I don't think it's best to create a new subclass to throw an ArgumentParserExit exception; if I read the stack trace I'd see that an ArgumentError was thrown, then caught, then an ArgumentParserExit was thrown, which IMHO is confusing. In the

[issue5723] Incomplete json tests

2011-04-26 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue5723> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11872] cPickle gives strange error for large objects.

2011-04-26 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue11872> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue5115] Extend subprocess.kill to be able to kill process groups

2011-04-26 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue5115> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11837] smtplib._quote_periods triggers spurious type error in re.sub

2011-04-26 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue11837> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue10694] zipfile.py end of central directory detection not robust

2011-03-21 Thread Xuanji Li
Xuanji Li added the comment: Hi, can someone look at the patch? There doesn't seem to be any objections to it and it'll solve a long-standing issue. Thanks! -- ___ Python tracker <http://bugs.python.o

[issue11127] sockets should not be pickleable

2011-02-20 Thread Xuanji Li
Xuanji Li added the comment: the correct way is to provide a __getstate__ method for socket right? I have implemented that in the attached patch. -- keywords: +patch nosy: +xuanji Added file: http://bugs.python.org/file20803/issue11127.patch

[issue5231] Change format of a memoryview

2011-02-13 Thread Xuanji Li
Xuanji Li added the comment: Is this issue from 2 years ago still open? I checked the docs and it seems to be. If it is, I would like to work on a patch and submit it soon. -- ___ Python tracker <http://bugs.python.org/issue5

[issue5231] Change format of a memoryview

2011-02-13 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue5231> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue11160] ZipFile.comment expects bytes

2011-02-09 Thread Xuanji Li
New submission from Xuanji Li : The documentation for zipfile describes ZipFile.comment as "The comment text associated with the ZIP file." From reading this I expect that setting it to a string is ok; however ZipFile.comment must actually be set to bytes (or a bytes-like object

[issue10694] zipfile.py end of central directory detection not robust

2011-02-09 Thread Xuanji Li
Xuanji Li added the comment: I've attached a patch copying rep's patch from issue 10298, as i think it is cleaner (but it seems to do the same thing as kevin's patch) together with 2 test cases. David Murray: I'm not really sure what you mean by "test comments w

[issue3243] Support iterable bodies in httplib

2011-01-15 Thread Xuanji Li
Xuanji Li added the comment: Yes, I think we should close it. -- ___ Python tracker <http://bugs.python.org/issue3243> ___ ___ Python-bugs-list mailing list Unsub

[issue10044] small int optimization

2010-12-30 Thread Xuanji Li
Xuanji Li added the comment: fwiw I've always found this helpful for undefined behavior: http://blog.regehr.org/archives/213 and, just as it says "x+1 > x" will be optimized to a nop, by the same logic "v >= &array[0] && v < &array

[issue10694] zipfile.py end of central directory detection not robust

2010-12-30 Thread Xuanji Li
Xuanji Li added the comment: Ok, new patch that creates a zipfile (actually I used TESTFN2, all the other tests seem to also use it) -- Added file: http://bugs.python.org/file20200/Issue10694_2.diff ___ Python tracker <http://bugs.python.

[issue10694] zipfile.py end of central directory detection not robust

2010-12-21 Thread Xuanji Li
Xuanji Li added the comment: Sorry, forgot to add: README.zip should have a \r\n at the end. Actually I just zipped up README, ran echo "\r\n" >> README.zip and put it in Lib/test. -- ___ Python tracker <http://bugs.py

[issue10694] zipfile.py end of central directory detection not robust

2010-12-21 Thread Xuanji Li
Xuanji Li added the comment: Hi KevinH, sorry if I gave the wrong impression that you must submit a patch before anyone will look at the bug. I thought you wanted to provide a patch for this. If you only want to report a bug that is ok, thanks for that. I have confirmed your bug on the py3k

[issue10702] bytes and bytearray methods are not documented

2010-12-19 Thread Xuanji Li
Xuanji Li added the comment: Hi, it seems to me that section 4.6.5. Bytes and Byte Array Methods covers this already. It says: Bytes and bytearray objects, being “strings of bytes”, have all methods found on strings, with the exception of encode(), format() and isidentifier(), which do not

[issue10702] bytes and bytearray methods are not documented

2010-12-19 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue10702> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue9938] Documentation for argparse interactive use

2010-12-19 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue9938> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2010-12-19 Thread Xuanji Li
Changes by Xuanji Li : -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue10680> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue3243] Support iterable bodies in httplib

2010-12-19 Thread Xuanji Li
Xuanji Li added the comment: Also, I am not familiar with the backward-comparability requirements of py3k, but orsenthil's patch will break py3k code that relies on data being a string, shouldn't this be mentioned somewhere? Finally, I do not understand why my proposed change, w

[issue3243] Support iterable bodies in httplib

2010-12-19 Thread Xuanji Li
Xuanji Li added the comment: Also, the patch for request.py contains a debug statement, print(data) -- ___ Python tracker <http://bugs.python.org/issue3

[issue3243] Support iterable bodies in httplib

2010-12-19 Thread Xuanji Li
Xuanji Li added the comment: Hello, sorry for commenting on a closed issue... but I think the documentation change is incorrect. In urllib.request.rst, it says data is a string. However as seen in the changes to test_urllib2.py, data must be a bytes object rather than a string object. I

[issue10695] telnetlib.Telnet port number int/str inconsistency

2010-12-14 Thread Xuanji Li
Xuanji Li added the comment: Hi, is there any legacy code that would rely on "port" being stored as a string rather than an integer? -- ___ Python tracker <http://bugs.python.o

[issue10694] zipfile.py end of central directory detection not robust

2010-12-14 Thread Xuanji Li
Xuanji Li added the comment: Hi, I would like to take a look at whether your code works, can you provide an zip file that is currently not read by zipfile but should be? Also, I suggest you submit the code changes as a patch (http://www.python.org/dev/patches/) thanks! -- nosy

[issue10695] telnetlib.Telnet port number int/str inconsistency

2010-12-14 Thread Xuanji Li
Xuanji Li added the comment: Alternatively, I think we can do a conversion to int in Telnet.__init__ (see patch) -- keywords: +patch nosy: +xuanji Added file: http://bugs.python.org/file20035/issue10695.patch ___ Python tracker <h

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-12-14 Thread Xuanji Li
Xuanji Li added the comment: Sorry, I'm giving up. The copyright notice for bz2module.c lists "Gustavo Niemeyer" as one of the holders, is he the maintainer? Maybe he should be notified of this bug. -- ___ Python tracker <http

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-12-04 Thread Xuanji Li
Xuanji Li added the comment: I'll try working on a patch. -- nosy: +xuanji ___ Python tracker <http://bugs.python.org/issue5863> ___ ___ Python-bugs-list m

[issue3243] Support iterable bodies in httplib

2010-12-02 Thread Xuanji Li
Xuanji Li added the comment: eric: sorry, that has been fixed in issue_3243_py3k_7.patch -- ___ Python tracker <http://bugs.python.org/issue3243> ___ ___ Pytho

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Xuanji Li added the comment: thought of a better way, we can check if data is true; this will cover "" and b"". this is in issue_3243_py3k_7.patch -- Added file: http://bugs.python.org/file19902/issue_3243_py3k_7.patch ___ P

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Xuanji Li added the comment: Actually I don't think you can go around changing test_urllib2.py, they are after all regression tests... and surely some users will send "" as data. My patch handles the case of 0-length data specially, removing the need for 2) Can call len

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Xuanji Li added the comment: And my version too... -- Added file: http://bugs.python.org/file19901/issue_3243_py3k_6.patch ___ Python tracker <http://bugs.python.org/issue3

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Xuanji Li added the comment: > > 2) Can call len but not buffer: assume len == #bytes > Why do you need it at all? Hmm, I'm looking at the the tests in urllib2 that fail if we omit this... in test_urllib2 there are tests that do this: req = Request("http://example.co

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Changes by Xuanji Li : Removed file: http://bugs.python.org/file19892/issue_3243_py3k_5.patch ___ Python tracker <http://bugs.python.org/issue3243> ___ ___ Python-bug

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Xuanji Li added the comment: attaching new patch. this implements the memoryview solution suggested by pitrou. but it does contain this thing: if not request.has_header('Content-length'): if (not hasattr(data, '__read__') and isinstance(data, collections.Itera

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Xuanji Li added the comment: attaching new patch. this implements the memoryview solution suggested by pitrou. but it does contain this thing: if not request.has_header('Content-length'): if (not hasattr(data, '__read__') and isinstance(data, collections.Itera

[issue3243] Support iterable bodies in httplib

2010-12-01 Thread Xuanji Li
Xuanji Li added the comment: orsenthil: Hi, i don't quite understand why iter() needs to be called explicitly on data? As I understand it, if data is an iterable then you can use a for loop on it directly. -- ___ Python tracker

[issue3243] Support iterable bodies in httplib

2010-11-30 Thread Xuanji Li
Xuanji Li added the comment: So, reading all your comments, I gather that my proposed patch for client.py which is try: self.sock.sendall(data) except TypeError: if isinstance(data, collections.Iterable): for d in t: self.sock.sendall(d) else

[issue3243] Support iterable bodies in httplib

2010-11-30 Thread Xuanji Li
Xuanji Li added the comment: davide: yeah, hasattr("lol", '__next__') == False, even though strings are Iterable; so for strings and other such sequences the len(data) line will be executed. So technically we shouldn't say "No Content-Length specified for iterab

[issue3243] Support iterable bodies in httplib

2010-11-30 Thread Xuanji Li
Xuanji Li added the comment: I don't fully understand Lib/urllib/request.py either, I just ported it and ran the unittests... it seems like what it does is that if you send an iterator through as 'data' you can't know the length in advance, and rather than let the

[issue10464] netrc module not parsing passwords containing #s.

2010-11-30 Thread Xuanji Li
Xuanji Li added the comment: bumping...can someone review this? The reported bug seems valid enough. -- ___ Python tracker <http://bugs.python.org/issue10

[issue3243] Support iterable bodies in httplib

2010-11-30 Thread Xuanji Li
Xuanji Li added the comment: pitrou: actually that seems a bit suspect now... you need to handle 'data' differently depending on its type, and while you can determine the type by finding out when 'data' throws certain exceptions, it doesn't seem like what

[issue3243] Support iterable bodies in httplib

2010-11-29 Thread Xuanji Li
Xuanji Li added the comment: pitrou: that sounds good. I attached another patch. -- Added file: http://bugs.python.org/file19879/issue_3243_py3k_3.patch ___ Python tracker <http://bugs.python.org/issue3

[issue3243] Support iterable bodies in httplib

2010-11-29 Thread Xuanji Li
Xuanji Li added the comment: Changed according to Raymond's suggestion. I realized that there are some classes (str, bytes, array.array) that are iterable but should not be handled by the iteration logic provided by catlee. eg: if we iterate through b'a message' we'd get

[issue3243] Support iterable bodies in httplib

2010-11-29 Thread Xuanji Li
Xuanji Li added the comment: What a timely coincidence. I'll try out the change soon. -- ___ Python tracker <http://bugs.python.org/issue3243> ___ ___ Pytho

[issue3243] Support iterable bodies in httplib

2010-11-28 Thread Xuanji Li
Xuanji Li added the comment: Hi Raymond, I assume you're referring to catlee's patch? 'str' has been changed to 'data' in python 3.2 While porting the patch I ran into this issue, which is that isinstance(str, collections.Iterable) doesn't be

[issue3243] Support iterable bodies in httplib

2010-11-28 Thread Xuanji Li
Xuanji Li added the comment: Hi, attached is a ported version of the patch that applies against py3k. -- nosy: +xuanji Added file: http://bugs.python.org/file19852/issue_3243_py3k.diff ___ Python tracker <http://bugs.python.org/issue3

[issue10496] "import site failed" when Python can't find home directory

2010-11-28 Thread Xuanji Li
Xuanji Li added the comment: I tried running bug.c using the svn head of python and got this: Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Fatal Python error: Py_Initialize: Unable to get the locale encoding

[issue10516] Add list.clear() and list.copy()

2010-11-27 Thread Xuanji Li
Xuanji Li added the comment: That's good if it's so... can you explain why list_clear doesn't guarantee that the list is empty? Why would XDECREF populate the list? I don't quite understand it. eli: are you writing a patch for this? -- __

[issue10516] Add list.clear() and list.copy()

2010-11-27 Thread Xuanji Li
Xuanji Li added the comment: Hi, I'm also looking at listobject.c also... if we want list.clear() to behave exactly like del list[], we may be able to just call list_ass_slice on the list. Similarly for list.copy which should behave like a=l[:] -- nosy: +x

[issue10464] netrc module not parsing passwords containing #s.

2010-11-25 Thread Xuanji Li
Xuanji Li added the comment: The patch attached (issue_10464_fix) moves handling of the '#' character from shlex to netrc, and makes netrc consider as comments lines whose first not-whitespace character is '#' instead of all text following '#' (which is what sh

[issue10366] Remove unneeded '(object)' from 3.x class examples

2010-11-21 Thread Xuanji Li
Xuanji Li added the comment: Hi eric, what doc change are you referring to? -- status: pending -> open ___ Python tracker <http://bugs.python.org/issu

[issue10464] netrc module not parsing passwords containing #s.

2010-11-20 Thread Xuanji Li
Xuanji Li added the comment: The issue seems to be that when shlex (the lexer that netrc uses) sees a '#' character it thinks that the rest of the line is a comment. I am not sure what the behavior of netrc should be - should it treat '#' as beginning a comment only

[issue10464] netrc module not parsing passwords containing #s.

2010-11-20 Thread Xuanji Li
Xuanji Li added the comment: Sorry, patch had a mistake -- Added file: http://bugs.python.org/file19666/issue_10231_testcase.diff ___ Python tracker <http://bugs.python.org/issue10

[issue10464] netrc module not parsing passwords containing #s.

2010-11-20 Thread Xuanji Li
Changes by Xuanji Li : Removed file: http://bugs.python.org/file19658/issue_10464_testcase.diff ___ Python tracker <http://bugs.python.org/issue10464> ___ ___ Python-bug

[issue10464] netrc module not parsing passwords containing #s.

2010-11-20 Thread Xuanji Li
Xuanji Li added the comment: Included test case for the reported bug. Test fails on my machine. Also split up test_case_1 (in order to put in the new test case cleanly) -- keywords: +patch nosy: +xuanji Added file: http://bugs.python.org/file19658/issue_10464_testcase.diff

[issue10366] Remove unneeded '(object)' from 3.x class examples

2010-11-12 Thread Xuanji Li
Xuanji Li added the comment: Attached a patch to implement the suggested changes on 3.2. If the patch is ok I can do the same for 3.1. -- keywords: +patch nosy: +xuanji Added file: http://bugs.python.org/file19591/issue10366_remove_unneeded_object_py3.2.diff