28 points

It’s exciting, but man there are lots of assumptions in native python built around the gil.

I’ve seen lists, etc. modified by threads assuming the gil locks for them. Testing this e2e for any production deployment can be a bit of a nightmare.

permalink
report
reply
40 points
*

My company makes it super easy for me - we’re just going to continue on python 2.7 and add this to the long list of reasons why we’re not upgrading.

Please send help.

permalink
report
parent
reply
3 points

You may be pleased to know that PyPy’s Python 2.7 branch will be maintained indefinitely, since PyPy is also written in Python 2.7. Also, if you can’t leave CPython yet, ActivePython’s team is publishing CPython 2.7 security patches.

permalink
report
parent
reply
3 points

We already have contracts in place to get security patches. That’s usually the InfoSec team’s problem anyway.

As a developer, my life gets hard due to library support. We manage internal forks of multiple open source projects just to make them python 2 compatible. A non-trivial amount of time is wasted on this, and we don’t even have it available for public use. 🤷‍♂️

permalink
report
parent
reply
2 points

Python 2.7 and iOS mobile programmers stuck on Objective-C could start a support group.

permalink
report
parent
reply
2 points

Why would you not be upgrading due to a new feature of python? You don’t like new features or was that a badly wordered sentence?

permalink
report
parent
reply
10 points

Because using an exceedingly insecure version is cheaper until an inevitable compromise makes it expensive.

permalink
report
parent
reply
4 points

More work, more debt. The more debt you have the harder it is to let go.

permalink
report
parent
reply
20 points

While pure Python code should work unchanged, code written in other languages or using the CPython C API may not. The GIL was implicitly protecting a lot of thread-unsafe C, C++, Cython, Fortran, etc. code - and now it no longer does. Which may lead to all sorts of fun outcomes (crashes, intermittent incorrect behavior, etc.).

:tabclose

permalink
report
reply
4 points

those libraries include pretty much almost all popular libraries. It’s just impossible to write performant code in python.

permalink
report
parent
reply
8 points

I’m curious to see how this whole thing shakes out. Like, will removing the GIL be an uphill battle that everyone regrets even suggesting?Will it be so easy, we wonder why we didn’t do it years ago? Or, most likely, somewhere in the middle?

permalink
report
reply
3 points

Did you read the article?

permalink
report
parent
reply
9 points

Yes, testing infrastructure is being put in place and some low-hanging fruit bugs have already been squashed. This bodes well, but it’s still early days, and I imagine not a lot of GIL-less production deployments are out there yet - where the real showstoppers will potentially live.

I’m tenatively optimistic, but threading bugs are sometimes hard to catch

permalink
report
parent
reply
2 points

threading bugs are sometimes hard to catch

Putting it mildly! Threading bugs are probably the worst class of bugs to debug

Definitely debatable if this is worth the risk of impossible bugs. Python is very slow, and multi threading isn’t going to change that. 4x extremely slow is still extremely slow. If you care remotely about performance you need to use a different language anyway.

permalink
report
parent
reply
1 point

The reality is just that some kind of python code will have the same race conditions as most other languages moving forward and that’s ok.

permalink
report
parent
reply
1 point
*

I have a project ready to try this out. It’s a software simulator, and each run (typically 10-10,000 iterations) can be done independently, with the results aggregated and shown at the end. It’s also instrumented to show CPU and memory usage, and on MacOS, you can watch how busy each core gets (hint: PEGGED in multicore mode).

Can run it single-threaded, then with multiprocessing, then with multi-core and time each one. Pretty happy with multicore, but as soon as the no-GIL/subinterpreter version is stable, will try it out and see if it makes any difference. Under the hood it uses numpy and scipy, so will have to wait for them.

Edit: on my todo list is to try it all out in Mojo. They make pretty big performance gain claims.

permalink
report
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 3.1K

    Monthly active users

  • 890

    Posts

  • 7.7K

    Comments