127 points · by etrevino · 8y ago · 18 comments
Is execution_loop really meant to start and end holding the GIL?
As for empty lines within code, I personally find it helpful to visually separate logical segments.
I see it as, if a function is like a paragraph, then the whitespace between lines deliminates sentences. I very much dislike run on sentences that are attempting to explain complex rules/topics in english and in code. Spatial grouping is very natural for the eyes and mind.
So much for "implemented".
Incidentally, apparently PyPy has a GIL too[1], complete with a detailed description in a source-code comment, similar to the one quoted in the linked article[2]. It's written in C. Isn't the point of PyPy that it's written in a Python subset?
[1]http://doc.pypy.org/en/latest/faq.html#does-pypy-have-a-gil-... [2]https://bitbucket.org/pypy/pypy/src/00f8eae1/rpython/transla...
This comment reeks of middlebrow dismissal. The author implemented the GIL in pure Python for illustration purposes, as it says in the very first paragraph of the article, yet you complain it won't actually run. Where were you thinking of using a pure-Python GIL that this is such an inconvenience to you?
> Isn't the point of PyPy that it's written in a Python subset?
More dismissal. The point of PyPy is to be a JIT. What it's written in is incidental, not "the point".
As to my second point, you're reading dismissal where there is none intended. My question wasn't rhetorical. Ironically, you've just dismissed my question.
Is Wikipedia's PyPy article mistaken in describing it as 'Written in RPython'? I'll go ahead and fix it if so, or perhaps I'm missing something about the status of the C code.
The GIL is fully implemented. Just because it's typically seen with a bytecode interpreter doesn't make that such an interpreter is part of it, or a prerequisite.
PyPy is written in RPython. You posted a link to the RPython translator's source code.
That subset is rpython (which beyond a python subset is a framework for implementing dynamic language runtimes: https://rpython.readthedocs.io/en/latest/).
You'll note that the gil is part of rpython.
Why would you need a working GIL inside the GIL?