Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into remove-objc
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Jan 19, 2024
2 parents 47bf6f7 + 67c70b8 commit df5e937
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 4,167 deletions.
5 changes: 4 additions & 1 deletion .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ runs:
steps:
# Python3 is already installed though Homebrew
- name: Install brew dependencies
run: brew install --force --overwrite python ruby openjdk node php lmdb mcpp
run: |
brew unlink python3
brew link --overwrite python3
brew install ruby openjdk node php lmdb mcpp
shell: bash
if: runner.os == 'macOS'

Expand Down
26 changes: 1 addition & 25 deletions cpp/src/Slice/PythonUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,30 +817,6 @@ Slice::Python::CodeVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p)
}
_out << "), " << contextParamName << "))";
_out.dec();

_out << sp;
writeDocstring(*oli, DocAsyncBegin);
_out << nl << "def begin_" << (*oli)->name() << "(self";
if(!inParams.empty())
{
_out << ", " << inParams;
}
_out << ", _response=None, _ex=None, _sent=None, " << contextParamName << "=None):";
_out.inc();
_out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
if(!inParams.empty() && inParams.find(',') == string::npos)
{
_out << ", ";
}
_out << "), _response, _ex, _sent, " << contextParamName << "))";
_out.dec();

_out << sp;
writeDocstring(*oli, DocAsyncEnd);
_out << nl << "def end_" << (*oli)->name() << "(self, _r):";
_out.inc();
_out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".end(self, _r)";
_out.dec();
}

_out << sp << nl << "@staticmethod";
Expand Down Expand Up @@ -1961,7 +1937,7 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax
{
const string controlChars = "\a\b\f\n\r\t\v";
const unsigned char cutOff = 0;

_out << "\"" << toStringLiteral(value, controlChars, "", UCN, cutOff) << "\"";
break;
}
Expand Down
113 changes: 0 additions & 113 deletions python/modules/IcePy/Communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,114 +823,6 @@ communicatorFlushBatchRequestsAsync(CommunicatorObject* self, PyObject* args, Py
return future.release();
}

#ifdef WIN32
extern "C"
#endif
static PyObject*
communicatorBeginFlushBatchRequests(CommunicatorObject* self, PyObject* args, PyObject* kwds)
{
assert(self->communicator);

static char* argNames[] =
{
const_cast<char*>("compress"),
const_cast<char*>("_ex"),
const_cast<char*>("_sent"),
0
};
PyObject* compressBatch;
PyObject* ex = Py_None;
PyObject* sent = Py_None;
if(!PyArg_ParseTupleAndKeywords(args, kwds, STRCAST("O|OO"), argNames, &compressBatch, &ex, &sent))
{
return 0;
}

PyObject* compressBatchType = lookupType("Ice.CompressBatch");
if(!PyObject_IsInstance(compressBatch, reinterpret_cast<PyObject*>(compressBatchType)))
{
PyErr_Format(PyExc_ValueError, STRCAST("expected an Ice.CompressBatch enumerator"));
return 0;
}

PyObjectHandle v = getAttr(compressBatch, "_value", false);
assert(v.get());
Ice::CompressBatch cb = static_cast<Ice::CompressBatch>(PyLong_AsLong(v.get()));

if(ex == Py_None)
{
ex = 0;
}
if(sent == Py_None)
{
sent = 0;
}

if(!ex && sent)
{
PyErr_Format(PyExc_RuntimeError,
STRCAST("exception callback must also be provided when sent callback is used"));
return 0;
}

Ice::Callback_Communicator_flushBatchRequestsPtr callback;
if(ex || sent)
{
FlushCallbackPtr d = new FlushCallback(ex, sent, "flushBatchRequests");
callback = Ice::newCallback_Communicator_flushBatchRequests(d, &FlushCallback::exception, &FlushCallback::sent);
}

Ice::AsyncResultPtr result;
try
{
if(callback)
{
result = (*self->communicator)->begin_flushBatchRequests(cb, callback);
}
else
{
result = (*self->communicator)->begin_flushBatchRequests(cb);
}
}
catch(const Ice::Exception& e)
{
setPythonException(e);
return 0;
}

return createAsyncResult(result, 0, 0, self->wrapper);
}

#ifdef WIN32
extern "C"
#endif
static PyObject*
communicatorEndFlushBatchRequests(CommunicatorObject* self, PyObject* args)
{
assert(self->communicator);

PyObject* result;
if(!PyArg_ParseTuple(args, STRCAST("O!"), &AsyncResultType, &result))
{
return 0;
}

Ice::AsyncResultPtr r = getAsyncResult(result);
try
{
AllowThreads allowThreads; // Release Python's global interpreter lock during blocking invocations.
(*self->communicator)->end_flushBatchRequests(r);
}
catch(const Ice::Exception& ex)
{
setPythonException(ex);
return 0;
}

Py_INCREF(Py_None);
return Py_None;
}

#ifdef WIN32
extern "C"
#endif
Expand Down Expand Up @@ -1645,11 +1537,6 @@ static PyMethodDef CommunicatorMethods[] =
PyDoc_STR(STRCAST("flushBatchRequests(compress) -> None")) },
{ STRCAST("flushBatchRequestsAsync"), reinterpret_cast<PyCFunction>(communicatorFlushBatchRequestsAsync),
METH_VARARGS, PyDoc_STR(STRCAST("flushBatchRequestsAsync(compress) -> Ice.Future")) },
{ STRCAST("begin_flushBatchRequests"), reinterpret_cast<PyCFunction>(communicatorBeginFlushBatchRequests),
METH_VARARGS | METH_KEYWORDS,
PyDoc_STR(STRCAST("begin_flushBatchRequests(compress[, _ex][, _sent]) -> Ice.AsyncResult")) },
{ STRCAST("end_flushBatchRequests"), reinterpret_cast<PyCFunction>(communicatorEndFlushBatchRequests),
METH_VARARGS, PyDoc_STR(STRCAST("end_flushBatchRequests(Ice.AsyncResult) -> None")) },
{ STRCAST("createAdmin"), reinterpret_cast<PyCFunction>(communicatorCreateAdmin), METH_VARARGS,
PyDoc_STR(STRCAST("createAdmin(adminAdapter, adminIdentity) -> Ice.ObjectPrx")) },
{ STRCAST("getAdmin"), reinterpret_cast<PyCFunction>(communicatorGetAdmin), METH_NOARGS,
Expand Down
Loading

0 comments on commit df5e937

Please sign in to comment.