3886 static PyObject *
3887 PLy_subtransaction_exit(PyObject *self, PyObject *args)
3888 {
3889 PyObject *type;
3890 PyObject *value;
3891 PyObject *traceback;
3892 PLySubtransactionData *subxactdata;
3893 PLySubtransactionObject *subxact = (PLySubtransactionObject *) self;
3894
3895 if (!PyArg_ParseTuple(args, "OOO", &type, &value, &traceback))
when PyArg_ParseTuple() succeeds
taking False path
3896 return NULL;
3897
3898 if (!subxact->started)
when considering range: -128 <= value <= -1
taking False path
3899 {
3900 PLy_exception_set(PyExc_ValueError, "this subtransaction has not been entered");
3901 return NULL;
3902 }
3903
3904 if (subxact->exited)
when considering range: -128 <= value <= -1
taking True path
3905 {
3906 PLy_exception_set(PyExc_ValueError, "this subtransaction has already been exited");
3907 return NULL;
3908 }
3909
3910 if (explicit_subtransactions == NIL)
3911 {
3912 PLy_exception_set(PyExc_ValueError, "there is no subtransaction to exit from");
3913 return NULL;
3914 }
3915
3916 subxact->exited = true;
3917
3918 if (type != Py_None)
3919 {
3920 /* Abort the inner transaction */
3921 RollbackAndReleaseCurrentSubTransaction();
3922 }
3923 else
3924 {
3925 ReleaseCurrentSubTransaction();
3926 }
3927
3928 subxactdata = (PLySubtransactionData *) linitial(explicit_subtransactions);
3929 explicit_subtransactions = list_delete_first(explicit_subtransactions);
3930
3931 MemoryContextSwitchTo(subxactdata->oldcontext);
3932 CurrentResourceOwner = subxactdata->oldowner;
3933 PLy_free(subxactdata);
3934
3935 /*
3936 * AtEOSubXact_SPI() should not have popped any SPI context, but just in
3937 * case it did, make sure we remain connected.
3938 */
3939 SPI_restore_connection();
3940
3941 Py_INCREF(Py_None);
3942 return Py_None;
3943 }
returning (PyObject*)NULL without setting an exception
found 6 similar trace(s) to this