mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Rearranged code to fix recent MSVC errors
Rearranged code to fix recent MSVC errors, such as mutex locking in conn_setup to after the delcarations of variables.
This commit is contained in:
parent
69a8400e60
commit
5a3e07a610
|
@ -65,6 +65,8 @@ void
|
||||||
conn_notice_process(connectionObject *self)
|
conn_notice_process(connectionObject *self)
|
||||||
{
|
{
|
||||||
struct connectionObject_notice *notice;
|
struct connectionObject_notice *notice;
|
||||||
|
PyObject *msg;
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
pthread_mutex_lock(&self->lock);
|
pthread_mutex_lock(&self->lock);
|
||||||
|
|
||||||
|
@ -73,7 +75,7 @@ conn_notice_process(connectionObject *self)
|
||||||
while (notice != NULL) {
|
while (notice != NULL) {
|
||||||
Py_BLOCK_THREADS;
|
Py_BLOCK_THREADS;
|
||||||
|
|
||||||
PyObject *msg = PyString_FromString(notice->message);
|
msg = PyString_FromString(notice->message);
|
||||||
|
|
||||||
Dprintf("conn_notice_process: %s", notice->message);
|
Dprintf("conn_notice_process: %s", notice->message);
|
||||||
|
|
||||||
|
@ -122,10 +124,6 @@ conn_notice_clean(connectionObject *self)
|
||||||
int
|
int
|
||||||
conn_setup(connectionObject *self, PGconn *pgconn)
|
conn_setup(connectionObject *self, PGconn *pgconn)
|
||||||
{
|
{
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
|
||||||
pthread_mutex_lock(&self->lock);
|
|
||||||
Py_BLOCK_THREADS;
|
|
||||||
|
|
||||||
PGresult *pgres;
|
PGresult *pgres;
|
||||||
const char *data, *tmp;
|
const char *data, *tmp;
|
||||||
const char *scs; /* standard-conforming strings */
|
const char *scs; /* standard-conforming strings */
|
||||||
|
@ -142,6 +140,10 @@ conn_setup(connectionObject *self, PGconn *pgconn)
|
||||||
static const char lvl2a[] = "repeatable read";
|
static const char lvl2a[] = "repeatable read";
|
||||||
static const char lvl2b[] = "serializable";
|
static const char lvl2b[] = "serializable";
|
||||||
|
|
||||||
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
|
pthread_mutex_lock(&self->lock);
|
||||||
|
Py_BLOCK_THREADS;
|
||||||
|
|
||||||
if (self->encoding) free(self->encoding);
|
if (self->encoding) free(self->encoding);
|
||||||
self->equote = 0;
|
self->equote = 0;
|
||||||
self->isolation_level = 0;
|
self->isolation_level = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user