[Python-ideas] easy thread-safety [was: fork]
Steven D'Aprano
steve at pearwood.info
Thu Aug 20 18:51:07 CEST 2015
On Thu, Aug 20, 2015 at 12:27:55PM -0400, Ron Adam wrote:
> When a bytecode to load an object is executed such as LOAD_FAST, it gets
> it's reference to the object from the function's list of names in it's
> code object.
Bytes codes are implementation, not semantics: there is no part of the
Python language that promises that retrieving local variables will use a
byte code LOAD_FAST. That's not how IronPython or Jython work, and there
is no stability guarantee that CPython will always use LOAD_FAST.
> LOAD_FAST 0, reads __code__.co_varnames[0]
> LOAD_FAST 1, reads __code__.co_varnames[1]
>
> Adding a co_mutables name list to the __code__ attribute, along with new
> bytecodes to access them, it would create a way to keep private local
> names without changing how the other bytecodes work.
>
> LOAD_MUTABLE 0, would get the first reference in __code__.co_mutables.
What difference would it make to have a different implemention for
retrieving and setting the object? How will having this byte code "keep
private local names"?
--
Steve
More information about the Python-ideas
mailing list