This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Derby: Convert the _tkinter module to use Argument Clinic
Type: enhancement Stage: resolved
Components: Argument Clinic, Extension Modules, Tkinter Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: 20196 Superseder:
Assigned To: serhiy.storchaka Nosy List: gpolo, jkloth, larry, python-dev, serhiy.storchaka, steve.dower
Priority: normal Keywords: patch

Created on 2014-01-07 21:03 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkinter_clinic.patch serhiy.storchaka, 2014-01-18 12:26 review
tkinter_clinic_2.patch serhiy.storchaka, 2014-03-20 18:45 review
tkinter_clinic_3.patch serhiy.storchaka, 2014-06-01 15:47 review
tkinter_clinic_4.patch serhiy.storchaka, 2015-04-17 20:01 review
larry.fix.tkinter.build.on.windows.diff.1.txt larry, 2015-05-03 19:58 review
Messages (18)
msg207600 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-07 21:03
In progress. Actually many functions are not very suitable for Argument Clinic.
msg207604 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 21:35
What functions, and what makes them unsuitable?
msg207605 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-07 21:58
call() just converts all args to Tcl list. Is Argument Clinic supports *args 
and **kwargs? I'm not sure there is a benefit with using Argument Clinic here.

splitlist() and split() first call PyArg_ParseTuple with one argument, check 
the input, and then may call PyArg_ParseTuple with other argument. They need 
large refactoring to use Argument Clinic.

getint(), getdouble(), getboolean() first manually unpack arguments tuple, and 
then may call PyArg_ParseTuple. Same as above.

setvar()/globalsetvar(), getvar()/globalgetvar(), unsetvar()/globalunsetvar() 
shares common code parametrized by flags. I think this is resolvable. But 
worse, they can delegates their execution to other thread and should save all 
arguments in events queue. And this looks absolutely unsuitable for Argument 
Clinic.
msg207609 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-07 22:11
(It would have made it easier on me if you'd used the C function names, instead of the names in the module.)

I agree.  In retrospect, it's not surprising that things in _tkinter aren't suitable, as it appears to be a shunt for calling things in Tcl.

For what it's worth, Argument Clinic is only intended for functions that use PyArg_ParseTuple or PyArg_ParseTupleOrKeywords to parse their arguments.  So something like call is and will forever be unsuitable.

(And reading _tkinter.c this has reminded me why I don't like Tcl ;-)
msg207699 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-08 20:43
So do you think there are any entry points worth converting in _tkinter, or should we close this issue?
msg207706 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-08 22:00
You misunderstood me. I already have 1018-lines patch which converts about 24 
functions and methods to Argument Clinic church. And I'm working on left 
functions. Do you want to get unfinished patch?
msg207716 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-08 23:58
Oh, okay.  That sounds fine, and I'm not in a hurry.  Please post the patch whenever you're ready, thanks!
msg208398 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-18 12:26
Here is a patch.
msg214259 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-03-20 18:45
Here is updated patch.
msg219507 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-06-01 15:47
Synchronized with tip.
msg241357 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-04-17 19:59
Updated to the tip. Converted methods getint, getdouble, getboolean, splitlist, split.
msg242471 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-05-03 13:18
New changeset b22ced894d51 by Serhiy Storchaka in branch 'default':
Issue #20168: Converted the _tkinter module to Argument Clinic.
https://hg.python.org/cpython/rev/b22ced894d51
msg242478 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-05-03 14:31
wantobjects() was not converted due to a bug in Argument Clinic (issue24051).
msg242503 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-05-03 19:39
This broke Windows builds because of unnecessary "static" qualifiers on the forward declarations at lines 2685 and 3006 (as discussed on #20323).

Removing "static" from these lines fixes the build.
msg242507 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-05-03 19:58
As mentioned on #20148, removing the "static" from the forward declarations breaks it on GCC.  (And, of the two, I think GCC is the one being reasonable here.)

Attached is a patch that should fix the build for tkinter.
msg242528 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-05-03 21:43
LGTM
msg242530 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-05-03 21:49
New changeset 7a76c462c7f6 by Larry Hastings in branch 'default':
Fix Windows build breakage from checkins on Issues #20148 and #20168.
https://hg.python.org/cpython/rev/7a76c462c7f6
msg242533 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-05-03 21:53
Steve, please close this issue when you've confirmed it's now building correctly on Windows.
History
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64367
2015-05-04 12:47:16serhiy.storchakasetstatus: open -> closed
resolution: fixed
2015-05-03 21:53:59larrysetmessages: + msg242533
2015-05-03 21:49:51python-devsetmessages: + msg242530
2015-05-03 21:43:57steve.dowersetmessages: + msg242528
2015-05-03 19:58:51larrysetfiles: + larry.fix.tkinter.build.on.windows.diff.1.txt

messages: + msg242507
2015-05-03 19:39:35steve.dowersetstatus: closed -> open

nosy: + steve.dower
messages: + msg242503

resolution: fixed -> (no value)
2015-05-03 14:31:49serhiy.storchakasetstatus: open -> closed
messages: + msg242478

dependencies: - Argument Clinic no longer works with single optional argument
resolution: fixed
stage: patch review -> resolved
2015-05-03 13:18:49python-devsetnosy: + python-dev
messages: + msg242471
2015-04-24 13:49:13serhiy.storchakasetdependencies: + Argument Clinic no longer works with single optional argument
2015-04-17 20:01:18serhiy.storchakasetfiles: + tkinter_clinic_4.patch
2015-04-17 20:01:06serhiy.storchakasetfiles: - tkinter_4.patch
2015-04-17 19:59:59serhiy.storchakasetfiles: + tkinter_4.patch

messages: + msg241357
2015-02-25 15:26:31serhiy.storchakasetcomponents: + Argument Clinic
2014-06-01 15:47:18serhiy.storchakasetfiles: + tkinter_clinic_3.patch

messages: + msg219507
2014-03-20 18:45:13serhiy.storchakasetfiles: + tkinter_clinic_2.patch

messages: + msg214259
versions: + Python 3.5, - Python 3.4
2014-01-18 12:26:29serhiy.storchakasetfiles: + tkinter_clinic.patch

nosy: + gpolo
messages: + msg208398

keywords: + patch
stage: patch review
2014-01-09 07:28:42serhiy.storchakasetdependencies: + Argument Clinic generates invalid code for optional parameter
2014-01-08 23:58:16larrysetmessages: + msg207716
2014-01-08 22:00:25serhiy.storchakasetmessages: + msg207706
2014-01-08 20:43:48larrysetmessages: + msg207699
2014-01-08 01:36:37r.david.murraylinkissue20187 dependencies
2014-01-07 22:11:15larrysetmessages: + msg207609
2014-01-07 21:58:06serhiy.storchakasetmessages: + msg207605
2014-01-07 21:35:33larrysetmessages: + msg207604
2014-01-07 21:09:23jklothsetnosy: + jkloth
2014-01-07 21:04:21serhiy.storchakasetassignee: serhiy.storchaka

nosy: + larry
2014-01-07 21:03:59serhiy.storchakacreate