Skip to content

Commit

Permalink
Deprecate Netscape workarounds and remove broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Jun 4, 2024
1 parent 457bda8 commit d9cfb9a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 37 deletions.
3 changes: 2 additions & 1 deletion Pythonwin/ddeconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ PyObject *PyDDEConv_Poke(PyObject *self, PyObject *args)
return NULL;
TCHAR *szCmd;
PyObject *obCmd;
// TODO: How would this code look like w/o consideration for Netscape ?
void *pData = NULL; // may be empty, as for Netscape's use of Poke
Py_ssize_t size = 0;
if (!PyArg_ParseTuple(args, "O|z#:Poke", &obCmd, &pData, &size))
return NULL;
if (!PyWinObject_AsTCHAR(obCmd, &szCmd, FALSE))
return NULL;
GUI_BGN_SAVE;
BOOL ok = pConv->Poke(szCmd, pData, size);
BOOL ok = pConv->Poke(CF_TEXT, szCmd, pData, size);
GUI_END_SAVE;
PyWinObject_FreeTCHAR(szCmd);
if (!ok)
Expand Down
9 changes: 5 additions & 4 deletions Pythonwin/ddemodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@
the internal list. Instead, the item must be evaluated by the
Python server class.
Reason: Netscape makes heavy usage of string items and does not use
them in a fixed manner. Instead, the items are (ab)used as the
Reason: Netscape made heavy usage of string items and did not use
them in a fixed manner. Instead, the items were (ab)used as the
parameter list in DDE_Poke and DDE_Request.
TODO: Netscape is long dead, so we could clean this up
Server issues (Server):
-----------------------
Poke and Request are now exposed to the Python server interface.
Poke - does not require a result
- has an optional value parameter (not used by Netscape)
- has an optional value parameter (wasn't used by Netscape)
Request - should return a string object
Client issues (Conversation):
-----------------------------
Poke and Request are now available.
Poke (item, value=None)
- sends a Poke to it's conversation's server
- has an optional value parameter (not used by Netscape)
- has an optional value parameter (wasn't used by Netscape)
- does not return anything
Request (item)
- sends a request to it's conversation's server
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <H2>Introduction </H2>
<a href="doc/debugger/index.html">integrated debugger</a>, and a rich Python
editing environment. </P>
<P>Pythonwin is implemented as a 'wrapper' for the Microsoft Foundation Class library. With it, you can use MFC in an interactive, interpreted environment, or write full blown stand-alone applications tightly coupled with the Windows environment. Over 30 MFC objects are exposed, including Common Controls, Property Pages/Sheets, Control/Toolbars, Threads, etc. </P>
<P>Pythonwin could almost be considered a sample program for the MFC UI environment. This Python UI environment can be embedded in almost any other application - such as OLE clients/servers, Netscape plugins, as a Macro language etc. </P>
<P>Pythonwin could almost be considered a sample program for the MFC UI environment. This Python UI environment can be embedded in almost any other application - such as OLE clients/servers, as a Macro language etc. </P>
<P><A HREF="#RecentChanges">Recent changes can be found at the end of this document</A>.</P>
<H2>Demos</H2>
<P>There are many demos in the pywin\demos directory. To see a list of all the demos, run the program "pywin\demos\guidemo.py" from inside Pythonwin.</P>
Expand Down
46 changes: 39 additions & 7 deletions Pythonwin/stddde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,28 @@ void CDDEItem::Create(const TCHAR *pszName) { m_strName = pszName; }
BOOL CDDEItem::Request(UINT wFmt, CDDEAllocator &allocr) { return FALSE; }

// CT BEGIN
BOOL CDDEItem::NSRequest(const TCHAR *szItem, CDDEAllocator &allocr) { return FALSE; }
BOOL CDDEItem::NSRequest(const TCHAR *szItem, CDDEAllocator &allocr)
{
PyErr_Warn(PyExc_DeprecationWarning, "NSRequest is deprecated as Netscape is no longer supported");
return FALSE;
}
// CT END

BOOL CDDEItem::Poke(UINT wFmt, void *pData, DWORD dwSize) { return FALSE; }

// CT BEGIN
BOOL CDDEItem::Poke(void *pData, DWORD dwSize) { return FALSE; }
BOOL CDDEItem::Poke(void *pData, DWORD dwSize)
{
PyErr_Warn(PyExc_DeprecationWarning,
"format-less version of Poke is deprecated as Netscape is no longer supported");
return FALSE;
}

BOOL CDDEItem::NSPoke(const TCHAR *szItem, void *pData, DWORD dwSize) { return FALSE; }
BOOL CDDEItem::NSPoke(const TCHAR *szItem, void *pData, DWORD dwSize)
{
PyErr_Warn(PyExc_DeprecationWarning, "NSPoke is deprecated as Netscape is no longer supported");
return FALSE;
}
// CT END

BOOL CDDEItem::IsSupportedFormat(WORD wFormat)
Expand Down Expand Up @@ -276,7 +289,11 @@ BOOL CDDETopic::Request(UINT wFmt, const TCHAR *pszItem, CDDEAllocator &allocr)
}

// CT BEGIN
BOOL CDDETopic::NSRequest(const TCHAR *szItem, CDDEAllocator &allocr) { return FALSE; }
BOOL CDDETopic::NSRequest(const TCHAR *szItem, CDDEAllocator &allocr)
{
PyErr_Warn(PyExc_DeprecationWarning, "NSRequest is deprecated as Netscape is no longer supported");
return FALSE;
}
// CT END

BOOL CDDETopic::Poke(UINT wFmt, const TCHAR *pszItem, void *pData, DWORD dwSize)
Expand All @@ -300,9 +317,18 @@ BOOL CDDETopic::Poke(UINT wFmt, const TCHAR *pszItem, void *pData, DWORD dwSize)

// CT BEGIN

BOOL CDDETopic::Poke(const TCHAR *pszItem, void *pData, DWORD dwSize) { return Poke(CF_TEXT, pszItem, pData, dwSize); }
BOOL CDDETopic::Poke(const TCHAR *pszItem, void *pData, DWORD dwSize)
{
PyErr_Warn(PyExc_DeprecationWarning,
"format-less version of Poke is deprecated as Netscape is no longer supported");
return Poke(CF_TEXT, pszItem, pData, dwSize);
}

BOOL CDDETopic::NSPoke(const TCHAR *szItem, void *pData, DWORD dwSize) { return FALSE; }
BOOL CDDETopic::NSPoke(const TCHAR *szItem, void *pData, DWORD dwSize)
{
PyErr_Warn(PyExc_DeprecationWarning, "NSPoke is deprecated as Netscape is no longer supported");
return FALSE;
}
// CT END

BOOL CDDETopic::Exec(void *pData, DWORD dwSize) { return FALSE; }
Expand All @@ -314,11 +340,14 @@ CDDEItem *CDDETopic::FindItem(const TCHAR *pszItem)
CDDEItem *pItem = m_ItemList.GetNext(pos);
// CT BEGIN
// NETSCAPE Hack
// Netscape is long dead, so this is deprecated
if (pItem->m_strName == "") {
PyErr_Warn(PyExc_DeprecationWarning,
"Having an empty name is deprecated and was allowed for Netscape support");
return pItem;
}
// empty item matches all
// CT END
// empty item matches all
if (pItem->m_strName.CompareNoCase(pszItem) == 0)
return pItem;
}
Expand Down Expand Up @@ -545,7 +574,10 @@ BOOL CDDEConv::Poke(const TCHAR *pszItem, void *pData, DWORD dwSize)
{
//
// format-less version for Netscape defaults to text
// Netscape is long dead, so this is deprecated
//
PyErr_Warn(PyExc_DeprecationWarning,
"format-less version of Poke is deprecated as Netscape is no longer supported");
return Poke(CF_TEXT, pszItem, pData, dwSize);
}
// CT END
Expand Down
24 changes: 0 additions & 24 deletions com/win32com/test/testNetscape.py

This file was deleted.

0 comments on commit d9cfb9a

Please sign in to comment.