Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------------------

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/win32cmdui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/win32dlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions Pythonwin/win32toolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/win32util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions com/win32com/src/PyIBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/src/PyRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/src/extensions/PySTGMEDIUM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion com/win32com/src/include/PythonCOM.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/adsi/src/PyADSIUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/adsi/src/PyIADs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions com/win32comext/directsound/src/PyDSBUFFERDESC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/directsound/src/PyDSCBUFFERDESC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions win32/src/PyOVERLAPPED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ReadFileor 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.
Expand All @@ -123,7 +123,7 @@ PYWINTYPES_EXPORT PyTypeObject PyOVERLAPPEDType = {
{"hEvent", T_OBJECT, OFF(obDummy)}, // @prop <o PyHANDLE>|hEvent|Identifies an event set to the signaled state when
// the transfer has been completed. The calling process sets this member before
// calling the <om win32file.ReadFile>, <om win32file.WriteFile>, <om
// win32pipe.ConnectNamedPipe>, or <om win32pipe.TransactNamedPipe>function.
// win32pipe.ConnectNamedPipe>, or <om win32pipe.TransactNamedPipe> function.
{"Internal", T_OBJECT,
OFF(obDummy)}, // @prop integer|Internal|Reserved for operating system use. (pointer-sized value)
{"InternalHigh", T_OBJECT,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion win32/src/PySECURITY_ATTRIBUTES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 0 additions & 7 deletions win32/src/PyWinTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions win32/src/win32api_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
5 changes: 2 additions & 3 deletions win32/src/win32consolemodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion win32/src/win32crypt/PyCERT_CONTEXT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion win32/src/win32crypt/PyCRYPTKEY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion win32/src/win32crypt/PyCRYPTMSG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
8 changes: 4 additions & 4 deletions win32/src/win32file_comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions win32/src/win32gui.i
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Loading