Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1869ec5c
Commit
1869ec5c
authored
May 01, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert tcl objects to strings in getvar/setvar. Fixes #730506.
parent
9e29625a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
Modules/_tkinter.c
Modules/_tkinter.c
+26
-2
No files found.
Modules/_tkinter.c
View file @
1869ec5c
...
@@ -742,6 +742,12 @@ PyTclObject_str(PyTclObject *self)
...
@@ -742,6 +742,12 @@ PyTclObject_str(PyTclObject *self)
return
PyString_FromString
(
Tcl_GetString
(
self
->
value
));
return
PyString_FromString
(
Tcl_GetString
(
self
->
value
));
}
}
static
char
*
PyTclObject_TclString
(
PyObject
*
self
)
{
return
Tcl_GetString
(((
PyTclObject
*
)
self
)
->
value
);
}
/* Like _str, but create Unicode if necessary. */
/* Like _str, but create Unicode if necessary. */
PyDoc_STRVAR
(
PyTclObject_string__doc__
,
PyDoc_STRVAR
(
PyTclObject_string__doc__
,
"the string representation of this object, either as string or Unicode"
);
"the string representation of this object, either as string or Unicode"
);
...
@@ -1466,6 +1472,22 @@ typedef struct VarEvent {
...
@@ -1466,6 +1472,22 @@ typedef struct VarEvent {
Tcl_Condition
cond
;
Tcl_Condition
cond
;
}
VarEvent
;
}
VarEvent
;
static
int
varname_converter
(
PyObject
*
in
,
void
*
_out
)
{
char
**
out
=
(
char
**
)
_out
;
if
(
PyString_Check
(
in
))
{
*
out
=
PyString_AsString
(
in
);
return
1
;
}
if
(
PyTclObject_Check
(
in
))
{
*
out
=
PyTclObject_TclString
(
in
);
return
1
;
}
/* XXX: Should give diagnostics. */
return
0
;
}
void
void
var_perform
(
VarEvent
*
ev
)
var_perform
(
VarEvent
*
ev
)
{
{
...
@@ -1542,7 +1564,8 @@ SetVar(PyObject *self, PyObject *args, int flags)
...
@@ -1542,7 +1564,8 @@ SetVar(PyObject *self, PyObject *args, int flags)
PyObject
*
res
=
NULL
;
PyObject
*
res
=
NULL
;
Tcl_Obj
*
newval
,
*
ok
;
Tcl_Obj
*
newval
,
*
ok
;
if
(
PyArg_ParseTuple
(
args
,
"sO:setvar"
,
&
name1
,
&
newValue
))
{
if
(
PyArg_ParseTuple
(
args
,
"O&O:setvar"
,
varname_converter
,
&
name1
,
&
newValue
))
{
/* XXX Acquire tcl lock??? */
/* XXX Acquire tcl lock??? */
newval
=
AsObj
(
newValue
);
newval
=
AsObj
(
newValue
);
if
(
newval
==
NULL
)
if
(
newval
==
NULL
)
...
@@ -1604,7 +1627,8 @@ GetVar(PyObject *self, PyObject *args, int flags)
...
@@ -1604,7 +1627,8 @@ GetVar(PyObject *self, PyObject *args, int flags)
PyObject
*
res
=
NULL
;
PyObject
*
res
=
NULL
;
Tcl_Obj
*
tres
;
Tcl_Obj
*
tres
;
if
(
!
PyArg_ParseTuple
(
args
,
"s|s:getvar"
,
&
name1
,
&
name2
))
if
(
!
PyArg_ParseTuple
(
args
,
"O&|s:getvar"
,
varname_converter
,
&
name1
,
&
name2
))
return
NULL
;
return
NULL
;
ENTER_TCL
ENTER_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