Re: [Python-Dev] Backporting PEP 3101 to 2.6
* Eric Smith wrote:
> André Malo wrote:
> > I guess, a clean and complete solution (besides re-implementing the
> > whole thing) would be to resolve each single format character with
> > strftime, decode according to the locale and re-assemble the result
> > string piece by piece. Doh!
>
> That's along the lines of what I was thinking. strftime already does
> some of this to support %[zZ].
>
> But now that I look at time.strftime in py3k, it's converting the entire
> unicode string to a char string with PyUnicode_AsString, then converting
> back with PyUnicode_Decode.
Looks wrong to me, too... :-)
nd
--
$_=q?tvc!uif)%*|#Bopuifs!A`#~tvc!Xibu)%*|qsjou#Kvtu!A`#~tvc!KBQI!)*|~
tvc!ifmm)%*|#Qfsm!A`#~tvc!jt)%*|(Ibdlfs(~ # What the hell is JAPH? ;
@_=split/\s\s+#/;$_=(join''=>map{chr(ord( # André Malo ;
$_)-1)}split//=>$_[0]).$_[1];s s.*s$_see; # http://www.perlig.de/ ;
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Use Python 3.0 syntax for except and raise?
Good evening everybody! I like to run the 2to3 tool with raise and except fixers over the 2.6 sources. The raise fixer changes "raise Exception, msg" to "raise Exception(msg)" and the except fixer replaces "except Exception, err" by "except Exception as err". In my humble opinion the Python stdlib should give proper examples how write good code. During the migration period from the 2.x series to 3.x we have two obvious ways to write code. Let's stick to the new and preferred way. Oh and please use the new syntax for patches, too. It makes my job with svnmerge a little bit easier. Thanks! Christian ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Use Python 3.0 syntax for except and raise?
Sounds good to me. Along those lines, shall we work on fixing warnings that -3 raises in the regression test suite? On Feb 17, 2008 8:57 AM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Good evening everybody! > > I like to run the 2to3 tool with raise and except fixers over the 2.6 > sources. The raise fixer changes "raise Exception, msg" to "raise > Exception(msg)" and the except fixer replaces "except Exception, err" by > "except Exception as err". In my humble opinion the Python stdlib should > give proper examples how write good code. > > During the migration period from the 2.x series to 3.x we have two > obvious ways to write code. Let's stick to the new and preferred way. > > Oh and please use the new syntax for patches, too. It makes my job with > svnmerge a little bit easier. > > Thanks! > > Christian > > ___ > Python-Dev mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/jyasskin%40gmail.com > -- Namasté, Jeffrey Yasskin http://jeffrey.yasskin.info/ ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] trunk-math
Aargh. Extra long lines again. Here's a repost. An update: after some discussion, we're planning a PEP for the "with ieee754" and related ideas, perhaps aimed at Python 3.1; there are lots of difficult decisions to be made, and plenty that would benefit from community feedback. In the meantime, we'll get the rest of the fixes/additions tidied up in trunk-math, and hope for their inclusion in 2.6/3.0. Mark ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] trunk-math
An update: after some discussion, we're planning a PEP for the "with ieee754" and related ideas, perhaps aimed at Python 3.1; there are lots of difficult decisions to be made, and plenty that would benefit from community feedback. In the meantime, we'll get the rest of the fixes/additions tidied up in trunk-math, and hope for their inclusion in 2.6/3.0. Mark ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Py_CLEAR to avoid crashes
On Feb 16, 2008 3:12 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: > Should we however intensively search and correct all of them? > Is there a clever way to prevent these problems globally, for example > by delaying finalizers "just a little"? A simple way to do this would be to push objects whose refcounts had reached 0 onto a list instead of finalizing them immediately, and have PyEval_EvalFrameEx periodically swap in a new to-delete list and delete the objects on the old one. A linked list would cost an extra pointer in PyObject_HEAD, but a growable array would only cost allocations, which would be amortized over the allocations of the objects you're deleting, so that's probably the way to go. A fixed-size queue that just delayed finalization by a constant number of objects would usually work without any allocations, but there would sometimes be single finalizers that recursively freed too many other objects, which would defeat the delay. Jeffrey ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Use Python 3.0 syntax for except and raise?
Christian Heimes schrieb: > Good evening everybody! > > I like to run the 2to3 tool with raise and except fixers over the 2.6 > sources. The raise fixer changes "raise Exception, msg" to "raise > Exception(msg)" and the except fixer replaces "except Exception, err" by > "except Exception as err". In my humble opinion the Python stdlib should > give proper examples how write good code. > > During the migration period from the 2.x series to 3.x we have two > obvious ways to write code. Let's stick to the new and preferred way. > > Oh and please use the new syntax for patches, too. It makes my job with > svnmerge a little bit easier. You'd have to exempt modules mentioned in PEP 291 though. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Use Python 3.0 syntax for except and raise?
[Christian Heimes] > I like to run the 2to3 tool with raise and except fixers over the 2.6 > sources. The raise fixer changes "raise Exception, msg" to "raise > Exception(msg)" and the except fixer replaces "except Exception, err" by > "except Exception as err". +1 The new syntax so much better that we should do this even if 3.0 did not exist. There are some modules like Decimal that make a promise to run on earlier versions of Python. In those cases only the first change (backwards compatible) should be made. Our 5,000 line Decimal package will need to wait for 3.0 to use the except/as form :-( Raymond ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Use Python 3.0 syntax for except and raise?
On Feb 17, 2008 2:42 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > There are some modules like Decimal that make a promise to run on earlier > versions of Python. In those cases only the first change (backwards > compatible) > should be made. Our 5,000 line Decimal package will need to wait for 3.0to > use the except/as form :-( > Not a problem. Decimal doesn't use "except Exception, err" anywhere in those 5000 lines, as far as I can tell! :-) Mark ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Use Python 3.0 syntax for except and raise?
On Feb 17, 2:42 pm, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > There are some modules like Decimal that make a promise to run on earlier > versions of Python. In those cases only the first change (backwards > compatible) > should be made. Our 5,000 line Decimal package will need to wait for 3.0 to > use the except/as form :-( It looks to me as though Decimal doesn't use "except Exception, err" anywhere in those 5000 lines. :-) Mark ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Py_CLEAR to avoid crashes
Jeffrey Yasskin wrote: > On Feb 16, 2008 3:12 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: >> Should we however intensively search and correct all of them? >> Is there a clever way to prevent these problems globally, for example >> by delaying finalizers "just a little"? > > A simple way to do this would be to push objects whose refcounts had > reached 0 onto a list instead of finalizing them immediately, and have > PyEval_EvalFrameEx periodically swap in a new to-delete list and > delete the objects on the old one. -1. This would only soften the problem in a shallow way. It should still be possible to create cases where the final cleanup of the object comes "too early", e.g. when some caller of PyEval_EvalFrameEx still carries a pointer to some object that got deleted, and then still some code can get hold of the then-deleted object. It will just be more difficult to trigger such crashes, depending on the period in which objects are cleaned. The only sane way to never touch deleted objects is to have no references to them on heap anymore, and to not touch stack references after the DECREF. Regards, Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Py_CLEAR to avoid crashes
Martin v. Löwis wrote: > when some caller of PyEval_EvalFrameEx still carries > a pointer to some object that got deleted, and then still some code can > get hold of the then-deleted object. I seem to have missed the beginning of this discussion. I don't see what the problem is here. If a caller needs a pointer to an object, shouldn't it be holding a counted reference to it? -- Greg ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
