[issue6780] startswith error message is incomplete
Ezio Melotti ezio.melo...@gmail.com added the comment: In the examples you used byte strings for Py2 and Unicode strings for Py3. On Py3 the same example with byte strings gives an error similar to the one raised by Py2: bfoo.startswith([bfo]) Traceback (most recent call last): File stdin, line 1, in module TypeError: expected an object with the buffer interface (vs. Py2's expected a character buffer object) The error raised by Py2 with Unicode strings is more or less the same of Py3 too: ufoo.startswith([ufo, udf]) Traceback (most recent call last): File stdin, line 1, in module TypeError: coercing to Unicode: need string or buffer, list found (vs. Py3's Can't convert 'list' object to str implicitly) If I understood correctly the C code in /Objects/unicodeobject.c, this is because startswith checks if the 'prefix' is a tuple and, if not, it assumes that is a Unicode string. The 'prefix' is then converted to Unicode by PyUnicode_FromObject and if it's a list or some other object the error Can't convert 'list' object to str implicitly / coercing to Unicode: need string or buffer, list found is raised. I agree that a more explicit error message would be better, something like: 'prefix' must be a character buffer object or a tuple, not 'list'. Aside: why not try to convert 'list' object to tuple? If the support for lists is added, it should probably be extended to all the iterables, but strings are iterables too, so that will create some problem. It could be checked if 'prefix' is a string and if not assume that is an iterable of strings, but I don't know if it's worth doing it. -- components: +Interpreter Core -Library (Lib) nosy: +ezio.melotti priority: - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6780 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6744] calling kevent repr raises a TypeError
Changes by Benjamin Peterson benja...@python.org: -- assignee: - christian.heimes nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6744 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6738] Wrong doc strings in itertools
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6738 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6701] Make custom xmlrpc extension easier
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +krisvale priority: - normal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6701 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6738] Wrong doc strings in itertools
Changes by Benjamin Peterson benja...@python.org: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6738 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6662] HTMLParser.HTMLParser doesn't handle malformed charrefs
Ezio Melotti ezio.melo...@gmail.com added the comment: Confirmed on Python3.1 too. -- nosy: +ezio.melotti priority: - high ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6662 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6781] even exponentiation of negative numbers
New submission from benlbroussard benlbrouss...@gmail.com: Negative one squared should be one, but is negative one sometimes. pow(-1, 2) = 1 -1 ** 2 = -1 -1 ^ 2 = -1 The ** and ^ operators aren't working like expected, and the pow() documentation is incorrect since it says The two-argument form pow(x, y) is equivalent to using the power operator: x**y. -- components: None messages: 91951 nosy: benlbroussard severity: normal status: open title: even exponentiation of negative numbers versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6781 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6781] even exponentiation of negative numbers
Mark Dickinson dicki...@gmail.com added the comment: This is not a bug: -1 ** 2 is parsed as -(1 ** 2), not (-1) ** 2. Take a look at: http://docs.python.org/reference/expressions.html#the-power-operator In -1 ^ 2, ^ is the bitwise exclusive-or operator, not the power operator. pow(x, y) is indeed equivalent to x**y: Python 2.6.2 (r262:71600, Aug 22 2009, 17:53:25) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type help, copyright, credits or license for more information. x = -1 y = 2 x ** y 1 pow(x, y) 1 -- nosy: +marketdickinson resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6781 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6781] even exponentiation of negative numbers
Mark Dickinson dicki...@gmail.com added the comment: By the way, I get -1 ^ 2 == -3, not -1: -1 ^ 2 -3 If you're getting -1 instead, then that *is* a bug! Are you? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6781 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6782] Scoping of variables in closures
New submission from victor bitto...@uwp.edu: I can't tell if this is feature or a bug but either way this behavior struck me as strange. def func(): x = 5 def inc(): temp = x + 1 # when inc() is execute, this line fails x = temp return x return inc i = func() i() # will raise error It says that x referenced before defined (when computing x + 1). It seems that the fact that x is assigned in the local inc() that it shadows the outer x. Even stranger is that if you remove the the assignment of x = temp there is no error; suggesting the assignment to x anywhere in the inner function shadows the entire function. This is not the expected behavior, so I thought it may be bug. -- components: Interpreter Core messages: 91954 nosy: bitfort severity: normal status: open title: Scoping of variables in closures type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6782 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6782] Scoping of variables in closures
R. David Murray rdmur...@bitdance.com added the comment: It's feature. In python 3 you can use the 'nonlocal' keyword to access the variable in the outer scope for assignment. -- nosy: +r.david.murray priority: - normal resolution: - invalid stage: - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6782 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6782] Scoping of variables in closures
Changes by Benjamin Peterson benja...@python.org: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6782 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6755] Patch: new method get_wch for ncurses bindings: accept wide characters (unicode)
Cherniavsky Beni c...@users.sf.net added the comment: Nice. 2 questions: 1. Why not change getch() to always use get_wch()? 2. I think you also want fix getkey() / introduce get_wkey(). -- nosy: +cben ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6755 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3329] API for setting the memory allocator used by Python
PJ McNerney pjmcner...@gmail.com added the comment: Has the ability to set the memory allocator been added to Python 2.7/3.1? Thanks, PJ -- nosy: +pjmcnerney versions: +Python 3.2 -Python 2.5, Python 2.6, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6783] Add a builtin method to 'int' for base/radix conversion
New submission from Yuv Gre ubershme...@gmail.com: In javascript and java each number has a toString method which allows for easy string representation in different bases. If the function int(x[, base]) exists as a builtin, the inverse should at least be somewhere in the standard library. Personally I believe a to_string method would work but would defeat There should be one way to do it. Perhaps a method called radix or base_convert which requires a base to convert parameter won't take the place of str(number). Here are a few possible implementations: http://code.activestate.com/recipes/222109/ http://code.activestate.com/recipes/111286/ http://pastebin.com/f54dd69d6 -- components: Interpreter Core, Library (Lib) messages: 91958 nosy: ubershmekel severity: normal status: open title: Add a builtin method to 'int' for base/radix conversion type: feature request versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6783 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6783] Add a builtin method to 'int' for base/radix conversion
Mark Dickinson dicki...@gmail.com added the comment: This seems like the sort of idea that should be floated on the python- ideas mailing list or comp.lang.python first, both to find out what support there is and to pin down precise semantics. We already have int to string conversions in bases 2, 8, 10 and 16; what are the use-cases for conversions in other bases? -- nosy: +marketdickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6783 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6783] Add a builtin method to 'int' for base/radix conversion
Mark Dickinson dicki...@gmail.com added the comment: See http://mail.python.org/pipermail/python-dev/2006-January/059789.html for a previous related discussion. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6783 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1068268] subprocess is not EINTR-safe
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1068268 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4625] IDLE won't open anymore, .idlerc unaccessible
Sophia K. Cheng sophia.ch...@gmail.com added the comment: Thanks!! This worked perfectly! Finally got around to trying this out today. Sincerely, Sophia On 3/20/09 4:26 AM, Timothy Zhang rep...@bugs.python.org wrote: Timothy Zhang z...@live.cn added the comment: I meet the same problem and have it fixed. I use Python 2.5.2 on Windows XP. This is my solution: 1. Choose Tool-Folder Option in your explorer menu, then click View tab, uncheck use simple file sharing(recommended). 2. Right click on C:\Documents and Settings\YourName\.idlerc folder, then click property, you got the folder property dialog 3. Click Safety tab, you may found there's only System user in the list. Click Add and add type your username, then click OK. 4. Select your name in the list, enable all the permissions in the box below. Now this problem should be fixed. Hope this works. -- nosy: +timium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4625 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4625 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6783] Add a builtin method to 'int' for base/radix conversion
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6783 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6759] zipfile.ZipExtFile.read() is missing universal newline support
Ryan Leslie ryle...@gmail.com added the comment: Hi Art, Thanks for working on this. I've taken a look at the patch. The fix to read_test looks correct. Of course, I would consider a more descriptive variable name than 'b'. The changes to read() are an improvement, but I think we need to be careful when we replace \r\n with \n. Basically, we've turned two characters into one and are now potentially one character short of 'size' bytes. This doesn't match the behavior of file.read(). Another thing to work out is the lack of the 'newlines' attribute, discussed in PEP 278. I've noted that bz2 seems to do a pretty good job with universal newline handling: python/trunk/Modules/bz2module.c. It's in C, however, and I don't think there's actually anything in the library doing UL in pure Python. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6759 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com