53 ms·
What packages might depend on the GIL and why would they need it?
by hsbauauvhabzb 3y ago
What packages might depend on the GIL and why would they need it?
- mlyle 3y agoPackages with native components that have not been updated for the semantics changes.
- whiterknight 3y agoAny C code that uses global variables casually.
- CJefferson 3y agoAlmost all packages depend on the GIL (at least at first). They assume they can "take the GIL", and then go and look at the various Python datastructures you passed them without worrying about them changing as they are being read. The later, when writing out their answer (which might involve editing something they were given), they can assume they are not changing. For example, you could write code which extends the length of a list to 100, then fill in all the members, not worrying half way through your loop another thread shrinks the list back down.
- imtringued 3y agoThis only applies to native extensions.
- CJefferson 3y agoSorry, you are or course correct, I should have said all extensions with native code.