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: "alloc: invalid block:" after askopenfilename #66999

Open
lccat mannequin opened this issue Nov 6, 2014 · 11 comments
Open

tkinter: "alloc: invalid block:" after askopenfilename #66999

lccat mannequin opened this issue Nov 6, 2014 · 11 comments
Labels
OS-windows stdlib Python modules in the Lib dir topic-tkinter type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@lccat
Copy link
Mannequin

lccat mannequin commented Nov 6, 2014

BPO 22810
Nosy @terryjreedy, @pfmoore, @mkiever, @tjguk, @zware, @serhiy-storchaka, @zooba
Files
  • tktest.py: script for reproducing the bug
  • crash.py: Run to reproduce crash
  • 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 = None
    closed_at = None
    created_at = <Date 2014-11-06.23:24:06.881>
    labels = ['expert-tkinter', 'OS-windows', 'type-crash']
    title = 'tkinter:  "alloc: invalid block:" after askopenfilename'
    updated_at = <Date 2017-07-14.14:19:37.260>
    user = 'https://bugs.python.org/lccat'

    bugs.python.org fields:

    activity = <Date 2017-07-14.14:19:37.260>
    actor = 'mkiever'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tkinter', 'Windows']
    creation = <Date 2014-11-06.23:24:06.881>
    creator = 'lccat'
    dependencies = []
    files = ['37142', '46683']
    hgrepos = []
    issue_num = 22810
    keywords = []
    message_count = 11.0
    messages = ['230768', '230771', '230791', '230795', '230798', '246198', '246223', '288780', '288824', '288827', '288830']
    nosy_count = 10.0
    nosy_names = ['terry.reedy', 'paul.moore', 'mkiever', 'tim.golden', 'zach.ware', 'serhiy.storchaka', 'steve.dower', 'lccat', 'tomnor', 'Todd Goldfinger']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue22810'
    versions = ['Python 3.6']

    @lccat
    Copy link
    Mannequin Author

    lccat mannequin commented Nov 6, 2014

    After running the Tkinter file dialog ( tkinter.filedialog.askopenfilename() ), and closing the tkinter window the following error message is displayed:
    alloc: invalid block: 0xb035e0: b0 0
    To reproduce see the attached python script "tktest". This does not stop the program as far as i can see. Also happens for the directory selector.
    Platform is linux.

    @lccat lccat mannequin added the topic-tkinter label Nov 6, 2014
    @serhiy-storchaka
    Copy link
    Member

    Unfortunately I can't reproduce this bug (Python 3.4.0, Linux). When close the main window the output is:

    Traceback (most recent call last):
      File "tktest.py", line 6, in <module>
        filename = tkinter.filedialog.askopenfilename()
      File "/usr/lib/python3.4/tkinter/filedialog.py", line 375, in askopenfilename
        return Open(**options).show()
      File "/usr/lib/python3.4/tkinter/commondialog.py", line 48, in show
        s = w.tk.call(self.command, *w._options(self.options))
    _tkinter.TclError: can't invoke "grab" command: application has been destroyed

    @serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Nov 7, 2014
    @lccat
    Copy link
    Mannequin Author

    lccat mannequin commented Nov 7, 2014

    Your output is different because you did not close the file dialog by selecting something and the pressing OK, or pressing cancel before destroying the main window. This is also the case here:
    Traceback (most recent call last):
      File "tktest.py", line 6, in <module>
        filename = tkinter.filedialog.askopenfilename()
      File "/usr/lib/python3.4/tkinter/filedialog.py", line 375, in askopenfilename
        return Open(**options).show()
      File "/usr/lib/python3.4/tkinter/commondialog.py", line 48, in show
        s = w.tk.call(self.command, *w._options(self.options))
    _tkinter.TclError: can't invoke "grab" command: application has been destroyed
    alloc: invalid block: 0x1d2cda0: a0 1
    zsh: abort      python tktest.py

    However, only the last two lines are relevant here, which you could not reproduce.

    @serhiy-storchaka
    Copy link
    Member

    When first close the file dialog (by pressing either Open, or Cancel, or close window button, or Alt-F4 keystroke), I don't see any output at all.

    What Tk version (tkinter.TkVersion) is used? What Linux distribution name and version are?

    @lccat
    Copy link
    Mannequin Author

    lccat mannequin commented Nov 7, 2014

    >print(TkVersion)
    8.6
    Tk version in package manager:
    python-pmw 2.0.0-2
    Distribution:
    arch linux, kernel 3.17.2-1-ARCH

    @terryjreedy
    Copy link
    Member

    Tomas Nordin reported on bpo-24524 (will close as dup) that a similar script crashes python 2.7.9 on Linux debian.

    @terryjreedy
    Copy link
    Member

    On Windows 7, no problem on either 2.7.10 or 3.5.0b2 (running from Command Prompt so would see message is there were one).

    @RochGuillot RochGuillot mannequin added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Jul 3, 2015
    @serhiy-storchaka serhiy-storchaka added type-crash A hard crash of the interpreter, possibly with a core dump and removed type-feature A feature request or enhancement labels Jul 4, 2015
    @ToddGoldfinger
    Copy link
    Mannequin

    ToddGoldfinger mannequin commented Mar 2, 2017

    This crashes reliably on Win10 with the same error message. Place cursor after the 2 in the top spin box. Type 0.

    I have the following files in Anaconda3/tcl: tcl86t.lib, tcl86tg.lib, tclstub86.lib, tk86t.lib, tk86tg.lib, tkstub86.lib.

    Python 3.6.0 |Anaconda 4.3.0 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.

    @ToddGoldfinger ToddGoldfinger mannequin added the OS-windows label Mar 2, 2017
    @terryjreedy
    Copy link
    Member

    Thanks Todd. I ran crash.py on Win10 64 bit, stock PSF 3.6.0 (no anaconda). Put cursor after 2 and hit '0'. Same error, different numbers.
    alloc: invalid block: 000002C8928640D0: 40 93
    Followed by Windows' "Python has stopped working" box.

    Cursor after the '6' in second spinbox, hit 0, nothing happens. I could not get rid of 6 to type in something new. Not sure if this is normal or something about particular code.

    Cursor before the '2': '0's can be inserted, nothing else. After multiple insert and delete and arrow presses, got error when closing.

    @serhiy-storchaka
    Copy link
    Member

    I think bpo-27405 could help to make a pure Tcl reproducer. If the same error happen with Tcl version, this is not Python bug.

    @ToddGoldfinger
    Copy link
    Mannequin

    ToddGoldfinger mannequin commented Mar 2, 2017

    > cursor after the '6' follows by '0'

    The max is 21. See 'to' parameter. I don't know if my code is correct, but it seems to work more or less. Obviously the crash is an issue with tk or Python.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @iritkatriel iritkatriel added the stdlib Python modules in the Lib dir label Nov 23, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows stdlib Python modules in the Lib dir topic-tkinter type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants