View | Details | Raw Unified | Return to issue 123975
Collapse All | Expand All

(-)pyuno/source/loader/pyuno_loader.cxx.orig (+9 lines)
Lines 113-120 static void setPythonHome ( const OUString & pythonHom Link Here
113
    OUString systemPythonHome;
113
    OUString systemPythonHome;
114
    osl_getSystemPathFromFileURL( pythonHome.pData, &(systemPythonHome.pData) );
114
    osl_getSystemPathFromFileURL( pythonHome.pData, &(systemPythonHome.pData) );
115
    OString o = rtl::OUStringToOString( systemPythonHome, osl_getThreadTextEncoding() );
115
    OString o = rtl::OUStringToOString( systemPythonHome, osl_getThreadTextEncoding() );
116
#if PY_MAJOR_VERSION < 3 || PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 4
116
    rtl_string_acquire(o.pData); // leak this string (thats the api!)
117
    rtl_string_acquire(o.pData); // leak this string (thats the api!)
117
    Py_SetPythonHome( o.pData->buffer);
118
    Py_SetPythonHome( o.pData->buffer);
119
#else
120
    wchar_t *wpath = Py_DecodeLocale(o.pData->buffer, NULL);
121
    if (wpath == NULL) {
122
    	PyErr_SetString(PyExc_SystemError, "Cannot decode python home path");
123
	return;
124
    }
125
    Py_SetPythonHome(wpath);
126
#endif
118
}
127
}
119
128
120
static void prependPythonPath( const OUString & pythonPathBootstrap )
129
static void prependPythonPath( const OUString & pythonPathBootstrap )
(-)pyuno/source/module/pyuno.cxx.orig (-4 / +4 lines)
Lines 450-457 PyObject* PyUNO_getattr (PyObject* self, char* name) Link Here
450
{
450
{
451
    PyUNO* me;
451
    PyUNO* me;
452
452
453
#if PY_VERSION_HEX >= 0x03030000
453
#if PY_VERSION_HEX < 0x03030000
454
    char *name = PyUnicode_AsUTF8(attr_name);
454
    cconst char *name = PyUnicode_AsUTF8(attr_name);
455
#elif PY_MAJOR_VERSION >= 3
455
#elif PY_MAJOR_VERSION >= 3
456
    PyRef pUtf8(PyUnicode_AsUTF8String(attr_name), SAL_NO_ACQUIRE);
456
    PyRef pUtf8(PyUnicode_AsUTF8String(attr_name), SAL_NO_ACQUIRE);
457
    char *name = PyBytes_AsString(pUtf8.get());
457
    char *name = PyBytes_AsString(pUtf8.get());
Lines 568-574 int PyUNO_setattr (PyObject* self, char* name, PyObjec Link Here
568
{
568
{
569
    PyUNO* me;
569
    PyUNO* me;
570
570
571
#if PY_VERSION_HEX >= 0x03030000
571
#if PY_VERSION_HEX < 0x03030000
572
    char *name = PyUnicode_AsUTF8(attr_name);
572
    char *name = PyUnicode_AsUTF8(attr_name);
573
#elif PY_MAJOR_VERSION >= 3
573
#elif PY_MAJOR_VERSION >= 3
574
    PyRef pUtf8(PyUnicode_AsUTF8String(attr_name), SAL_NO_ACQUIRE);
574
    PyRef pUtf8(PyUnicode_AsUTF8String(attr_name), SAL_NO_ACQUIRE);
Lines 818-824 static PyTypeObject PyUNOType = Link Here
818
    NULL,
818
    NULL,
819
    NULL,
819
    NULL,
820
    (destructor)0
820
    (destructor)0
821
#if PY_VERSION_HEX >= 0x02060000
821
#if PY_VERSION_HEX < 0x02060000
822
    , 0
822
    , 0
823
#endif
823
#endif
824
};
824
};
(-)pyuno/source/module/pyuno_util.cxx.orig (-1 / +1 lines)
Lines 86-92 OUString pyString2ustring( PyObject *pystr ) Link Here
86
#if Py_UNICODE_SIZE == 2
86
#if Py_UNICODE_SIZE == 2
87
	ret = OUString( (sal_Unicode * ) PyUnicode_AS_UNICODE( pystr ) );
87
	ret = OUString( (sal_Unicode * ) PyUnicode_AS_UNICODE( pystr ) );
88
#else
88
#else
89
#if PY_VERSION_HEX >= 0x03030000
89
#if PY_VERSION_HEX < 0x03030000
90
    Py_ssize_t size;
90
    Py_ssize_t size;
91
    char *pUtf8 = PyUnicode_AsUTF8AndSize(pystr, &size);
91
    char *pUtf8 = PyUnicode_AsUTF8AndSize(pystr, &size);
92
    ret = OUString(pUtf8, size, RTL_TEXTENCODING_UTF8);
92
    ret = OUString(pUtf8, size, RTL_TEXTENCODING_UTF8);

Return to issue 123975