diff --git a/CHANGES.md b/CHANGES.md index 29eb008c76..0691cae98c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,8 @@ As of build 305, installation .exe files have been deprecated; see Coming in build 312, as yet unreleased -------------------------------------- +* Resolved a handful of deprecation warnings (mhammond#2591, [@Avasam][Avasam]) + Build 311, released 2025/07/14 ------------------------------ diff --git a/Pythonwin/win32cmdui.cpp b/Pythonwin/win32cmdui.cpp index 617c8e5f62..18f8fb351c 100644 --- a/Pythonwin/win32cmdui.cpp +++ b/Pythonwin/win32cmdui.cpp @@ -282,7 +282,7 @@ static struct PyMethodDef PyCCmdUI_methods[] = { PyObject *PyCCmdUI::getattro(PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (strcmp(name, "m_nIndex") == 0) { // @prop int|m_nIndex| CCmdUI *pCU = PyCCmdUI::GetCCmdUIPtr(this); if (!pCU) diff --git a/Pythonwin/win32dlg.cpp b/Pythonwin/win32dlg.cpp index 6a0e2fecbc..bc319bd02c 100644 --- a/Pythonwin/win32dlg.cpp +++ b/Pythonwin/win32dlg.cpp @@ -171,7 +171,7 @@ PyCDialog::~PyCDialog() PyObject *PyCDialog::getattro(PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (strcmp(name, "data") == 0) { Py_INCREF(dddict); return dddict; diff --git a/Pythonwin/win32toolbar.cpp b/Pythonwin/win32toolbar.cpp index fd29148bc8..2eceaf9c6d 100644 --- a/Pythonwin/win32toolbar.cpp +++ b/Pythonwin/win32toolbar.cpp @@ -164,7 +164,7 @@ struct MyMemberList dcmembers[] = { PyObject *PyCDockContext::getattro(PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; CDockContext *pC = GetDockContext(this); @@ -200,7 +200,7 @@ PyObject *PyCDockContext::getattro(PyObject *obname) int PyCDockContext::setattro(PyObject *obname, PyObject *value) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; CDockContext *pC = GetDockContext(this); @@ -446,7 +446,7 @@ static struct PyMethodDef PyCControlBar_methods[] = { PyObject *PyCControlBar::getattro(PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; CControlBar *pCtlBar = PyCControlBar::GetControlBar(this); @@ -477,7 +477,7 @@ PyObject *PyCControlBar::getattro(PyObject *obname) int PyCControlBar::setattro(PyObject *obname, PyObject *v) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; diff --git a/Pythonwin/win32util.cpp b/Pythonwin/win32util.cpp index dcaefb5a70..01b07b8d2a 100644 --- a/Pythonwin/win32util.cpp +++ b/Pythonwin/win32util.cpp @@ -92,7 +92,7 @@ static PySequenceMethods PyCRect_Sequence = { PyObject *PyCRect::getattro(PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; if (strcmp(name, "left") == 0) @@ -140,7 +140,7 @@ CString PyCRect::repr() int PyCRect::setattro(PyObject *obname, PyObject *v) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; int intval = PyLong_AsLong(v); diff --git a/com/win32com/src/PyIBase.cpp b/com/win32com/src/PyIBase.cpp index 10f26b4429..4dfac2aa5f 100644 --- a/com/win32com/src/PyIBase.cpp +++ b/com/win32com/src/PyIBase.cpp @@ -32,14 +32,14 @@ PyObject *PyIBase::getattr(char *name) { return PyObject_GetAttrString(this, nam /*static*/ int PyIBase::setattro(PyObject *op, PyObject *obname, PyObject *v) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; PyIBase *bc = (PyIBase *)op; return bc->setattr(name, v); } -int PyIBase::setattr(char *name, PyObject *v) +int PyIBase::setattr(const char *name, PyObject *v) { char buf[128]; sprintf(buf, "%s has read-only attributes", ob_type->tp_name); diff --git a/com/win32com/src/PyRecord.cpp b/com/win32com/src/PyRecord.cpp index 394d15b1fb..d0f401fc83 100644 --- a/com/win32com/src/PyRecord.cpp +++ b/com/win32com/src/PyRecord.cpp @@ -590,7 +590,7 @@ PyObject *PyRecord::getattro(PyObject *self, PyObject *obname) PyRecord *pyrec = (PyRecord *)self; GUID structguid; OLECHAR *guidString; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; if (strcmp(name, "__record_type_guid__") == 0) { diff --git a/com/win32com/src/extensions/PySTGMEDIUM.cpp b/com/win32com/src/extensions/PySTGMEDIUM.cpp index ec26cd116f..823f288256 100644 --- a/com/win32com/src/extensions/PySTGMEDIUM.cpp +++ b/com/win32com/src/extensions/PySTGMEDIUM.cpp @@ -230,7 +230,7 @@ void PySTGMEDIUM::Close() PyObject *PySTGMEDIUM::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; diff --git a/com/win32com/src/include/PythonCOM.h b/com/win32com/src/include/PythonCOM.h index 72ed16e0cc..ed417a57cf 100644 --- a/com/win32com/src/include/PythonCOM.h +++ b/com/win32com/src/include/PythonCOM.h @@ -168,7 +168,7 @@ class PYCOM_EXPORT PyIBase : public PyObject { public: // virtuals for Python support virtual PyObject *getattr(char *name); - virtual int setattr(char *name, PyObject *v); + virtual int setattr(const char *name, PyObject *v); virtual PyObject *repr(); virtual int compare(PyObject *other) { diff --git a/com/win32comext/adsi/src/PyADSIUtil.cpp b/com/win32comext/adsi/src/PyADSIUtil.cpp index 06c0ec2097..c5b7ebe45f 100644 --- a/com/win32comext/adsi/src/PyADSIUtil.cpp +++ b/com/win32comext/adsi/src/PyADSIUtil.cpp @@ -449,7 +449,7 @@ class PyADS_ATTR_INFO : public PyObject { static PyObject *getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; if (strcmp(name, "__members__") == 0) { diff --git a/com/win32comext/adsi/src/PyIADs.cpp b/com/win32comext/adsi/src/PyIADs.cpp index 1452a5d98b..a39da15db6 100644 --- a/com/win32comext/adsi/src/PyIADs.cpp +++ b/com/win32comext/adsi/src/PyIADs.cpp @@ -247,7 +247,7 @@ static struct PyMethodDef PyIADs_methods[] = { PyObject *PyIADs_getattro(PyObject *ob, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (!name) return NULL; diff --git a/com/win32comext/directsound/src/PyDSBUFFERDESC.cpp b/com/win32comext/directsound/src/PyDSBUFFERDESC.cpp index 169d8121d5..05ee18f6b3 100644 --- a/com/win32comext/directsound/src/PyDSBUFFERDESC.cpp +++ b/com/win32comext/directsound/src/PyDSBUFFERDESC.cpp @@ -103,8 +103,8 @@ PyTypeObject PyDSBUFFERDESCType = { // IDirectSound::CreateSoundBuffer call. With this flag set, an application using DirectSound can continue to play // its sticky focus buffers if the user switches to another application not using DirectSound. In this situation, // the application's normal buffers are muted, but the sticky focus buffers are still audible. This is useful for - // nongame applications, such as movie playback (DirectShow™), when the user wants to hear the soundtrack while - // typing in Microsoft Word or Microsoft® Excel, for example. However, if the user switches to another DirectSound + // nongame applications, such as movie playback (DirectShowâ„¢), when the user wants to hear the soundtrack while + // typing in Microsoft Word or Microsoft® Excel, for example. However, if the user switches to another DirectSound // application, all sound buffers, both normal and sticky focus, in the previous application are muted. // @flag DSBCAPS_GLOBALFOCUS|The buffer is a global sound buffer. With this flag set, an application using // DirectSound can continue to play its buffers if the user switches focus to another application, even if the new @@ -167,7 +167,7 @@ PyDSBUFFERDESC::~PyDSBUFFERDESC() { Py_XDECREF(m_obWFX); } int PyDSBUFFERDESC::setattro(PyObject *self, PyObject *obname, PyObject *obvalue) { PyDSBUFFERDESC *obself = (PyDSBUFFERDESC *)self; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; diff --git a/com/win32comext/directsound/src/PyDSCBUFFERDESC.cpp b/com/win32comext/directsound/src/PyDSCBUFFERDESC.cpp index 1623e6d8ad..f612d16a62 100644 --- a/com/win32comext/directsound/src/PyDSCBUFFERDESC.cpp +++ b/com/win32comext/directsound/src/PyDSCBUFFERDESC.cpp @@ -135,7 +135,7 @@ PyDSCBUFFERDESC::~PyDSCBUFFERDESC() { Py_XDECREF(m_obWFX); } int PyDSCBUFFERDESC::setattro(PyObject *self, PyObject *obname, PyObject *obvalue) { PyDSCBUFFERDESC *obself = (PyDSCBUFFERDESC *)self; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; diff --git a/win32/src/PyOVERLAPPED.cpp b/win32/src/PyOVERLAPPED.cpp index 5a5af5a8db..b2d0e1c9f3 100644 --- a/win32/src/PyOVERLAPPED.cpp +++ b/win32/src/PyOVERLAPPED.cpp @@ -110,7 +110,7 @@ PYWINTYPES_EXPORT PyTypeObject PyOVERLAPPEDType = { {"Offset", T_ULONG, OFF(m_overlapped.Offset)}, // @prop integer|Offset|Specifies a file position at which to start the transfer. The // file position is a byte offset from the start of the file. The calling process sets - // this member before calling the ReadFile or WriteFile function. This member is + // this member before calling the ReadFile or WriteFile function. This member is // ignored when reading from or writing to named pipes and communications devices. {"OffsetHigh", T_ULONG, OFF(m_overlapped.OffsetHigh)}, // @prop integer|OffsetHigh|Specifies the high word of the // byte offset at which to start the transfer. @@ -123,7 +123,7 @@ PYWINTYPES_EXPORT PyTypeObject PyOVERLAPPEDType = { {"hEvent", T_OBJECT, OFF(obDummy)}, // @prop |hEvent|Identifies an event set to the signaled state when // the transfer has been completed. The calling process sets this member before // calling the , , , or  function. + // win32pipe.ConnectNamedPipe>, or function. {"Internal", T_OBJECT, OFF(obDummy)}, // @prop integer|Internal|Reserved for operating system use. (pointer-sized value) {"InternalHigh", T_OBJECT, @@ -182,7 +182,7 @@ PyObject *PyOVERLAPPED::richcompareFunc(PyObject *ob, PyObject *other, int op) PyObject *PyOVERLAPPED::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; if (strcmp("hEvent", name) == 0) { @@ -210,7 +210,7 @@ int PyOVERLAPPED::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete OVERLAPPED attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; if (strcmp("hEvent", name) == 0) { diff --git a/win32/src/PySECURITY_ATTRIBUTES.cpp b/win32/src/PySECURITY_ATTRIBUTES.cpp index b1601ff393..b48629cc8f 100644 --- a/win32/src/PySECURITY_ATTRIBUTES.cpp +++ b/win32/src/PySECURITY_ATTRIBUTES.cpp @@ -157,7 +157,7 @@ int PySECURITY_ATTRIBUTES::setattro(PyObject *self, PyObject *obname, PyObject * PyErr_SetString(PyExc_AttributeError, "can't delete SECURITY_ATTRIBUTES attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; if (strcmp(name, "SECURITY_DESCRIPTOR") == 0) { diff --git a/win32/src/PyWinTypes.h b/win32/src/PyWinTypes.h index 37c21c1d5d..b9f56d8883 100644 --- a/win32/src/PyWinTypes.h +++ b/win32/src/PyWinTypes.h @@ -52,13 +52,6 @@ // Macro to handle PyObject layout changes in Py3k #define PYWIN_OBJECT_HEAD PyVarObject_HEAD_INIT(NULL, 0) -/* Attribute names are passed as Unicode in Py3k, so use a macro to - switch between string and unicode conversion. This function is not - documented, but is used extensively in the Python codebase itself, - so it's reasonable to assume it won't disappear anytime soon. -*/ -#define PYWIN_ATTR_CONVERT (char *)_PyUnicode_AsString - typedef Py_ssize_t Py_hash_t; // This only enables runtime checks in debug builds - so we use diff --git a/win32/src/win32api_display.cpp b/win32/src/win32api_display.cpp index 16194f88c3..c757a41662 100644 --- a/win32/src/win32api_display.cpp +++ b/win32/src/win32api_display.cpp @@ -125,7 +125,7 @@ PyObject *PyDISPLAY_DEVICE::Clear(PyObject *self, PyObject *args) PyObject *PyDISPLAY_DEVICE::getattro(PyObject *self, PyObject *obname) { PDISPLAY_DEVICE pdisplay_device = &((PyDISPLAY_DEVICE *)self)->display_device; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; @@ -162,7 +162,7 @@ PyObject *PyDISPLAY_DEVICE::getattro(PyObject *self, PyObject *obname) int PyDISPLAY_DEVICE::setattro(PyObject *self, PyObject *obname, PyObject *obvalue) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; diff --git a/win32/src/win32consolemodule.cpp b/win32/src/win32consolemodule.cpp index 1c4cc2a824..33999f7342 100644 --- a/win32/src/win32consolemodule.cpp +++ b/win32/src/win32consolemodule.cpp @@ -466,7 +466,7 @@ struct PyMemberDef PyINPUT_RECORD::members[] = { PyObject *PyINPUT_RECORD::tp_getattro(PyObject *self, PyObject *obname) { INPUT_RECORD *pir = &((PyINPUT_RECORD *)self)->input_record; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; if (strcmp(name, "ControlKeyState") == 0) { @@ -514,8 +514,7 @@ PyObject *PyINPUT_RECORD::tp_getattro(PyObject *self, PyObject *obname) int PyINPUT_RECORD::tp_setattro(PyObject *self, PyObject *obname, PyObject *obvalue) { INPUT_RECORD *pir = &((PyINPUT_RECORD *)self)->input_record; - char *name; - name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; if (obvalue == NULL) { diff --git a/win32/src/win32crypt/PyCERT_CONTEXT.cpp b/win32/src/win32crypt/PyCERT_CONTEXT.cpp index 528952076c..3e5cccf4eb 100644 --- a/win32/src/win32crypt/PyCERT_CONTEXT.cpp +++ b/win32/src/win32crypt/PyCERT_CONTEXT.cpp @@ -141,7 +141,7 @@ PyObject *PyWinObject_FromCERT_EXTENSIONArray(PCERT_EXTENSION pce, DWORD ext_cnt PyObject *PyCERT_CONTEXT::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PCCERT_CONTEXT pcc = ((PyCERT_CONTEXT *)self)->GetPCCERT_CONTEXT(); diff --git a/win32/src/win32crypt/PyCRYPTKEY.cpp b/win32/src/win32crypt/PyCRYPTKEY.cpp index a13a72cee9..029a16ab8f 100644 --- a/win32/src/win32crypt/PyCRYPTKEY.cpp +++ b/win32/src/win32crypt/PyCRYPTKEY.cpp @@ -62,7 +62,7 @@ int PyCRYPTKEY::setattro(PyObject *self, PyObject *obname, PyObject *v) PyObject *PyCRYPTKEY::getattro(PyObject *self, PyObject *obname) { /* - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return NULL; if (strcmp(name,"HCRYPTKEY")==0){ diff --git a/win32/src/win32crypt/PyCRYPTMSG.cpp b/win32/src/win32crypt/PyCRYPTMSG.cpp index b19a05953f..c3377be205 100644 --- a/win32/src/win32crypt/PyCRYPTMSG.cpp +++ b/win32/src/win32crypt/PyCRYPTMSG.cpp @@ -50,7 +50,7 @@ int PyCRYPTMSG::setattro(PyObject *self, PyObject *obname, PyObject *v) PyObject *PyCRYPTMSG::getattro(PyObject *self, PyObject *obname) { /* - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return NULL; if (strcmp(name,"HCRYPTMSG")==0){ diff --git a/win32/src/win32file_comm.cpp b/win32/src/win32file_comm.cpp index bcd2d3667f..60d13f254d 100644 --- a/win32/src/win32file_comm.cpp +++ b/win32/src/win32file_comm.cpp @@ -171,7 +171,7 @@ PyDCB::~PyDCB(void) {} PyObject *PyDCB::getattro(PyObject *self, PyObject *obname) { PyDCB *pydcb = (PyDCB *)self; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (!name) return NULL; @@ -212,7 +212,7 @@ int PyDCB::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete DCB attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (!name) return -1; SET_BITFIELD_ENTRY(fBinary) @@ -373,7 +373,7 @@ PyCOMSTAT::~PyCOMSTAT(void) {} PyObject *PyCOMSTAT::getattro(PyObject *self, PyObject *obname) { PyCOMSTAT *pyCOMSTAT = (PyCOMSTAT *)self; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (!name) return NULL; if (0) // boot up our macro magic (the macro starts with an 'else') @@ -408,7 +408,7 @@ int PyCOMSTAT::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete COMSTAT attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (!name) return -1; SET_BITFIELD_ENTRY(fCtsHold) diff --git a/win32/src/win32gui.i b/win32/src/win32gui.i index 885ed0281e..6223c0ed16 100644 --- a/win32/src/win32gui.i +++ b/win32/src/win32gui.i @@ -921,7 +921,7 @@ PyWNDCLASS::~PyWNDCLASS(void) PyObject *PyWNDCLASS::getattro(PyObject *self, PyObject *obname) { - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return NULL; PyWNDCLASS *pW = (PyWNDCLASS *)self; @@ -976,7 +976,7 @@ int PyWNDCLASS::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete WNDCLASS attributes"); return -1; } - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return -1; PyWNDCLASS *pW = (PyWNDCLASS *)self; @@ -1128,7 +1128,7 @@ PyBITMAP::~PyBITMAP(void) PyObject *PyBITMAP::getattro(PyObject *self, PyObject *obname) { - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return NULL; PyBITMAP *pB = (PyBITMAP *)self; @@ -1144,7 +1144,7 @@ int PyBITMAP::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete BITMAP attributes"); return -1; } - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return -1; if (strcmp("bmBits", name)==0) { @@ -1268,7 +1268,7 @@ PyLOGFONT::~PyLOGFONT(void) PyObject *PyLOGFONT::getattro(PyObject *self, PyObject *obname) { - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return NULL; PyLOGFONT *pL = (PyLOGFONT *)self; @@ -1284,7 +1284,7 @@ int PyLOGFONT::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete LOGFONT attributes"); return -1; } - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name==NULL) return -1; if (strcmp("lfFaceName", name)==0) { diff --git a/win32/src/win32helpmodule.cpp b/win32/src/win32helpmodule.cpp index ce473efd40..778d8031e0 100644 --- a/win32/src/win32helpmodule.cpp +++ b/win32/src/win32helpmodule.cpp @@ -267,7 +267,7 @@ PyHH_AKLINK::~PyHH_AKLINK(void) int PyHH_AKLINK::setattro(PyObject *self, PyObject *obname, PyObject *v) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; PyHH_AKLINK *pO = (PyHH_AKLINK *)self; @@ -505,7 +505,7 @@ PyHH_FTS_QUERY::~PyHH_FTS_QUERY(void) { Py_XDECREF(m_pszSearchQuery); } PyObject *PyHH_FTS_QUERY::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyHH_FTS_QUERY *pO = (PyHH_FTS_QUERY *)self; @@ -525,7 +525,7 @@ int PyHH_FTS_QUERY::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete HH_FTS_QUERY attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; @@ -771,7 +771,7 @@ PyHH_POPUP::~PyHH_POPUP(void) PyObject *PyHH_POPUP::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; @@ -807,7 +807,7 @@ int PyHH_POPUP::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete HH_POPUP attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; @@ -1197,7 +1197,7 @@ PyHH_WINTYPE::~PyHH_WINTYPE(void) PyObject *PyHH_WINTYPE::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyHH_WINTYPE *pO = (PyHH_WINTYPE *)self; @@ -1247,7 +1247,7 @@ int PyHH_WINTYPE::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete HH_WINTYPE attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; PyHH_WINTYPE *pO = (PyHH_WINTYPE *)self; @@ -1696,7 +1696,7 @@ PyHHN_NOTIFY::~PyHHN_NOTIFY(void) PyObject *PyHHN_NOTIFY::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyHHN_NOTIFY *pO = (PyHHN_NOTIFY *)self; @@ -1721,7 +1721,7 @@ int PyHHN_NOTIFY::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete HHN_NOTIFY attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; @@ -1939,7 +1939,7 @@ PyHHNTRACK::~PyHHNTRACK(void) PyObject *PyHHNTRACK::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; @@ -1969,7 +1969,7 @@ int PyHHNTRACK::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete HHNTRACK attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; PyHHNTRACK *pO = (PyHHNTRACK *)self; diff --git a/win32/src/win32process.i b/win32/src/win32process.i index 6aad927aed..c76a8c00bb 100644 --- a/win32/src/win32process.i +++ b/win32/src/win32process.i @@ -198,7 +198,7 @@ PyObject *gethandle(PyObject *obHandle, HANDLE h) PyObject *PySTARTUPINFO::getattro(PyObject *self, PyObject *obname) { PySTARTUPINFO *pO = (PySTARTUPINFO *)self; - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; // @prop integer/|hStdInput| @@ -242,7 +242,7 @@ int PySTARTUPINFO::setattro(PyObject *self, PyObject *obname, PyObject *v) return -1; } PySTARTUPINFO *pO = (PySTARTUPINFO *)self; - char *name=PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; if (strcmp("hStdInput", name)==0) diff --git a/win32/src/win32rasmodule.cpp b/win32/src/win32rasmodule.cpp index 2213d20db6..486cbb9a58 100644 --- a/win32/src/win32rasmodule.cpp +++ b/win32/src/win32rasmodule.cpp @@ -158,7 +158,7 @@ PyRASEAPUSERIDENTITY::~PyRASEAPUSERIDENTITY() PyObject *PyRASEAPUSERIDENTITY::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyRASEAPUSERIDENTITY *py = (PyRASEAPUSERIDENTITY *)self; @@ -268,7 +268,7 @@ PyRASDIALEXTENSIONS::~PyRASDIALEXTENSIONS() { Py_DECREF(m_pyeap); } PyObject *PyRASDIALEXTENSIONS::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyRASDIALEXTENSIONS *py = (PyRASDIALEXTENSIONS *)self; @@ -298,7 +298,7 @@ int PyRASDIALEXTENSIONS::setattro(PyObject *self, PyObject *obname, PyObject *va PyErr_SetString(PyExc_AttributeError, "can't delete OVERLAPPED attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; PyRASDIALEXTENSIONS *py = (PyRASDIALEXTENSIONS *)self; diff --git a/win32/src/win32security_sspi.cpp b/win32/src/win32security_sspi.cpp index 32960b4299..70885dd33a 100644 --- a/win32/src/win32security_sspi.cpp +++ b/win32/src/win32security_sspi.cpp @@ -407,7 +407,7 @@ PSecBuffer PySecBuffer::GetSecBuffer(void) { return &secbuffer; } PyObject *PySecBuffer::getattro(PyObject *self, PyObject *obname) { PSecBuffer psecbuffer = ((PySecBuffer *)self)->GetSecBuffer(); - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; if (strcmp(name, "Buffer") == 0) @@ -418,8 +418,7 @@ PyObject *PySecBuffer::getattro(PyObject *self, PyObject *obname) int PySecBuffer::setattro(PyObject *self, PyObject *obname, PyObject *obvalue) { PySecBuffer *This = (PySecBuffer *)self; - char *name; - name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return -1; if (strcmp(name, "Buffer") == 0) { diff --git a/win32/src/win32wnet/PyNCB.cpp b/win32/src/win32wnet/PyNCB.cpp index e2290be5d1..262e2ec7c6 100644 --- a/win32/src/win32wnet/PyNCB.cpp +++ b/win32/src/win32wnet/PyNCB.cpp @@ -190,7 +190,7 @@ void PyNCB::deallocFunc(PyObject *ob) { delete (PyNCB *)ob; }; PyObject *PyNCB::getattro(PyObject *self, PyObject *obname) { PyNCB *This = (PyNCB *)self; - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; // Our string attributes still need special handling as the NCB isn't @@ -231,7 +231,7 @@ int PyNCB::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete NCB attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyNCB *This = (PyNCB *)self; diff --git a/win32/src/win32wnet/PyNetresource.cpp b/win32/src/win32wnet/PyNetresource.cpp index 9d928b326e..ed8e95dc47 100644 --- a/win32/src/win32wnet/PyNetresource.cpp +++ b/win32/src/win32wnet/PyNetresource.cpp @@ -154,7 +154,7 @@ PyNETRESOURCE::~PyNETRESOURCE(void) PyObject *PyNETRESOURCE::getattro(PyObject *self, PyObject *obname) { - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyNETRESOURCE *This = (PyNETRESOURCE *)self; @@ -176,7 +176,7 @@ int PyNETRESOURCE::setattro(PyObject *self, PyObject *obname, PyObject *v) PyErr_SetString(PyExc_AttributeError, "can't delete NETRESOURCE attributes"); return -1; } - char *name = PYWIN_ATTR_CONVERT(obname); + const char *name = PyUnicode_AsUTF8(obname); if (name == NULL) return NULL; PyNETRESOURCE *This = (PyNETRESOURCE *)self;