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
bde08132
Kaydet (Commit)
bde08132
authored
Haz 29, 2006
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Protect the thread api calls in the _ctypes extension module within
#ifdef WITH_THREADS/#endif blocks. Found by Sam Rushing.
üst
877fdb01
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
NEWS
Misc/NEWS
+3
-0
_ctypes.c
Modules/_ctypes/_ctypes.c
+2
-0
callbacks.c
Modules/_ctypes/callbacks.c
+14
-1
callproc.c
Modules/_ctypes/callproc.c
+6
-0
No files found.
Misc/NEWS
Dosyayı görüntüle @
bde08132
...
@@ -19,6 +19,9 @@ Core and builtins
...
@@ -19,6 +19,9 @@ Core and builtins
Library
Library
-------
-------
- The '
_ctypes
' extension module now works when Python is configured
with the --without-threads option.
- Bug #1504333: Make sgmllib support angle brackets in quoted
- Bug #1504333: Make sgmllib support angle brackets in quoted
attribute values.
attribute values.
...
...
Modules/_ctypes/_ctypes.c
Dosyayı görüntüle @
bde08132
...
@@ -4555,7 +4555,9 @@ init_ctypes(void)
...
@@ -4555,7 +4555,9 @@ init_ctypes(void)
ob_type is the metatype (the 'type'), defaults to PyType_Type,
ob_type is the metatype (the 'type'), defaults to PyType_Type,
tp_base is the base type, defaults to 'object' aka PyBaseObject_Type.
tp_base is the base type, defaults to 'object' aka PyBaseObject_Type.
*/
*/
#ifdef WITH_THREADS
PyEval_InitThreads
();
PyEval_InitThreads
();
#endif
m
=
Py_InitModule3
(
"_ctypes"
,
module_methods
,
module_docs
);
m
=
Py_InitModule3
(
"_ctypes"
,
module_methods
,
module_docs
);
if
(
!
m
)
if
(
!
m
)
return
;
return
;
...
...
Modules/_ctypes/callbacks.c
Dosyayı görüntüle @
bde08132
...
@@ -127,7 +127,9 @@ static void _CallPythonObject(void *mem,
...
@@ -127,7 +127,9 @@ static void _CallPythonObject(void *mem,
PyObject
*
result
;
PyObject
*
result
;
PyObject
*
arglist
=
NULL
;
PyObject
*
arglist
=
NULL
;
int
nArgs
;
int
nArgs
;
#ifdef WITH_THREADS
PyGILState_STATE
state
=
PyGILState_Ensure
();
PyGILState_STATE
state
=
PyGILState_Ensure
();
#endif
nArgs
=
PySequence_Length
(
converters
);
nArgs
=
PySequence_Length
(
converters
);
/* Hm. What to return in case of error?
/* Hm. What to return in case of error?
...
@@ -235,8 +237,9 @@ if (x == NULL) _AddTraceback(what, __FILE__, __LINE__ - 1), PyErr_Print()
...
@@ -235,8 +237,9 @@ if (x == NULL) _AddTraceback(what, __FILE__, __LINE__ - 1), PyErr_Print()
Py_XDECREF
(
result
);
Py_XDECREF
(
result
);
Done:
Done:
Py_XDECREF
(
arglist
);
Py_XDECREF
(
arglist
);
#ifdef WITH_THREADS
PyGILState_Release
(
state
);
PyGILState_Release
(
state
);
#endif
}
}
static
void
closure_fcn
(
ffi_cif
*
cif
,
static
void
closure_fcn
(
ffi_cif
*
cif
,
...
@@ -397,12 +400,18 @@ STDAPI DllGetClassObject(REFCLSID rclsid,
...
@@ -397,12 +400,18 @@ STDAPI DllGetClassObject(REFCLSID rclsid,
LPVOID
*
ppv
)
LPVOID
*
ppv
)
{
{
long
result
;
long
result
;
#ifdef WITH_THREADS
PyGILState_STATE
state
;
PyGILState_STATE
state
;
#endif
LoadPython
();
LoadPython
();
#ifdef WITH_THREADS
state
=
PyGILState_Ensure
();
state
=
PyGILState_Ensure
();
#endif
result
=
Call_GetClassObject
(
rclsid
,
riid
,
ppv
);
result
=
Call_GetClassObject
(
rclsid
,
riid
,
ppv
);
#ifdef WITH_THREADS
PyGILState_Release
(
state
);
PyGILState_Release
(
state
);
#endif
return
result
;
return
result
;
}
}
...
@@ -454,9 +463,13 @@ long Call_CanUnloadNow(void)
...
@@ -454,9 +463,13 @@ long Call_CanUnloadNow(void)
STDAPI
DllCanUnloadNow
(
void
)
STDAPI
DllCanUnloadNow
(
void
)
{
{
long
result
;
long
result
;
#ifdef WITH_THREADS
PyGILState_STATE
state
=
PyGILState_Ensure
();
PyGILState_STATE
state
=
PyGILState_Ensure
();
#endif
result
=
Call_CanUnloadNow
();
result
=
Call_CanUnloadNow
();
#ifdef WITH_THREADS
PyGILState_Release
(
state
);
PyGILState_Release
(
state
);
#endif
return
result
;
return
result
;
}
}
...
...
Modules/_ctypes/callproc.c
Dosyayı görüntüle @
bde08132
...
@@ -617,7 +617,9 @@ static int _call_function_pointer(int flags,
...
@@ -617,7 +617,9 @@ static int _call_function_pointer(int flags,
void
*
resmem
,
void
*
resmem
,
int
argcount
)
int
argcount
)
{
{
#ifdef WITH_THREADS
PyThreadState
*
_save
=
NULL
;
/* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
PyThreadState
*
_save
=
NULL
;
/* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */
#endif
ffi_cif
cif
;
ffi_cif
cif
;
int
cc
;
int
cc
;
#ifdef MS_WIN32
#ifdef MS_WIN32
...
@@ -649,8 +651,10 @@ static int _call_function_pointer(int flags,
...
@@ -649,8 +651,10 @@ static int _call_function_pointer(int flags,
return
-
1
;
return
-
1
;
}
}
#ifdef WITH_THREADS
if
((
flags
&
FUNCFLAG_PYTHONAPI
)
==
0
)
if
((
flags
&
FUNCFLAG_PYTHONAPI
)
==
0
)
Py_UNBLOCK_THREADS
Py_UNBLOCK_THREADS
#endif
#ifdef MS_WIN32
#ifdef MS_WIN32
#ifndef DONT_USE_SEH
#ifndef DONT_USE_SEH
__try
{
__try
{
...
@@ -667,8 +671,10 @@ static int _call_function_pointer(int flags,
...
@@ -667,8 +671,10 @@ static int _call_function_pointer(int flags,
}
}
#endif
#endif
#endif
#endif
#ifdef WITH_THREADS
if
((
flags
&
FUNCFLAG_PYTHONAPI
)
==
0
)
if
((
flags
&
FUNCFLAG_PYTHONAPI
)
==
0
)
Py_BLOCK_THREADS
Py_BLOCK_THREADS
#endif
#ifdef MS_WIN32
#ifdef MS_WIN32
#ifndef DONT_USE_SEH
#ifndef DONT_USE_SEH
if
(
dwExceptionCode
)
{
if
(
dwExceptionCode
)
{
...
...
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