FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-127255: Make `CopyComPointer` public and add to `ctypes` doc. by junkmd · Pull Request #127275 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (3) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 18 additions & 0 deletions Doc/library/ctypes.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,24 @@ Utility functions
It behaves similar to ``pointer(obj)``, but the construction is a lot faster.


.. function:: CopyComPointer(src, dst)

Copies a COM pointer from *src* to *dst* and returns the Windows specific
:c:type:`!HRESULT` value.

If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the
reference count.

In contrast, the reference count of *dst* will not be decremented before
assigning the new value. Unless *dst* is ``NULL``, the caller is responsible
for decrementing the reference count by calling its ``Release`` method when
necessary.

.. availability:: Windows

.. versionadded:: next


.. function:: cast(obj, type)

This function is similar to the cast operator in C. It returns a new instance
Expand Down
5 changes: 4 additions & 1 deletion Doc/whatsnew/3.14.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,12 @@ ctypes
to help match a non-default ABI.
(Contributed by Petr Viktorin in :gh:`97702`.)

* The :exc:`~ctypes.COMError` exception is now public.
* On Windows, the :exc:`~ctypes.COMError` exception is now public.
(Contributed by Jun Komoda in :gh:`126686`.)

* On Windows, the :func:`~ctypes.CopyComPointer` function is now public.
(Contributed by Jun Komoda in :gh:`127275`.)

datetime
--------

Expand Down
2 changes: 1 addition & 1 deletion Lib/ctypes/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
raise Exception("Version number mismatch", __version__, _ctypes_version)

if _os.name == "nt":
from _ctypes import COMError, FormatError
from _ctypes import COMError, CopyComPointer, FormatError

DEFAULT_MODE = RTLD_LOCAL
if _os.name == "posix" and _sys.platform == "darwin":
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
raise unittest.SkipTest("Windows-specific test")


from _ctypes import COMError, CopyComPointer
from ctypes import HRESULT
from ctypes import COMError, CopyComPointer, HRESULT


COINIT_APARTMENTTHREADED = 0x2
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The :func:`~ctypes.CopyComPointer` function is now public.
Previously, this was private and only available in ``_ctypes``.

Back | FazBrowse Home | New Git URL