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 | <1243870547.17920.13.camel@erin> |
Il giorno lun, 01/06/2009 alle 17.32 +0200, Federico Di Gregorio ha scritto: > 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. You probably just want to put PyGILState_XXX around the Python API call in the notice processor. -- Federico Di Gregorio http://people.initd.org/fog Debian GNU/Linux Developer [email protected] INIT.D Developer fog-NGVKUo/i/[email protected] Spesso crescere ed andare a vivere da soli è l'unico modo di restare bambini. -- Alice Fontana _______________________________________________ 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) iEYEABECAAYFAkoj9VMACgkQvcCgrgZGjetmqACgrfRx9pzbI9Tzv5a5BiwrruHe stQAn1PIHsnWAhHwJC9iIJWUO0XPKY5L =UMEU -----END PGP SIGNATURE-----