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
1972d162
Kaydet (Commit)
1972d162
authored
Mar 27, 2009
tarafından
Guilherme Polo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adjusted _tkinter to compile without warnings when WITH_THREAD is not
defined (part of issue #5035)
üst
7fa9459b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
NEWS
Misc/NEWS
+3
-0
_tkinter.c
Modules/_tkinter.c
+28
-5
No files found.
Misc/NEWS
Dosyayı görüntüle @
1972d162
...
@@ -197,6 +197,9 @@ Core and Builtins
...
@@ -197,6 +197,9 @@ Core and Builtins
Library
Library
-------
-------
- Adjusted _tkinter to compile without warnings when WITH_THREAD is not
defined (part of issue #5035).
- Issue #5561: Removed the sys.version_info shortcuts from platform's
- Issue #5561: Removed the sys.version_info shortcuts from platform's
python_version() and python_version_tuple() since they produced different
python_version() and python_version_tuple() since they produced different
output compared to previous Python versions.
output compared to previous Python versions.
...
...
Modules/_tkinter.c
Dosyayı görüntüle @
1972d162
...
@@ -734,6 +734,7 @@ Tkapp_New(char *screenName, char *baseName, char *className,
...
@@ -734,6 +734,7 @@ Tkapp_New(char *screenName, char *baseName, char *className,
}
}
#ifdef WITH_THREAD
static
void
static
void
Tkapp_ThreadSend
(
TkappObject
*
self
,
Tcl_Event
*
ev
,
Tkapp_ThreadSend
(
TkappObject
*
self
,
Tcl_Event
*
ev
,
Tcl_Condition
*
cond
,
Tcl_Mutex
*
mutex
)
Tcl_Condition
*
cond
,
Tcl_Mutex
*
mutex
)
...
@@ -746,6 +747,7 @@ Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev,
...
@@ -746,6 +747,7 @@ Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev,
Tcl_MutexUnlock
(
mutex
);
Tcl_MutexUnlock
(
mutex
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
}
}
#endif
/** Tcl Eval **/
/** Tcl Eval **/
...
@@ -1135,8 +1137,8 @@ FromObj(PyObject* tkapp, Tcl_Obj *value)
...
@@ -1135,8 +1137,8 @@ FromObj(PyObject* tkapp, Tcl_Obj *value)
return
newPyTclObject
(
value
);
return
newPyTclObject
(
value
);
}
}
#ifdef WITH_THREAD
/* This mutex synchronizes inter-thread command calls. */
/* This mutex synchronizes inter-thread command calls. */
TCL_DECLARE_MUTEX
(
call_mutex
)
TCL_DECLARE_MUTEX
(
call_mutex
)
typedef
struct
Tkapp_CallEvent
{
typedef
struct
Tkapp_CallEvent
{
...
@@ -1148,6 +1150,7 @@ typedef struct Tkapp_CallEvent {
...
@@ -1148,6 +1150,7 @@ typedef struct Tkapp_CallEvent {
PyObject
**
exc_type
,
**
exc_value
,
**
exc_tb
;
PyObject
**
exc_type
,
**
exc_value
,
**
exc_tb
;
Tcl_Condition
*
done
;
Tcl_Condition
*
done
;
}
Tkapp_CallEvent
;
}
Tkapp_CallEvent
;
#endif
void
void
Tkapp_CallDeallocArgs
(
Tcl_Obj
**
objv
,
Tcl_Obj
**
objStore
,
int
objc
)
Tkapp_CallDeallocArgs
(
Tcl_Obj
**
objv
,
Tcl_Obj
**
objStore
,
int
objc
)
...
@@ -1258,6 +1261,8 @@ Tkapp_CallResult(TkappObject *self)
...
@@ -1258,6 +1261,8 @@ Tkapp_CallResult(TkappObject *self)
return
res
;
return
res
;
}
}
#ifdef WITH_THREAD
/* Tkapp_CallProc is the event procedure that is executed in the context of
/* Tkapp_CallProc is the event procedure that is executed in the context of
the Tcl interpreter thread. Initially, it holds the Tcl lock, and doesn't
the Tcl interpreter thread. Initially, it holds the Tcl lock, and doesn't
hold the Python lock. */
hold the Python lock. */
...
@@ -1302,6 +1307,8 @@ done:
...
@@ -1302,6 +1307,8 @@ done:
return
1
;
return
1
;
}
}
#endif
/* This is the main entry point for calling a Tcl command.
/* This is the main entry point for calling a Tcl command.
It supports three cases, with regard to threading:
It supports three cases, with regard to threading:
1. Tcl is not threaded: Must have the Tcl lock, then can invoke command in
1. Tcl is not threaded: Must have the Tcl lock, then can invoke command in
...
@@ -1531,9 +1538,11 @@ Tkapp_AddErrorInfo(PyObject *self, PyObject *args)
...
@@ -1531,9 +1538,11 @@ Tkapp_AddErrorInfo(PyObject *self, PyObject *args)
/** Tcl Variable **/
/** Tcl Variable **/
typedef
PyObject
*
(
*
EventFunc
)(
PyObject
*
,
PyObject
*
args
,
int
flags
);
#ifdef WITH_THREAD
TCL_DECLARE_MUTEX
(
var_mutex
)
TCL_DECLARE_MUTEX
(
var_mutex
)
typedef
PyObject
*
(
*
EventFunc
)(
PyObject
*
,
PyObject
*
args
,
int
flags
);
typedef
struct
VarEvent
{
typedef
struct
VarEvent
{
Tcl_Event
ev
;
/* must be first */
Tcl_Event
ev
;
/* must be first */
PyObject
*
self
;
PyObject
*
self
;
...
@@ -1545,6 +1554,7 @@ typedef struct VarEvent {
...
@@ -1545,6 +1554,7 @@ typedef struct VarEvent {
PyObject
**
exc_val
;
PyObject
**
exc_val
;
Tcl_Condition
*
cond
;
Tcl_Condition
*
cond
;
}
VarEvent
;
}
VarEvent
;
#endif
static
int
static
int
varname_converter
(
PyObject
*
in
,
void
*
_out
)
varname_converter
(
PyObject
*
in
,
void
*
_out
)
...
@@ -1562,6 +1572,8 @@ varname_converter(PyObject *in, void *_out)
...
@@ -1562,6 +1572,8 @@ varname_converter(PyObject *in, void *_out)
return
0
;
return
0
;
}
}
#ifdef WITH_THREAD
static
void
static
void
var_perform
(
VarEvent
*
ev
)
var_perform
(
VarEvent
*
ev
)
{
{
...
@@ -1589,11 +1601,13 @@ var_proc(VarEvent* ev, int flags)
...
@@ -1589,11 +1601,13 @@ var_proc(VarEvent* ev, int flags)
return
1
;
return
1
;
}
}
#endif
static
PyObject
*
static
PyObject
*
var_invoke
(
EventFunc
func
,
PyObject
*
selfptr
,
PyObject
*
args
,
int
flags
)
var_invoke
(
EventFunc
func
,
PyObject
*
selfptr
,
PyObject
*
args
,
int
flags
)
{
{
TkappObject
*
self
=
(
TkappObject
*
)
selfptr
;
#ifdef WITH_THREAD
#ifdef WITH_THREAD
TkappObject
*
self
=
(
TkappObject
*
)
selfptr
;
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
())
{
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
())
{
TkappObject
*
self
=
(
TkappObject
*
)
selfptr
;
TkappObject
*
self
=
(
TkappObject
*
)
selfptr
;
VarEvent
*
ev
;
VarEvent
*
ev
;
...
@@ -2096,6 +2110,7 @@ PythonCmdDelete(ClientData clientData)
...
@@ -2096,6 +2110,7 @@ PythonCmdDelete(ClientData clientData)
#ifdef WITH_THREAD
TCL_DECLARE_MUTEX
(
command_mutex
)
TCL_DECLARE_MUTEX
(
command_mutex
)
typedef
struct
CommandEvent
{
typedef
struct
CommandEvent
{
...
@@ -2122,6 +2137,7 @@ Tkapp_CommandProc(CommandEvent *ev, int flags)
...
@@ -2122,6 +2137,7 @@ Tkapp_CommandProc(CommandEvent *ev, int flags)
Tcl_MutexUnlock
(
&
command_mutex
);
Tcl_MutexUnlock
(
&
command_mutex
);
return
1
;
return
1
;
}
}
#endif
static
PyObject
*
static
PyObject
*
Tkapp_CreateCommand
(
PyObject
*
selfptr
,
PyObject
*
args
)
Tkapp_CreateCommand
(
PyObject
*
selfptr
,
PyObject
*
args
)
...
@@ -2153,6 +2169,7 @@ Tkapp_CreateCommand(PyObject *selfptr, PyObject *args)
...
@@ -2153,6 +2169,7 @@ Tkapp_CreateCommand(PyObject *selfptr, PyObject *args)
data
->
self
=
selfptr
;
data
->
self
=
selfptr
;
data
->
func
=
func
;
data
->
func
=
func
;
#ifdef WITH_THREAD
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
())
{
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
())
{
Tcl_Condition
cond
=
NULL
;
Tcl_Condition
cond
=
NULL
;
CommandEvent
*
ev
=
(
CommandEvent
*
)
ckalloc
(
sizeof
(
CommandEvent
));
CommandEvent
*
ev
=
(
CommandEvent
*
)
ckalloc
(
sizeof
(
CommandEvent
));
...
@@ -2166,7 +2183,9 @@ Tkapp_CreateCommand(PyObject *selfptr, PyObject *args)
...
@@ -2166,7 +2183,9 @@ Tkapp_CreateCommand(PyObject *selfptr, PyObject *args)
Tkapp_ThreadSend
(
self
,
(
Tcl_Event
*
)
ev
,
&
cond
,
&
command_mutex
);
Tkapp_ThreadSend
(
self
,
(
Tcl_Event
*
)
ev
,
&
cond
,
&
command_mutex
);
Tcl_ConditionFinalize
(
&
cond
);
Tcl_ConditionFinalize
(
&
cond
);
}
}
else
{
else
#endif
{
ENTER_TCL
ENTER_TCL
err
=
Tcl_CreateCommand
(
err
=
Tcl_CreateCommand
(
Tkapp_Interp
(
self
),
cmdName
,
PythonCmd
,
Tkapp_Interp
(
self
),
cmdName
,
PythonCmd
,
...
@@ -2194,6 +2213,8 @@ Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args)
...
@@ -2194,6 +2213,8 @@ Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"s:deletecommand"
,
&
cmdName
))
if
(
!
PyArg_ParseTuple
(
args
,
"s:deletecommand"
,
&
cmdName
))
return
NULL
;
return
NULL
;
#ifdef WITH_THREAD
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
())
{
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
())
{
Tcl_Condition
cond
=
NULL
;
Tcl_Condition
cond
=
NULL
;
CommandEvent
*
ev
;
CommandEvent
*
ev
;
...
@@ -2208,7 +2229,9 @@ Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args)
...
@@ -2208,7 +2229,9 @@ Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args)
&
command_mutex
);
&
command_mutex
);
Tcl_ConditionFinalize
(
&
cond
);
Tcl_ConditionFinalize
(
&
cond
);
}
}
else
{
else
#endif
{
ENTER_TCL
ENTER_TCL
err
=
Tcl_DeleteCommand
(
self
->
interp
,
cmdName
);
err
=
Tcl_DeleteCommand
(
self
->
interp
,
cmdName
);
LEAVE_TCL
LEAVE_TCL
...
...
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