Re: Handling notices, warnings, etc.

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <1243870334.17920.12.camel@erin>
Il giorno mar, 02/06/2009 alle 01.10 +1000, Joel Nothman ha scritto:
> At first I had troubles with Python threads (none was available to
> make  
> the call to connection.notice_handler). If I have understood the
> nature of  
> the threading problem correctly, I solved these by replacing  
> Py_BEGIN_ALLOW_THREADS with gstate = PyGILState_Ensure(), etc.

Your patch makes psycopg lock other Python threads during the execution
of possibly slow libpq calls. PyGILState_XXX functions are supposed to
be used from C threads to acquire the GIL and allow the execution of
Python API calls (locking out other threads) but we don't need that
because the code is already executing as a Python thread.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
 A desobediência é uma virtude necessária à criatividade. -- Raul Seixas

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkoj9H4ACgkQvcCgrgZGjetmuACgpk3tLxIanydyMMErfQZRGtjL
rqYAn3LSxizpx0yHDM3LTPDsgZZVZ789
=TG+h
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.