[issue21074] Too aggressive constant folding

2017-05-23 Thread Andrew Dalke
Andrew Dalke added the comment: Again, I do not propose any changes to the existing optimizer. I do not need anything changed for my code to work. My goal is to counter-balance comments which suggest that perfectly normal code is somehow folly and arcane. These caused me some bewilderment and

[issue30440] document peephole optimizer effects

2017-05-23 Thread Andrew Dalke
New submission from Andrew Dalke: The peephole optimizer is an overall benefit to Python but it has some side-effects that occasionally cause problems. These are well-known in the issue tracker, but there is no other documentation which will help a Python programmer figure out which

[issue30440] document peephole optimizer effects

2017-05-23 Thread Andrew Dalke
Changes by Andrew Dalke : -- nosy: -dalke ___ Python tracker <http://bugs.python.org/issue30440> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21074] Too aggressive constant folding

2017-05-22 Thread Andrew Dalke
Andrew Dalke added the comment: I do not think quoting the Zen of Python helps anything. As I wrote, "it gives different answers depending on where one draws the line." This includes "practicality beats purity". >From my viewpoint, the peephole optimizer isn't

[issue30416] constant folding opens compiler to quadratic time hashing

2017-05-21 Thread Andrew Dalke
Andrew Dalke added the comment: A complex solution is to stop constant folding when there are more than a few levels of tuples. I suspect there aren't that many cases where there are more than 5 levels of tuples and where constant creation can't simply be assigned and used a

[issue21074] Too aggressive constant folding

2017-05-21 Thread Andrew Dalke
Andrew Dalke added the comment: I know this issue was closed many years ago, and I don't propose re-opening it. I write this comment because some of the earlier comments here make it sound like only a foolish or perverse programmer might be affected by this 'too aggressive consta

[issue30416] constant folding opens compiler to quadratic time hashing

2017-05-20 Thread Andrew Dalke
New submission from Andrew Dalke: Others have reported issues like #21074 where the peephole compiler generates and discards large strings, and #30293 where it generates multi-MB integers and stores them in the .pyc. This is a different issue. The code: def tuple20(): return 1

[issue29211] assertRaises with exceptions re-raised from a generator kills generator

2017-01-08 Thread Andrew Dalke
New submission from Andrew Dalke: The unittest assertRaises/assertRaisesRegex implementation calls traceback.clear_frames() because of issue9815 ("assertRaises as a context manager keeps tracebacks and frames alive"). However, if the traceback is from an exception created in a

[issue23455] file iterator "deemed broken"; can resume after StopIteration

2015-02-12 Thread Andrew Dalke
New submission from Andrew Dalke: The file iterator is "deemed broken". As I don't think it should be made non-broken, I suggest the documentation should be changed to point out when file iteration is broken. I also think the term 'broken' is a label with needless

[issue21523] quadratic-time compilation in the number of 'and' or 'or' expressions

2014-05-21 Thread Andrew Dalke
Andrew Dalke added the comment: Live and learn. I did my first bisect today. The first bad revision is: changeset: 51920:ef8fe9088696 branch: legacy-trunk parent: 51916:4e1556012584 user:Jeffrey Yasskin date:Sat Feb 28 19:03:21 2009 + summary: Backport

[issue21523] quadratic-time compilation in the number of 'and' or 'or' expressions

2014-05-18 Thread Andrew Dalke
New submission from Andrew Dalke: Python's compiler has quadratic-time time behavior based on the number of "and" or "or" expressions. A profile shows that stackdepth_walk is calling itself in a stack at least 512 levels deep. (My profiler doesn't go higher tha

[issue7827] recv_into() argument 1 must be pinned buffer, not bytearray

2012-02-04 Thread Andrew Dalke
Andrew Dalke added the comment: It does look like #8104 resolved it. I tested on 2.7.2 and verified that it's no longer a problem, so I moved this to "closed/duplicate". -- resolution: -> duplicate status: open -> closed ___

[issue13653] reorder set.intersection parameters for better performance

2011-12-23 Thread Andrew Dalke
Andrew Dalke added the comment: My belief is that the people who use set.intersection with more than two terms are 1) going to pass in a list of sets, and 2) don't care about the specific order. To check the validity of my belief, I did a Google Code Search to find cases of people usin

[issue13653] reorder set.intersection parameters for better performance

2011-12-22 Thread Andrew Dalke
New submission from Andrew Dalke : In Issue3069, Arnaud Delobelle proposed support for multiple values to set.intersection() and set.union(), writing "Intersection is optimized by sorting all sets/frozensets/dicts in increasing order of size and only iterating over elements in the sma

[issue1602133] non-framework built python fails to define environ properly

2011-07-17 Thread Andrew Dalke
Andrew Dalke added the comment: I confirm that under Python 2.7.2 while trying to build a 3rd-party package (from rdkit.org) I get the error Linking CXX shared library ../../lib/libRDBoost.dylib ld: warning: path '/usr/local/lib/libpython2.7.a' following -L not a directory Undefin

[issue10809] complex() comments wrongly say it supports NaN and inf

2011-01-02 Thread Andrew Dalke
Andrew Dalke added the comment: Well that's ... interesting. While I compiled 2.7 and was looking at the 2.7 code my tests were against 2.6. Python 2.7 (trunk:74969:87651M, Jan 2 2011, 21:58:12) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright&quo

[issue10809] complex() comments wrongly say it supports NaN and inf

2011-01-02 Thread Andrew Dalke
New submission from Andrew Dalke : complex("nan") raises "ValueError: complex() arg is a malformed string" while complex(float("nan")) returns (nan+0j). This was reported in http://bugs.python.org/issue2121 with the conclusion "wont fix". com

[issue10698] doctest load_tests() typo

2010-12-13 Thread Andrew Dalke
New submission from Andrew Dalke : doctest.html Section 24.2.5 "Unittest API" says: def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(my_module_with_doctests)) return test That last line should be "return tests" -- assignee: d.

[issue7827] recv_into() argument 1 must be pinned buffer, not bytearray

2010-02-01 Thread Andrew Dalke
Andrew Dalke added the comment: Since I see the change to "test needed", I've attached a diff against Python 2.6's test_socket.py. I would have generated one against the 2.7 version in subversion but that test doesn't exit. -- keywords: +patch Added fil

[issue7827] recv_into() argument 1 must be pinned buffer, not bytearray

2010-01-31 Thread Andrew Dalke
New submission from Andrew Dalke : In Python 2.6 and Python 2.7a2+, I can't socket.recv_into(a byte array instance). I get a TypeError which complains about a "pinned buffer". I have only an inkling of what that means. Since an array.array("b") works there, and

[issue7192] webbrowser.get("firefox") does not work on Mac with installed Firefox

2009-10-23 Thread Andrew Dalke
New submission from Andrew Dalke : I have Firefox and Safari installed on my Mac. Safari is the default. I wanted to try out Crunchy (http://code.google.com/p/crunchy/). It's developed under Firefox and does not work under Safari. I tried. ;) It starts the web browser with the foll

[issue7172] BaseHTTPServer.BaseHTTPRequestHandler.responses[405] has a small mistake

2009-10-19 Thread Andrew Dalke
Andrew Dalke added the comment: Wasn't thinking. I'm not quoting from "RFC 405", I'm quoting the 405 section from RFC 2616. -- ___ Python tracker <http

[issue7172] BaseHTTPServer.BaseHTTPRequestHandler.responses[405] has a small mistake

2009-10-19 Thread Andrew Dalke
New submission from Andrew Dalke : BaseHTTPServer.BaseHTTPRequestHandler.responses contains a mapping from HTTP status codes to the 2-ple (shortmessage, longmessage), based on RFC 2616. The 2-ple for 405 is ('Method Not Allowed','Specified method is invalid for this server.&#

[issue3531] file read preallocs 'size' bytes which can cause memory problems

2008-09-11 Thread Andrew Dalke
Andrew Dalke <[EMAIL PROTECTED]> added the comment: I'm still undecided on if this is a bug or not. The problem occurs even when I'm not reading "data from a file of an unknown size." My example causes a MemoryError on my machine even though the file I'm

[issue2271] msi installs to the incorrect location (C drive)

2008-08-18 Thread Andrew Dalke
Andrew Dalke <[EMAIL PROTECTED]> added the comment: Yes, that installed Python 2.6 into the correct location (C:\Python26 instead of into the root directory). ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue2271] msi installs to the incorrect location (C drive)

2008-08-15 Thread Andrew Dalke
Andrew Dalke <[EMAIL PROTECTED]> added the comment: I also have this problem. (2.5 msi installer under Win2K with a non- admin account granted admin privs). Python installs just fine under C:\ (instead of C:\Python25) but then I run into problems installing the win32 extensions. Sea

[issue3531] file read preallocs 'size' bytes which can cause memory problems

2008-08-09 Thread Andrew Dalke
Andrew Dalke <[EMAIL PROTECTED]> added the comment: FreeBSD is why my hosting provider uses. Freebsd.org calls 2.6 "legacy" but the latest update was earlier this year. There is shared history with Macs. I don't know the details though. I just point out that the

[issue3531] file read preallocs 'size' bytes which can cause memory problems

2008-08-09 Thread Andrew Dalke
Andrew Dalke <[EMAIL PROTECTED]> added the comment: You're right. I mistook the string implementation for the list one which does keep a preallocated section in case of growth. Strings of course don't grow so there's no need for that. I tracked the memory allocatio

[issue3531] file read preallocs 'size' bytes which can cause memory problems

2008-08-09 Thread Andrew Dalke
Andrew Dalke <[EMAIL PROTECTED]> added the comment: I tested it with Python 2.5 on a Mac, Python 2.5 on FreeBSD, and Python 2.6b2+ (from SVN as of this morning) on a Mac. Perhaps the memory allocator on your machine is making a promise it can&#

[issue3531] file read preallocs 'size' bytes which can cause memory problems

2008-08-08 Thread Andrew Dalke
New submission from Andrew Dalke <[EMAIL PROTECTED]>: I wrote a buggy PNG parser which ended up doing several file.read(large value). It causes a MemoryError, which was strange because the file was only a few KB long. I tracked it down to the implementation of read(). When given

[issue2009] Grammar change to prevent shift/reduce problem with varargslist

2008-02-05 Thread Andrew Dalke
Andrew Dalke added the comment: I've been working from the Grammar file from CVS for 2.6 ... I thought. For example, I see "# except_clause: 'except' [test [('as' | ',') test]]" which is a 2.6-ism. "svn log" says it hasn't changed s

[issue2011] compiler.parse("1; ") adds unexpected extra Discard(Const(None)) to parse tree

2008-02-04 Thread Andrew Dalke
Andrew Dalke added the comment: This really is a minor point. I don't track the 3K list and I see now that the compiler module won't be in Python 3k - good riddance - so feel free to discard this as well as the other open compiler module bugs. I want to experiment with adding instr

[issue2011] compiler.parse("1; ") adds unexpected extra Discard(Const(None)) to parse tree

2008-02-04 Thread Andrew Dalke
New submission from Andrew Dalke: Python 2.6a0 (trunk:60565M, Feb 4 2008, 01:21:28) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from compiler import parse &

[issue2009] Grammar change to prevent shift/reduce problem with varargslist

2008-02-04 Thread Andrew Dalke
New submission from Andrew Dalke: I wrote a translator from the CFG used in the Grammar file into a form for PLY. I found one problem with varargslist: ((fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] | '**'

[issue1889] string literal documentation differs from implementation

2008-01-21 Thread Andrew Dalke
New submission from Andrew Dalke: The reference manual documentation for raw string literals says """Note also that a single backslash followed by a newline is interpreted as those two characters as part of the string, *not* as a line continuation.""" This is not

[issue1367711] Remove usage of UserDict from os.py

2008-01-13 Thread Andrew Dalke
Andrew Dalke added the comment: Ahh, so the bug here that the environ dict should use neither UserDict nor dict, it should implement the core {get,set,del}item and keys and use DictMixin. Martin mentioned that the patch doesn't support setdefault. He didn't note though that the cu

[issue1367711] Remove usage of UserDict from os.py

2008-01-12 Thread Andrew Dalke
Andrew Dalke added the comment: I should have added my preference. I would like to see UserDict replaced with dict. I didn't like seeing the extra import when I was doing my performance testing, through truthfully it's not a bit overhead. As for future-proofing, of course when

[issue1367711] Remove usage of UserDict from os.py

2008-01-12 Thread Andrew Dalke
Andrew Dalke added the comment: I was optimization tuning and wondered why UserDict was imported by os. Replacing UserDict with dict passes all existing regression tests. I see the concerns that doing that replacement is not future proof. Strange then that Cookie.py is acceptable. There

[issue1575] typo in README

2007-12-08 Thread Andrew Dalke
New submission from Andrew Dalke: Current text in README: See Mac/OSX/README for more information on framework and universal builds. Should be See Mac/README for more information on framework and universal builds. because r46719 moved Mac/OSX/* one level up