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/2001-September/017474.html below:

[Python-Dev] Free threading and borrowing references from mutable types

[Python-Dev] Free threading and borrowing references from mutable typesMartin von Loewis loewis@informatik.hu-berlin.de
Tue, 11 Sep 2001 13:01:38 +0200 (MEST)
Considering the free threading issue (again), I found that functions
returning borrowed references are problematic if the container is
mutable.

In traditional Python, extension modules could safely borrow
references if they know that they maintain a reference to the
container. If a thread switch is possible between getting the borrowed
reference and using it, then this assumption is wrong: another thread
may remove the reference from the container, so that the object dies.

Therefore, I propose to deprecate these functions. I'm willing to
write a PEP elaborating on that if necessary, but I'd like to perform
a quick poll beforehand
- whether people think that deprecating these functions is reasonable
- whether it is sufficient to only have their abstract.c equivalents,
  or whether type-specific replacements that do return new references
  are needed
- what else I'm missing.

Specifically, I think the following functions are problematic:
- PyList_GetItem, PyList_GET_ITEM,
- PyDict_GetItem, PyDict_GetItemString

Any comments appreciated,

Martin




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