Improvements to modpython.
1. Be able to write binary data to any sockets, not only to ones created from python. 2. Add support for CSmartPtr<CWebSession>
This commit is contained in:
1 parent
d7bd8d8a04
commit
fcc7839771
3 files changed
+21
-18
No files matched your search
@@ -442,23 +442,6 @@ CPySocket::~CPySocket() {
|
||||
Py_CLEAR(m_pyObj);
|
||||
}
|
||||
|
||||
PyObject* CPySocket::WriteBytes(PyObject* data) {
|
||||
if (!PyBytes_Check(data)) {
|
||||
PyErr_SetString(PyExc_TypeError, "socket.WriteBytes needs bytes as argument");
|
||||
return NULL;
|
||||
}
|
||||
char* buffer;
|
||||
Py_ssize_t length;
|
||||
if (-1 == PyBytes_AsStringAndSize(data, &buffer, &length)) {
|
||||
return NULL;
|
||||
}
|
||||
if (Write(buffer, length)) {
|
||||
Py_RETURN_TRUE;
|
||||
} else {
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
template<> void TModInfo<CModPython>(CModInfo& Info) {
|
||||
Info.SetWikiPage("modpython");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user