Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f6ffb4b2
Kaydet (Commit)
f6ffb4b2
authored
Ock 20, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
document that a new Python thread context is created in ctypes callbacks (closes #6627)
Patch by Nikolaus Rath.
üst
e83ed432
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
ctypes.rst
Doc/library/ctypes.rst
+7
-1
No files found.
Doc/library/ctypes.rst
Dosyayı görüntüle @
f6ffb4b2
...
@@ -1022,12 +1022,18 @@ As we can easily check, our array is sorted now::
...
@@ -1022,12 +1022,18 @@ As we can easily check, our array is sorted now::
1 5 7 33 99
1 5 7 33 99
>>>
>>>
**Important note for callback functions:**
**Important note
s
for callback functions:**
Make sure you keep references to :func:`CFUNCTYPE` objects as long as they are
Make sure you keep references to :func:`CFUNCTYPE` objects as long as they are
used from C code. :mod:`ctypes` doesn't, and if you don't, they may be garbage
used from C code. :mod:`ctypes` doesn't, and if you don't, they may be garbage
collected, crashing your program when a callback is made.
collected, crashing your program when a callback is made.
Also, note that if the callback function is called in a thread created outside
of Python's control (e.g. by the foreign code that calls the callback), ctypes
creates a new dummy Python thread on every invocation. This behavior is correct
for most purposes, but it means that values stored with `threading.local` will
*not* survive across different callbacks, even when those calls are made from
the same C thread.
.. _ctypes-accessing-values-exported-from-dlls:
.. _ctypes-accessing-values-exported-from-dlls:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment