Skip to content
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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])
* Fixed `axdebug` build on Python 3.11+ using CPython's new opaque frame APIs, fixed 64-bit overflow in sourceContext and stack addresses, fixed incorrect step-over and step-out behavior, and fixed `ListEnumeratorGateway.Next()` returning lazy `map` iterator incompatible with C++ COM gateways that require a sequence (mhammond#2723, mhammond#2724, mhammond#2725, [@wxinix-2022][wxinix-2022])
* Removed more leftover obsolete `UNICODE` constants since dropping Python 2 support in `win32ui`, `win32gui` and `win32clipboard` (mhammond#2717, [@Avasam][Avasam])
* Implement COM Records as `[out]` method parameters (mhammond#2708, [@geppi][geppi], [@the-snork][the-snork])
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 @@ -599,7 +599,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 @@ -154,7 +154,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
2 changes: 1 addition & 1 deletion pythonwin/win32cmdui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,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 win32/src/PyOVERLAPPED.cpp
Original file line number Diff line number Diff line change
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 @@ -155,7 +155,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
2 changes: 1 addition & 1 deletion win32/src/win32api_cputopo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ PyObject *PySYSTEM_CPU_SET_INFORMATION::tp_str(PyObject *self)
PyObject *PySYSTEM_CPU_SET_INFORMATION::getattro(PyObject *self, PyObject *obname)
{
PySYSTEM_CPU_SET_INFORMATION *psystem_cpu_set_info = (PySYSTEM_CPU_SET_INFORMATION *)self;
char *name = PYWIN_ATTR_CONVERT(obname);
const char *name = PyUnicode_AsUTF8(obname);
if (name == NULL)
return NULL;

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 @@ -115,7 +115,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 @@ -152,7 +152,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 @@ -439,7 +439,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 @@ -487,8 +487,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 @@ -848,7 +848,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 @@ -903,7 +903,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 @@ -1055,7 +1055,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 @@ -1071,7 +1071,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 @@ -1195,7 +1195,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 @@ -1211,7 +1211,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
Loading