Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tkinter with wantobjects=False has been broken for some time #47265

Closed
gpolo mannequin opened this issue May 30, 2008 · 16 comments
Closed

tkinter with wantobjects=False has been broken for some time #47265

gpolo mannequin opened this issue May 30, 2008 · 16 comments
Assignees
Labels
topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@gpolo
Copy link
Mannequin

gpolo mannequin commented May 30, 2008

BPO 3015
Nosy @loewis, @asvetlov, @serhiy-storchaka
Files
  • tkinter_wantobjects.diff
  • remove_wantobjects_internalRep.diff
  • tkinter_deprecate_wantobjects.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-10-24.20:53:40.142>
    created_at = <Date 2008-05-30.22:51:37.199>
    labels = ['type-bug', 'expert-tkinter']
    title = 'tkinter with wantobjects=False has been broken for some time'
    updated_at = <Date 2016-10-24.20:53:40.141>
    user = 'https://bugs.python.org/gpolo'

    bugs.python.org fields:

    activity = <Date 2016-10-24.20:53:40.141>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-10-24.20:53:40.142>
    closer = 'serhiy.storchaka'
    components = ['Tkinter']
    creation = <Date 2008-05-30.22:51:37.199>
    creator = 'gpolo'
    dependencies = []
    files = ['10482', '10484', '31827']
    hgrepos = []
    issue_num = 3015
    keywords = ['patch']
    message_count = 16.0
    messages = ['67562', '67567', '67575', '67577', '197767', '198167', '198168', '198169', '198170', '219012', '219171', '219177', '219247', '219267', '219268', '222813']
    nosy_count = 8.0
    nosy_names = ['loewis', 'gpolo', 'Arfrever', 'asvetlov', 'jesstess', 'python-dev', 'serhiy.storchaka', 'Lita.Cho']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3015'
    versions = ['Python 3.4']

    @gpolo
    Copy link
    Mannequin Author

    gpolo mannequin commented May 30, 2008

    This affects only py3k, but apparently tkinter has been in this
    situation for more than 9 months now.
    I see these lines at _tkinter.c:

    const char *s = Tcl_GetStringResult(self->interp);
    const char *p = s;
    res = PyUnicode_FromStringAndSize(s, (int)(p-s));

    and I was wondering how could res not end up being an empty string
    always ? Then I did some quick tests here and the return is always an
    empty string, when wantobjects is set to False. Maybe the second line
    should be:

    const char *p = strchr(s, '\0');

    I've attached this correction. Not sure if it is the best way to solve
    the problem.

    @gpolo gpolo mannequin added the topic-tkinter label May 30, 2008
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 31, 2008

    I think in Python 3, the whole wantobjects=False case should go. It was
    a compatibility measure to support applications that didn't expect Tcl
    objects; for Python 3, only a single case should be supported.

    @gpolo
    Copy link
    Mannequin Author

    gpolo mannequin commented May 31, 2008

    I will agree that wantobjects=False should go, it is also discouraged to
    use Tcl_GetStringResult because it may lose information.

    But something should be done at FromObj since it accesses Tcl_Obj fields
    directly, and it may end up not using the current object representation
    which may cause weird things like in bpo-1447222. Said that, I'm not
    sure how to fix it for now.

    @gpolo
    Copy link
    Mannequin Author

    gpolo mannequin commented May 31, 2008

    I've removed wantobjects and substituted some internalRep usage too.

    @serhiy-storchaka
    Copy link
    Member

    Looks as bpo-18877 is related to this. I have proposed for it a little different patch than first Guilherme's patch.

    As for removing wantobjects, we perhaps can do this only in 3.4.

    @serhiy-storchaka serhiy-storchaka self-assigned this Sep 20, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 20, 2013

    New changeset 08c45e18e7b2 by Serhiy Storchaka in branch '3.3':
    Issue bpo-3015: Fixed tkinter with wantobject=False. Any Tcl command call
    http://hg.python.org/cpython/rev/08c45e18e7b2

    New changeset 65dd0de6b4a5 by Serhiy Storchaka in branch 'default':
    Issue bpo-3015: Fixed tkinter with wantobject=False. Any Tcl command call
    http://hg.python.org/cpython/rev/65dd0de6b4a5

    @serhiy-storchaka
    Copy link
    Member

    Here is a patch which change the default value for the wantobjects parameter of _tkinter.create() and adds deprecation warnings.

    @serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Sep 20, 2013
    @Arfrever
    Copy link
    Mannequin

    Arfrever mannequin commented Sep 20, 2013

    Here is a patch

    You again forgot to attach a patch :) .

    @serhiy-storchaka
    Copy link
    Member

    Oh, thanks Arfrever.

    @LitaCho
    Copy link
    Mannequin

    LitaCho mannequin commented May 23, 2014

    I am in the process of reviewing this patch, but I don't know what "wantobjects" does. I can make a guess, I think it is a hack to make tcl objects work in Python. I am guessing this is less needed in Python 3.4, but still has some dependencies.

    If we can add in the documentation of what "wantobjects" is and why it is being depreciated somewhere, that would be great. I would do it myself, but I do need some direction.

    I ran the tests, and it seems to run fine. The patch didn't have any new tests. We should add one that checks if the depreciation is working.

    @jesstess
    Copy link
    Member

    @Lita.Cho: (I'd like to this on the web but the links are still broken after the website port) if you search for wantobjects in [Doc/whatsnew/2.3.rst](https://github.com/python/cpython/blob/main/Doc/whatsnew/2.3.rst), there's a description of why the parameter was added.

    @serhiy-storchaka
    Copy link
    Member

    Now I think we shouldn't deprecate and remove wantobjects=False. Tkinter was partially broken with wantobjects=False, on other hand, it was partially broken with wantobjects=True. Many bugs was fixed last months, all tests now work with wantobjects=False, and I hope Tkinter now correctly supports both mode.

    Besides using in old third-party code, this parameter is very helpful for testing. Tcl/Tk changes internal details from release to release, so when in one release Tk function returns list or integer, in other release it can return special object ('dict' or 'pixel'). Tkinter should be more stable against changing of return type, and wantobjects=False helps in detecting some such cases.

    I propose to close this issue as fixed.

    @LitaCho
    Copy link
    Mannequin

    LitaCho mannequin commented May 28, 2014

    Serhiy, does that mean this is fixed the way it is? Do I need to do anything else to close out this issue? It looks like wantobjects is set to False, currently.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 28, 2014

    New changeset c69e8ea3bf10 by Serhiy Storchaka in branch 'default':
    Issue bpo-3015: _tkinter.create() now creates tkapp object with wantobject=1 by
    http://hg.python.org/cpython/rev/c69e8ea3bf10

    @serhiy-storchaka
    Copy link
    Member

    Lita Cho, originally reported issue is fixed.

    I asked Martin (and Guilherme if he is here). Are you agree to close this issue? See bpo-21585 about extending testing.

    @LitaCho
    Copy link
    Mannequin

    LitaCho mannequin commented Jul 12, 2014

    That's perfect. I agree that this issue is closed! :)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants