[issue25708] runpy hides traceback for some exceptions

2015-11-23 Thread Cal Leeming
New submission from Cal Leeming: Originally posted here: http://stackoverflow.com/q/33873243/1267398 The problem is caused by this line: # For -m switch, just display the exception info = str(exc) Caused by the following commit in 2008; https://mail.python.org/pipermail/python

[issue24922] assertWarnsRegex doesn't allow multiple warning messages

2015-08-24 Thread Cal Leeming
New submission from Cal Leeming: There was a discussion/patch in #9754 [1]. This allows for multiple warning types as a tuple, e.g.; self.assertWarnsRegex((DeprecationWarning, RuntimeWarning), ^E1000:) However, it does not allow testing for multiple warning messages, e.g.; expect

[issue24887] Sqlite3 has no option to provide open flags

2015-08-18 Thread Cal Leeming
New submission from Cal Leeming: There are several flags which can be provided to Sqlite3 during connection [1]. Alternative libraries such as apsw provide the ability to use these flags [2], however it would be nice if `sqlite3` supported this out of the box. Is there any reason why

[issue24744] Lack of type checks in pkgutil.walk_packages and friends

2015-07-28 Thread Cal Leeming
New submission from Cal Leeming: The documentation states that pkgutil.walk_packages() path must be None or a list of paths [1]. After passing in a string, the result was a blank list rather than a type error or automatic conversion to a list. If this method is documented that it must only

[issue16379] SQLite error code not exposed to python

2015-06-25 Thread Cal Leeming
Cal Leeming added the comment: Any update on this? Still seems to be a problem as of 3.4.0. -- nosy: +sleepycal ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16379

[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming
New submission from Cal Leeming: Hello, Today I came up against a strange problem where collisions were being encountered after less than 1mil iterations when attempting to use random.random(). After much digging, the problem was because I was casting my float to a string

[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming
Cal Leeming added the comment: As stated before, I have already read this document. This ticket is specifically about making users aware of this behaviour in the form of a documentation update on the random.random() docs. The link you provided does not exactly make this very clear

[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming
Cal Leeming added the comment: Normally I would concur, but casting random.random() to a string is commonly used, and people aren't going to read the entire floating point arithmetic page to figure this out. And even if they do, that page still doesn't make it entirely obvious at first read

[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming
Cal Leeming added the comment: Many thanks for your lengthy response David. Sorry, my initial bug report stated it was Python 2.7. The tests I performed were actually on Python 2.6.6. I will take a look at how to contribute documentation updates, and once I've familiarized myself

[issue16609] float loses precision when passed to str()

2012-12-04 Thread Cal Leeming
Cal Leeming added the comment: Actually, you do have a good point, this should have been using random.getrandbits really. -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16609

[issue16609] float loses precision when passed to str()

2012-12-04 Thread Cal Leeming
Changes by Cal Leeming cal.leem...@simplicitymedialtd.co.uk: -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16609

[issue15407] CSV parser fails to iterate properly on 2.6.6

2012-07-20 Thread Cal Leeming
New submission from Cal Leeming cal.leem...@simplicitymedialtd.co.uk: Getting some extremely strange behavior when attempting to parse a fairly standard CSV in Python 2.6.6. I've tried a whole different mixture of dialects, quoting options, line terminators etc, and none seem to get a happy

[issue15407] CSV parser fails to iterate properly on 2.6.6

2012-07-20 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Sorry, accidently pasted the wrong code snippet previously. The correct code snippet is: datx = open(data.txt, rb).read() rows = csv.reader( datx ) for row in rows: print x

[issue15407] CSV parser fails to iterate properly on 2.6.6

2012-07-20 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: This bug also seems to be showing in 2.7.3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15407

[issue15407] CSV parser fails to iterate properly on 2.6.6

2012-07-20 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Okay, just found the reason for this.. It's because I was putting a .read() on the file descriptor.. I really think that the CSVReader should raise an assertion in the event that it is passed an object which has no iterator

[issue15407] CSV parser fails to iterate properly on 2.6.6

2012-07-20 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: @david Gotcha - I had a feeling that would be the case. Thank you for the quick replies anyway guys! Hopefully this will help others in the future :) -- ___ Python tracker rep

[issue13095] Support for splitting lists/tuples into chunks

2011-10-03 Thread Cal Leeming
New submission from Cal Leeming cal.leem...@simplicitymedialtd.co.uk: After a while of digging around, I noticed that the core libs don't provide an easy way of splitting a list/tuple into chunks - as per the following discussion: http://www.aspwinhost.com/In-what-way-do-you-split-an-list

[issue13095] Support for splitting lists/tuples into chunks

2011-10-03 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Oh - and while we are at it - how about having merge_list() and unique_list() as part of the core too?? def unique_list(seq): # Dave Kirby # Order preserving seen = set() return [x for x in seq if x not in seen

[issue12455] urllib2 forces title() on header names, breaking some requests

2011-07-01 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Thats full understandable that the default won't change. I'll put this in my todo list to write a patch in a week or two. On 1 Jul 2011 08:45, R. David Murray rep...@bugs.python.org wrote: R. David Murray rdmur...@bitdance.com

[issue12455] urllib2 Request() forces capitalize() on header names, breaking some requests

2011-06-30 Thread Cal Leeming
New submission from Cal Leeming cal.leem...@simplicitymedialtd.co.uk: I came up against a problem today whilst trying to submit a request to a remote API. The header needed to contain: 'Content-MD5' : md5here But the urllib2 Request() forces capitalize() on all header names, and transformed

[issue12455] urllib2 Request() forces capitalize() on header names, breaking some requests

2011-06-30 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Sorry, I should clarify.. The str() patch worked, but it failed to work within the realm of urllib2: s = _str(Content-MD5) print Builtin: print plain: %s % ( s ) print capitalized: %s % ( s.capitalize() ) s = str

[issue12455] urllib2 Request() forces capitalize() on header names, breaking some requests

2011-06-30 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: (short answer, I found the cause, and a suitable monkey patch) - below are details of how I did it and steps I took. - Okay so I forked AbstractHTTPHandler() then patched do_request_(), at which point request.headers

[issue12455] urllib2 Request() forces capitalize() on header names, breaking some requests

2011-06-30 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: So @r.david.murray, it would appear you were right :D Really, I should have looped through each method on str(), and wrapped them all to see which were being called, but lesson learned I guess. Sooo, I guess now the question

[issue12455] urllib2 forces title() on header names, breaking some requests

2011-06-30 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Damn 3.3 huh? Ah well, at least it's in the pipeline ^_^ Thanks for your help on this @r.david.murray! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12455

[issue12325] regex matches incorrectly on literal dot (99.9% confirmed)

2011-06-13 Thread Cal Leeming
New submission from Cal Leeming cal.leem...@simplicitymedialtd.co.uk: I believe I might have found a bug in the Python re libraries. Here is a complete debug of what is happening (my apologies for the nature of the actual text). I have ran this regex through RegexBuddy (and a few other tools

[issue12325] regex matches incorrectly on literal dot (99.9% confirmed)

2011-06-13 Thread Cal Leeming
Changes by Cal Leeming cal.leem...@simplicitymedialtd.co.uk: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12325

[issue12325] regex matches incorrectly on literal dot (99.9% confirmed)

2011-06-13 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Take particular notice to the following: \.co\.uk or literal 99 literal 111 literal 46 literal 117 literal 107 map(lambda x: chr(x), [99,111,46,117,107]) ['c', 'o', '.', 'u', 'k'] It would

[issue12325] regex matches incorrectly on literal dot (99.9% confirmed)

2011-06-13 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Oh jeez, you're going to think I'm such an idiot. I just ran a completely fresh test in the cli (away from the original source), and the issue disappeared (it was caused by caching - apparently). I'm really sorry to have

[issue12235] subprocess.check_output throws wrong exception if non executable

2011-06-01 Thread Cal Leeming
New submission from Cal Leeming cal.leem...@simplicitymedialtd.co.uk: If you attempt to call subprocess.check_output() on a file which is not executable, it gives a file not found exception, rather than file not executable. Took me about 3 hours to figure out why it kept saying the file

[issue12235] subprocess.check_output throws wrong exception if non executable

2011-06-01 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Oh also, here is the version: simplicitymedialtd@sws01.internal [~/webapps/cdn06.prod/src/webapp/cmd] python Python 2.7 Stackless 3.1b3 060516 (release27-maint, Aug 29 2010, 15:44:48) [GCC 4.3.2] on linux2 Type help

[issue12235] subprocess.check_output throws wrong exception if non executable

2011-06-01 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Yeah, I resolved the issue already. This bug report is focused primarily on the (somewhat misleading) exception message given back. I think it should at least include bad interpreter, otherwise it is a tad misleading. Cal

[issue12235] subprocess throws wrong exception if script can't be executed

2011-06-01 Thread Cal Leeming
Cal Leeming cal.leem...@simplicitymedialtd.co.uk added the comment: Ah okay, shell=True is a good work around then :) Thanks! Cal -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12235

[issue11974] Class definition gotcha.. should this be documented somewhere?

2011-05-01 Thread Cal Leeming
New submission from Cal Leeming cal.leem...@simplicitymedialtd.co.uk: So, when you create a class like this: class Obj: children = [] The 'children' object essentially becomes shared across all instances of Obj. To get around this, you have to use: class Obj: children = None def