Skip to content

Commit 4b48e5b

Browse files
committed
Replace PYWIN_ATTR_CONVERT with PyUnicode_AsUTF8
1 parent c18be83 commit 4b48e5b

28 files changed

+63
-68
lines changed

Pythonwin/win32cmdui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static struct PyMethodDef PyCCmdUI_methods[] = {
282282

283283
PyObject *PyCCmdUI::getattro(PyObject *obname)
284284
{
285-
char *name = PYWIN_ATTR_CONVERT(obname);
285+
const char *name = PyUnicode_AsUTF8(obname);
286286
if (strcmp(name, "m_nIndex") == 0) { // @prop int|m_nIndex|
287287
CCmdUI *pCU = PyCCmdUI::GetCCmdUIPtr(this);
288288
if (!pCU)

Pythonwin/win32dlg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ PyCDialog::~PyCDialog()
171171

172172
PyObject *PyCDialog::getattro(PyObject *obname)
173173
{
174-
char *name = PYWIN_ATTR_CONVERT(obname);
174+
const char *name = PyUnicode_AsUTF8(obname);
175175
if (strcmp(name, "data") == 0) {
176176
Py_INCREF(dddict);
177177
return dddict;

Pythonwin/win32toolbar.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct MyMemberList dcmembers[] = {
164164

165165
PyObject *PyCDockContext::getattro(PyObject *obname)
166166
{
167-
char *name = PYWIN_ATTR_CONVERT(obname);
167+
const char *name = PyUnicode_AsUTF8(obname);
168168
if (name == NULL)
169169
return NULL;
170170
CDockContext *pC = GetDockContext(this);
@@ -200,7 +200,7 @@ PyObject *PyCDockContext::getattro(PyObject *obname)
200200

201201
int PyCDockContext::setattro(PyObject *obname, PyObject *value)
202202
{
203-
char *name = PYWIN_ATTR_CONVERT(obname);
203+
const char *name = PyUnicode_AsUTF8(obname);
204204
if (name == NULL)
205205
return -1;
206206
CDockContext *pC = GetDockContext(this);
@@ -446,7 +446,7 @@ static struct PyMethodDef PyCControlBar_methods[] = {
446446

447447
PyObject *PyCControlBar::getattro(PyObject *obname)
448448
{
449-
char *name = PYWIN_ATTR_CONVERT(obname);
449+
const char *name = PyUnicode_AsUTF8(obname);
450450
if (name == NULL)
451451
return NULL;
452452
CControlBar *pCtlBar = PyCControlBar::GetControlBar(this);
@@ -477,7 +477,7 @@ PyObject *PyCControlBar::getattro(PyObject *obname)
477477

478478
int PyCControlBar::setattro(PyObject *obname, PyObject *v)
479479
{
480-
char *name = PYWIN_ATTR_CONVERT(obname);
480+
const char *name = PyUnicode_AsUTF8(obname);
481481
if (name == NULL)
482482
return -1;
483483

Pythonwin/win32util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static PySequenceMethods PyCRect_Sequence = {
9292

9393
PyObject *PyCRect::getattro(PyObject *obname)
9494
{
95-
char *name = PYWIN_ATTR_CONVERT(obname);
95+
const char *name = PyUnicode_AsUTF8(obname);
9696
if (name == NULL)
9797
return NULL;
9898
if (strcmp(name, "left") == 0)
@@ -140,7 +140,7 @@ CString PyCRect::repr()
140140

141141
int PyCRect::setattro(PyObject *obname, PyObject *v)
142142
{
143-
char *name = PYWIN_ATTR_CONVERT(obname);
143+
const char *name = PyUnicode_AsUTF8(obname);
144144
if (name == NULL)
145145
return -1;
146146
int intval = PyLong_AsLong(v);

com/win32com/src/PyIBase.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ PyObject *PyIBase::getattr(char *name) { return PyObject_GetAttrString(this, nam
3232

3333
/*static*/ int PyIBase::setattro(PyObject *op, PyObject *obname, PyObject *v)
3434
{
35-
char *name = PYWIN_ATTR_CONVERT(obname);
35+
const char *name = PyUnicode_AsUTF8(obname);
3636
if (name == NULL)
3737
return -1;
3838
PyIBase *bc = (PyIBase *)op;
3939
return bc->setattr(name, v);
4040
}
4141

42-
int PyIBase::setattr(char *name, PyObject *v)
42+
int PyIBase::setattr(const char *name, PyObject *v)
4343
{
4444
char buf[128];
4545
sprintf(buf, "%s has read-only attributes", ob_type->tp_name);

com/win32com/src/PyRecord.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ PyObject *PyRecord::getattro(PyObject *self, PyObject *obname)
590590
PyRecord *pyrec = (PyRecord *)self;
591591
GUID structguid;
592592
OLECHAR *guidString;
593-
char *name = PYWIN_ATTR_CONVERT(obname);
593+
const char *name = PyUnicode_AsUTF8(obname);
594594
if (name == NULL)
595595
return NULL;
596596
if (strcmp(name, "__record_type_guid__") == 0) {

com/win32com/src/extensions/PySTGMEDIUM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void PySTGMEDIUM::Close()
230230

231231
PyObject *PySTGMEDIUM::getattro(PyObject *self, PyObject *obname)
232232
{
233-
char *name = PYWIN_ATTR_CONVERT(obname);
233+
const char *name = PyUnicode_AsUTF8(obname);
234234
if (name == NULL)
235235
return NULL;
236236

com/win32com/src/include/PythonCOM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class PYCOM_EXPORT PyIBase : public PyObject {
168168
public:
169169
// virtuals for Python support
170170
virtual PyObject *getattr(char *name);
171-
virtual int setattr(char *name, PyObject *v);
171+
virtual int setattr(const char *name, PyObject *v);
172172
virtual PyObject *repr();
173173
virtual int compare(PyObject *other)
174174
{

com/win32comext/adsi/src/PyADSIUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class PyADS_ATTR_INFO : public PyObject {
449449

450450
static PyObject *getattro(PyObject *self, PyObject *obname)
451451
{
452-
char *name = PYWIN_ATTR_CONVERT(obname);
452+
const char *name = PyUnicode_AsUTF8(obname);
453453
if (name == NULL)
454454
return NULL;
455455
if (strcmp(name, "__members__") == 0) {

com/win32comext/adsi/src/PyIADs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static struct PyMethodDef PyIADs_methods[] = {
247247

248248
PyObject *PyIADs_getattro(PyObject *ob, PyObject *obname)
249249
{
250-
char *name = PYWIN_ATTR_CONVERT(obname);
250+
const char *name = PyUnicode_AsUTF8(obname);
251251
if (!name)
252252
return NULL;
253253

0 commit comments

Comments
 (0)