A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/038989.html below:

[Python-Dev] The Trick

[Python-Dev] The TrickAlex Martelli aleaxit at yahoo.com
Sat Oct 18 16:15:28 EDT 2003
On Saturday 18 October 2003 08:00 pm, Kevin Jacobs wrote:
> On Sat, 18 Oct 2003, Guido van Rossum wrote:
> > I don't like the trick of avoiding the copy if the refcount is one;
> > AFAIK it can't be done in Jython.
>
> There is also a problem with the strategy if if gets called by a C
> extension.  It is perfectly feasible for a C extension to hold the only
> reference to an object, call the copying sort (directly or indirectly), and
> then be very surprised that the copy did not take place.

Alas, I fear you're right.  Darn -- so much for a possible little but
cheap optimization (which might have been neat in PySequence_List
even if copysort never happens and the optimization is only for
CPython -- I don't see why an optimization being impossible in
Jython should stop CPython from making it, as long as semantics
remain compatible).  It's certainly possible for C code to call
PySequence_List or whatever while holding the only reference,
and count on the returned and argument objects being distinct:-(.


Alex


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4