[issue1145] Allow str.join to join non-string types (as per PEP 3100)

2007-09-11 Thread Thomas Lee
New submission from Thomas Lee: The current implementation of str.join requires that the parameters passed to it be string/unicode values. A suggestion to allow it to accept parameters of any type came up in PEP 3100. Implemented for Unicode using the attached patch. It would be trivial to add

[issue1145] Allow str.join to join non-string types (as per PEP 3100)

2007-09-11 Thread Thomas Lee
Thomas Lee added the comment: Oh and an example of usage: # before the patch ', '.join([str(x) for x in [1, 2, 3]]) # after the patch ', '.join([1, 2, 3]) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1145

[issue1145] Allow str.join to join non-string types (as per PEP 3100)

2007-09-13 Thread Thomas Lee
Thomas Lee added the comment: Sure - I'll get onto that. Should have another patch up later tonight. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1145 __ ___ Python-bugs-list

[issue1145] Allow str.join to join non-string types (as per PEP 3100)

2007-09-27 Thread Thomas Lee
Thomas Lee added the comment: Is there anything else you need from me for this one Guido? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1145 __ ___ Python-bugs-list mailing

[issue1249] PEP 3137 patch: make PyBytes/PyUnicode ==/!= comparisons return False

2007-10-09 Thread Thomas Lee
New submission from Thomas Lee: Initial patch attached. -- components: Interpreter Core files: bytes-unicode-return-false-r1.patch messages: 56284 nosy: thomas.lee severity: normal status: open title: PEP 3137 patch: make PyBytes/PyUnicode ==/!= comparisons return False type: rfe

[issue1249] PEP 3137 patch: PyBytes/PyUnicode comparisons

2007-10-09 Thread Thomas Lee
Thomas Lee added the comment: Revised patch - originally misinterpreted what was required here. bytes() == str() now returns False, bytes() != str() now returns True. -- title: PEP 3137 patch: make PyBytes/PyUnicode ==/!= comparisons return False - PEP 3137 patch: PyBytes/PyUnicode

[issue1263] PEP 3137 patch - str8/str comparison should return false

2007-10-11 Thread Thomas Lee
New submission from Thomas Lee: The main patch - while exactly what is needed to make str8/str equality checks return False - breaks a bunch of tests due to PyString_* still being used elsewhere when it should be using PyUnicode. The second patch modifies structmember.c to use PyUnicode_* where

[issue1263] PEP 3137 patch - str8/str comparison should return false

2007-10-11 Thread Thomas Lee
Changes by Thomas Lee: __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1263 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs

[issue1263] PEP 3137 patch - str8/str comparison should return false

2007-10-11 Thread Thomas Lee
Thomas Lee added the comment: Oops - use unicode-string-eq-false-r3.patch, not unicode-string-eq-false-r2.patch. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1263 __Index: Objects/unicodeobject.c

[issue1263] PEP 3137 patch - str8/str comparison should return false

2007-10-15 Thread Thomas Lee
Thomas Lee added the comment: Hack to make Python/codecs.c use Unicode strings internally. I recognize the way I have fixed it here is probably not ideal (basically ripped out PyString_*, replaced with a PyMem_Malloc/PyMem_Free call) but it fixes 10-12 tests that were failing with my earlier

[issue1810] Partial AST compile() patch

2008-01-11 Thread Thomas Lee
New submission from Thomas Lee: This patch against HEAD provides the inverse operations to all the ast2obj_* functions in Python/Python-ast.c: effectively, this allows conversion to from a PyObject representation of a Python AST. Additionally, it updates the compile() builtin to allow

[issue1810] Partial AST compile() patch

2008-01-11 Thread Thomas Lee
Thomas Lee added the comment: Attaching a sample program to demonstrate the crash. Added file: http://bugs.python.org/file9135/ast.py __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1810

[issue1810] AST compile() patch

2008-01-12 Thread Thomas Lee
Thomas Lee added the comment: I knew it would be a simple one for somebody who knew what to look for :) Thanks Georg! r02 is the updated patch. Changing the title of the tracker issue to reflect that this *should* be a complete patch now. Any further recommendations? -- title: Partial

[issue1625] bz2.BZ2File doesn't support multiple streams

2008-01-14 Thread Thomas Lee
Thomas Lee added the comment: If you're referring to an 'append' mode for bz2file objects, it may be a limitation of the underlying library: my version of bzlib.h only provides BZ2_bzWriteOpen and BZ2_bzReadOpen - it's not immediately clear how you would open a BZ2File in append mode looking

[issue1810] AST compile() patch

2008-03-15 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: Updating the patch to apply cleanly against HEAD. Added file: http://bugs.python.org/file9672/ast-r03.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1810

[issue4113] functools.partial(), no __name__; wrong __doc__

2008-10-19 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: Here's a patch against the 2.x trunk. Basically just dispatches reads of a partial's __name__ and __doc__ attributes to the underlying function object. -- keywords: +patch nosy: +thomas.lee Added file: http://bugs.python.org/file11831

[issue4147] xml.dom.minidom toprettyxml: omit whitespace for text-only elements

2008-10-19 Thread Thomas Lee
New submission from Thomas Lee [EMAIL PROTECTED]: For XML elements containing only text data, it would be nice if toprettyxml could omit the whitespace it normally injects before after the text, e.g. person first-name Bob /first-name /person Becomes: person first-nameBob

[issue4113] functools.partial(), no __name__; wrong __doc__

2008-10-19 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: I actually agree with the sentiment Georg. Would it instead be useful to maybe provide a __repr__ implementation that describes the state of the partially applied function? I guess this is an entirely different issue, maybe one for python-ideas

[issue4264] Patch: optimize code to use LIST_APPEND instead of calling list.append

2008-11-06 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: Neal said: I was surprised to see the change to the AST, but I understand why you did it. The problems David ran into here sound like an argument for arbitrary AST annotations -- an idea that I was toying with around the time Const was introduced

[issue4347] Dependencies of graminit.h are not rebuilt when the file is regenerated

2008-11-18 Thread Thomas Lee
New submission from Thomas Lee [EMAIL PROTECTED]: It's important that dependencies of grammar.h get rebuilt if graminit.h is regenerated (e.g. the Grammar is modified). If these dependencies do not get rebuilt, the constants associated with each type of parse node will have inconsistent values

[issue4347] Dependencies of graminit.h are not rebuilt when the file is regenerated

2008-11-19 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: Updating affected versions. Probably affects 3.x too. -- versions: +Python 2.7 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4347

[issue4347] Dependencies of graminit.h are not rebuilt when the file is regenerated

2008-12-01 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: A deeper issue here is that Parser/parsetok.c has a dependency on graminit.h. The problem is that Parser/parsetok.c is a part of the Parser/pgen program which is actually being used to *generate* graminit.h in the first place. This breaks Python

[issue4347] Circular dependency causes SystemError when adding new syntax

2008-12-01 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: I mean pgen's dependency on graminit.h, not the parser's. :) ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4347

[issue4347] Circular dependency causes SystemError when adding new syntax

2008-12-01 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: okay, so it turns out that putting rules in Grammar/Grammar before the top-level non-terminals breaks things in a different way. Attached is another (hopefully final and working) patch. Added file: http://bugs.python.org/file12185/build-evilness

[issue4347] Circular dependency causes SystemError when adding new syntax

2008-12-01 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: Here's a new patch that I believe should fix this issue. It modifies Makefile.pre.in to include a few additional dependency declarations for source files that depend on Include/graminit.h and Include/Python-ast.h, as well as moving encoding_decl

[issue4347] Circular dependency causes SystemError when adding new syntax

2008-12-02 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: Thanks for the review Brett, apologies for the mess. I'm attaching two new patches -- one for review, the other containing the generated files. These differ very slightly from the original patch -- mainly just removing some stuff I don't think

[issue4347] Circular dependency causes SystemError when adding new syntax

2008-12-02 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: And here's the patch for review. Added file: http://bugs.python.org/file12209/build-evilness-fix-03-review.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4347

[issue4347] Circular dependency causes SystemError when adding new syntax

2009-01-17 Thread Thomas Lee
Thomas Lee t...@vector-seven.com added the comment: Brett, any feedback on this one? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4347 ___ ___ Python-bugs

[issue2725] Handle ASDLSyntaxErrors gracefully

2008-04-30 Thread Thomas Lee
New submission from Thomas Lee [EMAIL PROTECTED]: The current code in Parser/asdl.py doesn't handle syntax errors very well. A minor problem to be sure, since the net result is the same (i.e. build fails), but the error message being displayed is entirely unhelpful to the developer

[issue1346238] A constant folding optimization pass for the AST

2008-05-07 Thread Thomas Lee
Thomas Lee [EMAIL PROTECTED] added the comment: I'm working on the AST optimization code for 2.7 (?) in the tlee-ast-optimize branch. I've since adopted some of the ideas from this patch, but I'll take another look when I get a chance. The folding operation is already mostly in-place

[issue15887] urlencode should accept iterables of pairs

2012-09-15 Thread Thomas Lee
Thomas Lee added the comment: Working on a patch for this. Should be ready for review shortly. -- nosy: +thomaslee ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15887

[issue15887] urlencode should accept iterables of pairs

2012-09-15 Thread Thomas Lee
Thomas Lee added the comment: Patch attached. Terry, you'll notice I wrap the main part of the urlencode function in a big try/except block to catch TypeErrors ValueErrors. I'm a bit concerned that doing this may misreport the true underlying error in the event we screw up values/types

[issue15893] Py_FrozenMain() resource leak and missing malloc checks

2012-09-15 Thread Thomas Lee
Thomas Lee added the comment: Patch against hg tip attached. -- keywords: +patch nosy: +thomaslee Added file: http://bugs.python.org/file27202/issue-15893-01.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15893

[issue15991] BaseHTTPServer with ThreadingMixIn serving wrong data sometimes

2012-09-23 Thread Thomas Lee
Thomas Lee added the comment: I can reproduce this on Debian Wheezy. Both with the system Python (2.7.3rc2) and the 2.7 branch built from source. -- nosy: +thomaslee ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15991

[issue13028] python wastes linux users time by checking for dylib on each dynamic library load

2012-09-28 Thread Thomas Lee
Thomas Lee added the comment: I know this is an old-ish issue, but I can't reproduce anything like this on Debian Wheezy with either Python 2.7 or tip (3.x). I think we need more details of what you're trying to do here Roger. 1. What exactly did you do to reproduce the strace output below? 2

[issue16061] performance regression in string replace for 3.3

2012-09-28 Thread Thomas Lee
Thomas Lee added the comment: My results aren't quite as dramatic as yours, but there does appear to be a regression: $ ./python -V Python 2.7.3+ $ ./python -m timeit -s s = 'b'*1000 s.replace('b', 'a') 10 loops, best of 3: 16.5 usec per loop $ ./python -V Python 3.3.0rc3+ $ ./python -m

[issue16062] Socket closed prematurely in httplib for https

2012-09-28 Thread Thomas Lee
Thomas Lee added the comment: Thanks ABR. You may be better off raising a ticket against requests (https://github.com/kennethreitz/requests). I'm assuming what you want to happen here is for the session.post() call to return the 401 response without raising an exception. Perfectly reasonable

[issue14886] json C vs pure-python implementation difference

2012-09-28 Thread Thomas Lee
Thomas Lee added the comment: FWIW, I think Mark's right here. I'm +1 on the implementations being consistent. Seems like a potentially nasty surprise if you move from one implementation to the other and, lacking awareness of this quirk, design your algorithm around semantics. I think

[issue4347] Circular dependency causes SystemError when adding new syntax

2009-02-09 Thread Thomas Lee
Thomas Lee t...@vector-seven.com added the comment: This would appear to be another build quirk: Lib/symbol.py needs to be regenerated if Grammar/Grammar changes. Brett, do you think it would be okay for this file to be generated automatically as part of the build process? I can't think of any