https://github.com/python/cpython/commit/d0888f98ec2a6f50005d91bd1fbc61769f73454c
commit: d0888f98ec2a6f50005d91bd1fbc61769f73454c
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-10-12T17:35:54Z
summary:

[3.14] gh-52008: Document that `ctypes.CDLL` can only observe `errno` from its 
own C runtime (GH-159239) (GH-159243)

(cherry picked from commit 41a10efc6c7383fc01703d504fd0cee84014431e)

Co-authored-by: Peter Bierma <[email protected]>

files:
M Doc/library/ctypes.rst

diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst
index 5b041b87625b87..fb74e7f3ee3719 100644
--- a/Doc/library/ctypes.rst
+++ b/Doc/library/ctypes.rst
@@ -1626,7 +1626,10 @@ way is to instantiate :py:class:`CDLL` or one of its 
subclasses:
    :mod:`!ctypes` maintains a thread-local copy of the system's :data:`errno`
    variable; if you call foreign functions created with ``use_errno=True`` 
then the
    :data:`errno` value before the function call is swapped with the ctypes 
private
-   copy, the same happens immediately after the function call.
+   copy, the same happens immediately after the function call. This mechanism 
only
+   works for libraries that use the same C runtime library as the interpreter 
itself.
+   A library linked against a different C runtime (for example, a different 
CRT on
+   Windows) has its own :data:`errno`, which :mod:`!ctypes` cannot observe.
 
    The function :func:`ctypes.get_errno` returns the value of the ctypes 
private
    copy, and the function :func:`ctypes.set_errno` changes the ctypes private 
copy

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to