mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 01:37:31 +03:00 
			
		
		
		
	Fixed call of memory functions without the GIL
This commit is contained in:
		
							parent
							
								
									20f714f17c
								
							
						
					
					
						commit
						66555c5f11
					
				| 
						 | 
					@ -610,6 +610,8 @@ pq_tpc_command_locked(connectionObject *conn, const char *cmd, const char *tid,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    conn->mark += 1;
 | 
					    conn->mark += 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    PyEval_RestoreThread(*tstate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* convert the xid into the postgres transaction_id and quote it. */
 | 
					    /* convert the xid into the postgres transaction_id and quote it. */
 | 
				
			||||||
    if (!(etid = psycopg_escape_string((PyObject *)conn, tid, 0, NULL, NULL)))
 | 
					    if (!(etid = psycopg_escape_string((PyObject *)conn, tid, 0, NULL, NULL)))
 | 
				
			||||||
    { goto exit; }
 | 
					    { goto exit; }
 | 
				
			||||||
| 
						 | 
					@ -623,12 +625,15 @@ pq_tpc_command_locked(connectionObject *conn, const char *cmd, const char *tid,
 | 
				
			||||||
    if (0 > PyOS_snprintf(buf, buflen, "%s %s;", cmd, etid)) { goto exit; }
 | 
					    if (0 > PyOS_snprintf(buf, buflen, "%s %s;", cmd, etid)) { goto exit; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* run the command and let it handle the error cases */
 | 
					    /* run the command and let it handle the error cases */
 | 
				
			||||||
 | 
					    *tstate = PyEval_SaveThread();
 | 
				
			||||||
    rv = pq_execute_command_locked(conn, buf, pgres, error, tstate);
 | 
					    rv = pq_execute_command_locked(conn, buf, pgres, error, tstate);
 | 
				
			||||||
 | 
					    PyEval_RestoreThread(*tstate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit:
 | 
					exit:
 | 
				
			||||||
    PyMem_Free(buf);
 | 
					    PyMem_Free(buf);
 | 
				
			||||||
    PyMem_Free(etid);
 | 
					    PyMem_Free(etid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    *tstate = PyEval_SaveThread();
 | 
				
			||||||
    return rv;
 | 
					    return rv;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user