[issue1779871] Make python build with gcc-4.2 on OS X 10.4.9

2007-08-23 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: In http://gcc.gnu.org/ml/gcc/2005-12/msg00368.html, Mike Stump <[EMAIL PROTECTED]> said "This flag [-no-cpp-precomp] should be removed from the compile, it hasn't been needed in a long while (since gcc-3.1)." which was released in 2002.

[issue1450807] Python build fails for gcc 4.x from Gnu

2007-08-24 Thread Jeffrey Yasskin
Changes by Jeffrey Yasskin: -- nosy: +jyasskin _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1450807> _ ___ Python-bugs-list mailing list Unsubs

[issue1779871] Make python build with gcc-4.2 on OS X 10.4.9

2007-08-28 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I'm not going to get to this for about a week, but I'll test the patch then. _ Tracker <[EMAIL PROTECTED]> <http://bugs.pyth

[issue1200] Allow array.array to be parsed by the t# format unit.

2007-09-24 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: This changes PyArg_ParseTuple()'s "t#" to request a PyBUF_SIMPLE buffer like all of the other buffer-using format units instead of PyBUF_CHARACTER. Objects with multi-byte units wind up byte-order-dependent. Alternately, it might mak

[issue1184] test fixes for immutable bytes change

2007-09-24 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: To be precise, this change makes bytes immutable but does not give it a __hash__ method or change the values its iterator returns. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/

[issue1676820] Add a PeriodicTimer to threading

2010-09-16 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Java's Timer class tends to be discouraged these days in favor of ScheduledExecutorService.scheduleAtFixedRate and .scheduleWithFixedDelay (http://download.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html). Could you sa

[issue10260] Add a threading.Condition.wait_for() method

2010-11-01 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: * This method will confuse some people who will think that cond.wait(pred) will wake up when pred becomes true regardless of whether they call cond.notifyAll(). You should warn them about this in the documentation. (This confusion happens inside Google

[issue10260] Add a threading.Condition.wait_for() method

2010-11-03 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: On Tue, Nov 2, 2010 at 4:29 AM, Antoine Pitrou wrote: >> I spent some time thinking of a name.  I tried wait_predicate and >> predicate_wait, but wait_for seemed natural.  Any other ideas? >> How about wait_until_true? > > wait_for is

[issue3197] Documentation for fractions module needs work

2008-06-27 Thread Jeffrey Yasskin
Jeffrey Yasskin <[EMAIL PROTECTED]> added the comment: > [sign] integer '.' [fraction] | [sign] ['.'] fraction Shouldn't make the second '.' optional or this will match plain numerators too. Otherwise, looks good. Thanks for fixing this! __

[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

2008-06-29 Thread Jeffrey Yasskin
Jeffrey Yasskin <[EMAIL PROTECTED]> added the comment: I don't think so. It wouldn't be a bug if I wrote: >>> class Meta(type): ... def __instancecheck__(self, other): ... return True >>> isinstance(3, Meta) ... False but it is a bug that the isins

[issue3056] Simplify the Integral ABC

2008-06-29 Thread Jeffrey Yasskin
Jeffrey Yasskin <[EMAIL PROTECTED]> added the comment: Yeah, I'll take a look. Feel free to bug me if I haven't gotten to it in a couple more days. ___ Python tracker <[EMAIL PROTECTED]> <http://

[issue8032] Add gdb7 hooks to make it easier to debug Python

2010-03-25 Thread Jeffrey Yasskin
Changes by Jeffrey Yasskin : -- nosy: +jyasskin ___ Python tracker <http://bugs.python.org/issue8032> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue8032] Add gdb7 hooks to make it easier to debug Python

2010-04-03 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: http://sourceware.org/gdb/current/onlinedocs/gdb/Auto_002dloading.html says "If this file exists and is readable, gdb will evaluate it as a Python script." So maybe it doesn't need to be executable? -- ___

[issue7316] Add a timeout functionality to common locking operations

2010-04-13 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Thanks, looks good. Sorry for the delay. -- resolution: -> accepted ___ Python tracker <http://bugs.python.org/iss

[issue8553] 2to3 breaks relative imports

2010-04-27 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin : 2to3, at least the version in the python-2 tree, currently turns from . import refactor into from .. import refactor which breaks the transformation of 2to3 itself. The attached patch fixes this and tests it. Once someone's looked this over,

[issue8553] 2to3 breaks relative imports

2010-04-27 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Thanks! Committed as r80573. -- keywords: -needs review stage: patch review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.org/

[issue8566] 2to3 should run under python 2.5

2010-04-28 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin : Sorry for being all curmudgeonly, but we're using 2to3 in the benchmark suite at http://hg.python.org/benchmarks/, and, since many of the non-CPython implementations are still only 2.5-compatible, the version there needs to run under python 2.5. A

[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: In what way will my patch break test_parser on Windows? I preserved the behavior of re-opening the file in text mode after determining the encoding. Do I need to add 'U' to open()'s mode string? -- ___

[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Thanks. Committed as r80668. May I update http://python.org/dev/peps/pep-0291/ to reflect that 2to3 should continue working on python-2.5? -- ___ Python tracker <http://bugs.python.org/issue8

[issue8566] 2to3 should run under python 2.5

2010-04-30 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Done. -- keywords: -needs review stage: patch review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.org/

[issue3605] Py_FatalError causes infinite loop

2010-05-12 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I have a fix at http://codereview.appspot.com/1184043, which makes PyErr_Occurred() return NULL when there is no thread. I'll commit it tomorrow unless there are comments. -- assignee: -> jyasskin keywords: +needs review nosy: +jyassk

[issue3605] Py_FatalError causes infinite loop

2010-05-13 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Fixed in r81142. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.o

[issue1623] Implement PEP-3141 for Decimal

2007-12-13 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: I added __round__, __ceil__, __floor__, and __trunc__ -- components: Library (Lib) files: decimal_3141.patch messages: 58614 nosy: jyasskin severity: normal status: open title: Implement PEP-3141 for Decimal type: behavior versions: Python 3.0 Added

[issue1623] Implement PEP-3141 for Decimal

2007-12-15 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Here's a version of the patch that uses _rescale instead of quantize. I don't know enough about how contexts are used to know whether someone might want to know that ceil(Decimal("1e30")) gave a result with more precision than the input. On

[issue1623] Implement PEP-3141 for Decimal

2007-12-17 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Re math.{floor,ceil}(float): oops, that's definitely a bug. I'll fix it. Re backporting: yes, and I believe trunc() should be backported too. __ Tracker <[EMAIL PROTECTED]> <http://bugs.p

[issue1656] Make math.{floor,ceil}(float) return ints per PEP 3141

2007-12-18 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: See http://python.org/dev/peps/pep-3141/#changes-to-operations-and-magic-methods -- components: Library (Lib) files: floorceil_return_int.patch messages: 58792 nosy: jyasskin severity: normal status: open title: Make math.{floor,ceil}(float) return

[issue1623] Implement PEP-3141 for Decimal

2007-12-19 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Are you guys suggesting the backport before or after checking this in to the py3k branch? Either's fine with me. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python

[issue1623] Implement PEP-3141 for Decimal

2007-12-20 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Right. Will do. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1623> __ ___ Python-bugs-list mailing list Unsubs

[issue1689] Backport PEP 3141 to 2.6

2008-01-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I've committed this as r59671, except that round() returns a float again to make sure we keep compatibility. Let me know if you find anything that needs fixing. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python

[issue1656] Make math.{floor,ceil}(float) return ints per PEP 3141

2008-01-05 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Submitted as r59747. -- keywords: +py3k status: open -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1656> __ ___

[issue1747] isinstance(NotSubclassOfObject, InstanceOfAbcMeta) fails instead of returning False

2008-01-06 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: Python 2.6a0 (trunk:59791M, Jan 6 2008, 12:22:37) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import abc [30620 ref

[issue1623] Implement PEP-3141 for Decimal

2008-01-06 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I think this reflects the consensus of http://mail.python.org/pipermail/python-dev/2008-January/075798.html. I haven't yet implemented Context.round() as I suggested at http://mail.python.org/pipermail/python-dev/2008-January/075920.html because there are

[issue1747] issubclass(NotSubclassOfObject, InstanceOfAbcMeta) fails instead of returning False

2008-01-06 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: This is certainly not the only way to fix this. Is it the best? -- keywords: +patch title: isinstance(NotSubclassOfObject, InstanceOfAbcMeta) fails instead of returning False -> issubclass(NotSubclassOfObject, InstanceOfAbcMeta) fails instead

[issue1747] issubclass(NotSubclassOfObject, InstanceOfAbcMeta) fails instead of returning False

2008-01-06 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Committed as r59809. -- status: open -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1747> __ ___ P

[issue1623] Implement PEP-3141 for Decimal

2008-01-06 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Much smaller now. 3.0 will need an additional patch beyond the "automatic" forward port. -- versions: +Python 2.6 Added file: http://bugs.python.org/file9083/decimal-3141-just-trunc.patch __ Tracker <[EM

[issue1623] Implement PEP-3141 for Decimal

2008-01-07 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: _dec_from_triple: Probably, yes. It doesn't seem to have any practical effect, but it's good to be consistent. __lt__, __le__: It doesn't matter whether they're called because they have the same effect as __cmp__. They're only there

[issue1623] Implement PEP-3141 for Decimal

2008-01-08 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Yes, making Decimal subclass object instead of Real and Inexact makes it as fast as it used to be. ABCMeta.__instancecheck__ is easy to speed up, but after fixing it, we're still about 25% behind. So here'a version that just registers Decimal as

[issue1762] Inheriting from ABC slows Decimal down.

2008-01-08 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I've only verified the behavior on 2.6, but I suspect it's true for both. __ Tracker <[EMAIL PROTECTED]> <http://bugs.p

[issue1762] Inheriting from ABC slows Decimal down.

2008-01-08 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: Adding numbers.Real to Decimal's base classes almost doubles the time its its test suite takes to run. A profile revealed that a large fraction of that slowdown was in __instancecheck__, but even after optimizing that, it's still about 25% slower

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-08 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Thanks again for the excellent comments. __init__: good catch. repr(Rational): The rule for repr is "eval(repr(object)) == object". Unfortunately, that doesn't decide between the two formats, since both assume some particular import statement

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-09 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: > * Follow the decimal module's lead in assiduously avoiding > float->rational conversions. Something like Rat.from_float(1.1) is > likely to produce unexpected results (like locking in an inexact input > and having an unexpectedly large de

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-11 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: If the consensus is that Decimal should not implement Real, I'll reply to that thread and withdraw the patch. Raymond, do you want me to add Decimal.__init__(Rational) in this patch or another issue/thread? I don't understand the comment about sc

[issue1623] Implement PEP-3141 for Decimal

2008-01-12 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: The discussion on issue 1682 concluded that Decimal should not implement Real at all. -- resolution: -> rejected status: open -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-13 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: _binary_float_to_ratio: Oops, fixed. Rational() now equals 0, but I'd like to postpone Rational('3/2') until there's a demonstrated need. I don't think it's as common a use as int('3'), and there's more than one p

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-14 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Thanks! I've added some minimal documentation and construction from other Rationals. The other formats for string parsing center around where whitespace is allowed, and whether you can put parens around the whole fraction. Parens would, of course, go aw

[issue1779871] Make python build with gcc-4.2 on OS X 10.4.9

2008-01-16 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Sorry for taking so long to get to this. gcc 4.2.1 still produces the following errors with this patch: gcc -c -fno-strict-aliasing -mno-fused-madd -no-cpp-precomp -g -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/opt/local/include -DPy_BUILD_CORE -o

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-17 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Here's a patch that adds construction from strings (Guido favored them) and .from_decimal(), changes __init__ to __new__ to enforce immutability, and removes "rational." from repr and the parens from str. I don't expect this to be contentiou

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-17 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: After this come the two approximation methods. Both are implemented using the continued fraction representation of the number: http://en.wikipedia.org/wiki/Continued_fraction#Best_rational_approximations. The first, currently named "trim", takes t

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-01-19 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I coulda sworn I looked for is_nan and is_infinite. Oh well, switched to using .is_finite, which is even better and checked in as r60068. Thanks for the pointer. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/

[issue1965] Move trunc() to math module

2008-01-29 Thread Jeffrey Yasskin
Changes by Jeffrey Yasskin: -- resolution: -> accepted __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1965> __ ___ Python-bugs-list mailing list Uns

[issue1968] Unused number magic methods leaked into Py2.6

2008-01-29 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I can't find the __round__, __ceil__, and __floor__ methods in int, long, and float. I left them in Rational on purpose, thinking that there might be a module that provided the new behaviors for 2.6 code, but you're probably right that these should

[issue1968] Unused number magic methods leaked into Py2.6

2008-01-29 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Will do. -- components: +Library (Lib) resolution: -> accepted __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1968> __ ___

[issue1968] Unused number magic methods leaked into Py2.6

2008-01-31 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Done in r60480. -- resolution: accepted -> fixed status: open -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue1965] Move trunc() to math module

2008-01-31 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Moved in r60486. I tried to improve the docstring too. -- resolution: accepted -> fixed status: open -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue1965] Move trunc() to math module

2008-02-01 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Go ahead and fix the docstring. I don't really understand what was incorrect about the original "returns the integral closest to x between 0 and x", so I'm not confident that I'll come up with something you'll like. -- as

[issue1965] Move trunc() to math module

2008-02-01 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: *sigh* That's the version I put there. Did you read the patch before complaining about it? __ Tracker <[EMAIL PROTECTED]> <http://bugs.python

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-02-01 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Whoops, sorry for taking a while to answer. +0 on adding support for '2.' and '.3', given that they're allowed for float and Decimal. Not +1 because they'll make the regular expression more complicated, and they're not exactl

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-02-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I think '1e+100' would constitute feature creep at this point, but thanks for the suggestion, and the improvement in the readability of the regex! __ Tracker <[EMAIL PROTECTED]> <http://bugs.p

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-02-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I think Rational should handle all floating types as consistently as possible, whatever their radix or precision. It's unlikely that people will convert from them often anyway, especially from Decimal, so the shorter conversion from Decimal doesn'

[issue2002] Make int() fall back to trunc()

2008-02-02 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: Per http://mail.python.org/pipermail/python-dev/2008-January/076564.html. -- assignee: jyasskin messages: 62014 nosy: jyasskin priority: high severity: normal status: open title: Make int() fall back to trunc() type: behavior versions: Python 2.6

[issue2002] Make int() fall back to trunc()

2008-02-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Here's a patch to implement the fallback for both int and long. I'm pretty sure that _PyNumber_ConvertIntegralToInt() is in the wrong place. Where would be a better place for it? -- keywords: +patch nosy: +rhettinger Added file: http://bugs.

[issue2002] Make int() fall back to trunc()

2008-02-03 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: > There is also part of this patch that touches classobject.c but I'm not > yet sure what the visible effect of that change would be or what the > change was hoping to accomplish. All classic classes take the (m && m->nb_int) branch,

[issue2002] Make int() fall back to trunc()

2008-02-03 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Submitted as r60566. -- status: open -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2002> __ ___ P

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-02-08 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I figured I'd time the difference before we change the code: $ ./python.exe -m timeit -s 'import rational; r=rational.Rational(3, 1)' 'r.numerator' 100 loops, best of 3: 0.696 usec per loop $ ./python.exe -m timeit -s 'import

[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

2008-02-09 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Mark: Coming from C++, I don't have any intuition on static vs. class methods. It might be strange to write MyRationalSubclass.from_float() and get a Rational back, but it might also be strange to write a subclass with a different constructor and get an

[issue1762] Inheriting from ABC slows Decimal down.

2008-02-09 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I measured various implementations of __instancecheck__ using `./python.exe -m timeit -s 'from rational import Rational; r = Rational(3, 2)' '...'` on my 2.33 GHz MacBook, with ... replaced by either isinstance(r, Rational) or isinstance(3,

[issue1762] Inheriting from ABCs makes classes slower.

2008-02-10 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Right. Decimal was just the place I noticed the problem first. Now it affects Rational more, but it's really a problem with ABCs in general, not specific concrete classes. -- title: Inheriting from ABC slows Decimal down. -> Inheriting from AB

[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.

2008-02-11 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Re convergents: In the interest of minimality, I don't think from_continued_fraction and to_continued_fraction need to stick around. I think the other thread established pretty conclusively that .convergents() is not a particularly good building bloc

[issue1762] Inheriting from ABCs makes classes slower.

2008-02-13 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I've committed the inlined option as r60762. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1762> __ ___ Python-bugs-

[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.

2008-02-13 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: r60785 speeds the benchmark up from 10.536s to 4.910s (on top of whatever my __instancecheck__ fix did). Here are the remaining interesting-looking calls: ncalls tottime percall cumtime percall filename:lineno(function) ... 10.2070.207

[issue1762] Inheriting from ABCs makes classes slower.

2008-02-14 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Guido and I discussed this, and the next step seems to be to rewrite _Abstract in C and push it into object. For an idea of how much that'll help, just commenting out _Abstract.__new__ takes the Fraction() constructor from 9.35us to 6.7us on my box, and

[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.

2008-02-14 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Thanks for writing the __add__ optimization down. I hadn't realized how simple it was. I think both optimizations are worth it. 22% on a rarely used class is worth 24 lines of python, and I think nearly eliminating the overhead of ABCs (which will prevent

[issue2115] __slots__ make attribute setting 10x slower

2008-02-14 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: (On a MacBook Pro 2.33 GHz) $ ./python.exe -m timeit -s 'class Foo(object): pass' -s 'f = Foo()' 'f.num = 3' 1000 loops, best of 3: 0.13 usec per loop $ ./python.exe -m timeit -s 'class Foo(object): __slots__ = ["n

[issue1762] Inheriting from ABCs makes classes slower.

2008-02-16 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I'd like a second opinion about whether it's a good idea to commit the attached patch, which moves abc._Abstract into object. Its effect is to speed ./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__=abc.

[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.

2008-02-18 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: 1) No worries. Even without inlining the common case of __add__, etc., Fraction is now faster than Decimal for smallish fractions [sum(Fraction(1, i) for i in range(1, 100))], and for large ones [sum(Fraction(1, i) for i in range(1, 1000))] gcd takes so much of

[issue1193577] add server.shutdown() method and daemon arg to SocketServer

2008-02-23 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: This is getting in my way, so I'll take a look at it. I'm planning to model the shutdown API after http://java.sun.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html. The serve_forever->shutdown interval should probably also be availa

[issue1517495] memory leak threading or socketserver module

2008-02-23 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: It's possible but unlikely that r61011 fixed this. SocketServer creates the reference cycles it fixed, but they tended to get cleaned up by gc.collect(), so it sounds like that wasn't the bug you're seeing here. I haven't had time

[issue1910] Document that with is slower than try/finally

2008-02-24 Thread Jeffrey Yasskin
Changes by Jeffrey Yasskin: -- nosy: +jyasskin __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1910> __ ___ Python-bugs-list mailing list Unsubs

[issue2179] with should be as fast as try/finally

2008-02-24 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: Currently, 'with' costs about .2us over try/finally: $ ./python.exe -m timeit -s 'import thread; lock = thread.allocate_lock()' 'lock.acquire()' 'try: pass' 'finally: lock.release()' 100 loops, best of

[issue1910] Document that with is slower than try/finally

2008-02-24 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I've filed issue 2179 to see if it's possible to make with as fast as try/finally. __ Tracker <[EMAIL PROTECTED]> <http://bugs.p

[issue2184] Speed up Thread.start()

2008-02-24 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin: Thread.start() used sleep(0.01) to make sure it didn't return before the new thread had started. At least on my MacBook Pro, that wound up sleeping for a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely certain that the t

[issue1762] Inheriting from ABCs makes classes slower.

2008-02-27 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Since there were no comments, I submitted the patch as r61098. I think we're done here. :) -- resolution: -> fixed status: open -> closed type: -> behavior versions: +Python 2.6 __ Tracker <[EMAIL

[issue2184] Speed up Thread.start()

2008-02-27 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Submitted as r61100. -- assignee: -> jyasskin resolution: -> fixed status: open -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.py

[issue1540386] SocketServer.ForkingMixIn.collect_children() waits on pid 0

2008-02-28 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Mostly fixed in r61106. This should make the buildbots happy, but there is still a corner case in which we waitpid(0) and could confuse other libraries. -- nosy: +jyasskin type: -> behavior versions: +Python

[issue1183] race in SocketServer.ForkingMixIn.collect_children

2008-02-28 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Hmm. I think the race can only happen if you call collect_children() concurrently from multiple threads or from a signal handler. The waidpid(0) bug (which affected anyone who spawned subprocesses from anything other than ForkingMixIn) is partly fixed by r61106

[issue1183] race in SocketServer.ForkingMixIn.collect_children

2008-02-28 Thread Jeffrey Yasskin
Changes by Jeffrey Yasskin: -- status: pending -> closed __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1183> __ ___ Python-bugs-list mailing li

[issue1682] Move Demo/classes/Rat.py to Lib/fractions.py and fix it up.

2008-02-28 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I agree that we're basically done here. I'm back to -1 on inlining the common case for arithmetic (attached here anyway). Simple cases are already pretty fast, and bigger fractions are dominated by gcd time, not function call overhead. Since dupli

[issue1193577] add server.shutdown() method and daemon arg to SocketServer

2008-03-01 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Polling isn't a great way to handle shutdown, since it wastes CPU time and decreases responsiveness, but it's also easy and my attempt to avoid it isn't getting anywhere, so I'm planning to fix up your patch a bit and commit it. Thanks! I&

[issue1193577] add server.shutdown() method to SocketServer

2008-03-01 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Also, Pedro's argument against a daemon_threads argument to TCPServer convinces me. I think we can add it in ThreadingMixIn.__init__ once this whole hierarchy is switched over to new-style classes. That's already done in 3.0, but I don't kno

[issue1012468] Rational.py various bugfixes

2008-03-01 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Yep. Removed in r61162. -- resolution: -> out of date status: open -> closed _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.o

[issue1193577] add server.shutdown() method to SocketServer

2008-03-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: It seems that .await_request() was only added a month ago to fix issue 742598, so it's no great hardship to refactor it again now. Timeouts never worked for .serve_forever() because the try/except in .handle_request() turned their exception into a plain r

[issue1193577] add server.shutdown() method to SocketServer

2008-03-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: I'll submit the attached patch in a couple days unless I get comments. Added file: http://bugs.python.org/file9586/polling_shutdown.patch _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.or

[issue2179] with should be as fast as try/finally

2008-03-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Here's a proof-of-concept patch that keeps the __exit__ method on the stack. It uses ROT_TWO to stuff it under the context object instead of storing it into a temporary. (Thanks Nick for pointing out that problem before I had to waste time on it.) test

[issue2179] with should be as fast as try/finally

2008-03-02 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Now with documentation, a working test_compile, and one less refleak. Added file: http://bugs.python.org/file9590/faster_with.patch __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/

[issue1107887] Speed up function calls/can add more introspection info

2008-03-02 Thread Jeffrey Yasskin
Changes by Jeffrey Yasskin: -- nosy: +jyasskin _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1107887> _ ___ Python-bugs-list mailing list Unsubs

[issue1193577] add server.shutdown() method to SocketServer

2008-03-06 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Hearing no objections, I've submitted this as r61289. _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1193577> _ ___

[issue2179] with should be as fast as try/finally

2008-03-09 Thread Jeffrey Yasskin
Jeffrey Yasskin <[EMAIL PROTECTED]> added the comment: Thanks Nick and Amaury! Amaury, what times are you seeing? It could be a just-gcc speedup, but I wouldn't have thought so since the patch eliminates 2 times around the eval loop. It could be that the overhead of WITH_CLEANUP is

[issue2262] Helping the compiler avoid memory references in PyEval_EvalFrameEx

2008-03-09 Thread Jeffrey Yasskin
New submission from Jeffrey Yasskin <[EMAIL PROTECTED]>: I'm using Apple's gcc-4.0.1 on a 2.33GHz Intel Core 2 Duo to test this. Measurements from other compilers or other chips would be cool. Specifically, this patch: 1) Moves the declarations of most of the local variable

[issue2262] Helping the compiler avoid memory references in PyEval_EvalFrameEx

2008-03-09 Thread Jeffrey Yasskin
Jeffrey Yasskin <[EMAIL PROTECTED]> added the comment: Neal, t and stream aren't likely to have much effect since they're used so little. next_instr and stack_pointer are used to communicate between loops, so they can't move inside. I eagerly await your benchmark runs. :

[issue2262] Helping the compiler avoid memory references in PyEval_EvalFrameEx

2008-03-10 Thread Jeffrey Yasskin
Changes by Jeffrey Yasskin <[EMAIL PROTECTED]>: Added file: http://bugs.python.org/file9648/elim_mem_refs.patch __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

  1   2   3   >