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
5b26abb3
Kaydet (Commit)
5b26abb3
authored
Ara 28, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Gracefully delay runtime error up to 1s. Add .willdispatch().
üst
276a8f3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
+32
-12
pydoc.py
Lib/pydoc.py
+1
-0
_tkinter.c
Modules/_tkinter.c
+31
-12
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
5b26abb3
...
@@ -1919,6 +1919,7 @@ def gui():
...
@@ -1919,6 +1919,7 @@ def gui():
self
.
expanded
=
0
self
.
expanded
=
0
self
.
window
.
wm_geometry
(
'
%
dx
%
d'
%
(
self
.
minwidth
,
self
.
minheight
))
self
.
window
.
wm_geometry
(
'
%
dx
%
d'
%
(
self
.
minwidth
,
self
.
minheight
))
self
.
window
.
wm_minsize
(
self
.
minwidth
,
self
.
minheight
)
self
.
window
.
wm_minsize
(
self
.
minwidth
,
self
.
minheight
)
self
.
window
.
tk
.
willdispatch
()
import
threading
import
threading
threading
.
Thread
(
threading
.
Thread
(
...
...
Modules/_tkinter.c
Dosyayı görüntüle @
5b26abb3
...
@@ -310,6 +310,24 @@ Sleep(int milli)
...
@@ -310,6 +310,24 @@ Sleep(int milli)
#endif
/* MS_WINDOWS */
#endif
/* MS_WINDOWS */
#endif
/* WITH_THREAD */
#endif
/* WITH_THREAD */
/* Wait up to 1s for the mainloop to come up. */
static
int
WaitForMainloop
(
TkappObject
*
self
)
{
int
i
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
if
(
self
->
dispatching
)
return
1
;
Py_BEGIN_ALLOW_THREADS
Sleep
(
100
);
Py_END_ALLOW_THREADS
}
if
(
self
->
dispatching
)
return
1
;
PyErr_SetString
(
PyExc_RuntimeError
,
"main thread is not in main loop"
);
return
0
;
}
static
char
*
static
char
*
...
@@ -1138,11 +1156,8 @@ Tkapp_Call(PyObject *_self, PyObject *args)
...
@@ -1138,11 +1156,8 @@ Tkapp_Call(PyObject *_self, PyObject *args)
marshal the parameters to the interpreter thread. */
marshal the parameters to the interpreter thread. */
Tkapp_CallEvent
*
ev
;
Tkapp_CallEvent
*
ev
;
PyObject
*
exc_type
,
*
exc_value
,
*
exc_tb
;
PyObject
*
exc_type
,
*
exc_value
,
*
exc_tb
;
if
(
!
self
->
dispatching
)
{
if
(
!
WaitForMainloop
(
self
))
PyErr_SetString
(
PyExc_RuntimeError
,
"main thread is not in main loop"
);
return
NULL
;
return
NULL
;
}
ev
=
(
Tkapp_CallEvent
*
)
ckalloc
(
sizeof
(
Tkapp_CallEvent
));
ev
=
(
Tkapp_CallEvent
*
)
ckalloc
(
sizeof
(
Tkapp_CallEvent
));
ev
->
ev
.
proc
=
(
Tcl_EventProc
*
)
Tkapp_CallProc
;
ev
->
ev
.
proc
=
(
Tcl_EventProc
*
)
Tkapp_CallProc
;
ev
->
self
=
self
;
ev
->
self
=
self
;
...
@@ -1427,11 +1442,8 @@ var_invoke(PyObject *_self, char* arg1, char* arg2, char* arg3, int flags,
...
@@ -1427,11 +1442,8 @@ var_invoke(PyObject *_self, char* arg1, char* arg2, char* arg3, int flags,
the call to the interpreter thread, then wait for
the call to the interpreter thread, then wait for
completion. */
completion. */
if
(
!
self
->
dispatching
)
{
if
(
!
WaitForMainloop
(
self
))
PyErr_SetString
(
PyExc_RuntimeError
,
"main thread is not in main loop"
);
return
NULL
;
return
NULL
;
}
ev
->
cond
=
NULL
;
ev
->
cond
=
NULL
;
ev
->
ev
.
proc
=
(
Tcl_EventProc
*
)
var_proc
;
ev
->
ev
.
proc
=
(
Tcl_EventProc
*
)
var_proc
;
Tkapp_ThreadSend
(
self
,
(
Tcl_Event
*
)
ev
,
&
ev
->
cond
,
&
var_mutex
);
Tkapp_ThreadSend
(
self
,
(
Tcl_Event
*
)
ev
,
&
ev
->
cond
,
&
var_mutex
);
...
@@ -1943,11 +1955,8 @@ Tkapp_CreateCommand(PyObject *_self, PyObject *args)
...
@@ -1943,11 +1955,8 @@ Tkapp_CreateCommand(PyObject *_self, PyObject *args)
}
}
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
()
&&
if
(
self
->
threaded
&&
self
->
thread_id
!=
Tcl_GetCurrentThread
()
&&
!
self
->
dispatching
)
{
!
WaitForMainloop
(
self
))
PyErr_SetString
(
PyExc_RuntimeError
,
"main thread is not in main loop"
);
return
NULL
;
return
NULL
;
}
data
=
PyMem_NEW
(
PythonCmd_ClientData
,
1
);
data
=
PyMem_NEW
(
PythonCmd_ClientData
,
1
);
if
(
!
data
)
if
(
!
data
)
...
@@ -2423,12 +2432,22 @@ Tkapp_WantObjects(PyObject *self, PyObject *args)
...
@@ -2423,12 +2432,22 @@ Tkapp_WantObjects(PyObject *self, PyObject *args)
return
Py_None
;
return
Py_None
;
}
}
static
PyObject
*
Tkapp_WillDispatch
(
PyObject
*
self
,
PyObject
*
args
)
{
((
TkappObject
*
)
self
)
->
dispatching
=
1
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
/**** Tkapp Method List ****/
/**** Tkapp Method List ****/
static
PyMethodDef
Tkapp_methods
[]
=
static
PyMethodDef
Tkapp_methods
[]
=
{
{
{
"willdispatch"
,
Tkapp_WillDispatch
,
METH_NOARGS
},
{
"wantobjects"
,
Tkapp_WantObjects
,
METH_VARARGS
},
{
"wantobjects"
,
Tkapp_WantObjects
,
METH_VARARGS
},
{
"call"
,
Tkapp_Call
,
METH_OLDARGS
},
{
"call"
,
Tkapp_Call
,
METH_OLDARGS
},
{
"globalcall"
,
Tkapp_GlobalCall
,
METH_OLDARGS
},
{
"globalcall"
,
Tkapp_GlobalCall
,
METH_OLDARGS
},
...
...
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