Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does `psycopg2` in Python 2.x block the GIL

I'm trying to settle an argument with a coworker. Say that I have a Python 2.6 app that uses psycopg2 to communicate with a Postgres database. The app is multithreaded. When a thread makes a database call using psycopg2, does it release the GIL so other threads could also make a database call?

like image 440
Ram Rachum Avatar asked Oct 30 '22 01:10

Ram Rachum


1 Answers

From a quick glance at the Psycopg release notes, there are many references to releasing the GIL. So apparently it tries to release the GIL when appropriate. You didn't ask about a specific scenario, so I don't think a more specific answer is possible.

like image 144
taleinat Avatar answered Nov 15 '22 06:11

taleinat