Opened 16 months ago

Last modified 16 months ago

#67741 assigned defect

py311-pyobjc crashes the interpreter when help('modules') is used

Reported by: snowflake (Dave Evans) Owned by: danchr (Dan Villiom Podlaski Christiansen)
Priority: Normal Milestone:
Component: ports Version: 2.8.99
Keywords: Cc:
Port: py-pyobjc

Description

In an interactive Python3 session, I typed help('modules') at the prompt.

After a couple of seconds Python crashed with a SEG Fault.

I copied pydoc.py from the Macports folder to a folder where I could edit it.

I modified pydoc.py like this:

Please wait a moment while I gather a list of all available modules...                                        
                                                                                                              
''')
            modules = {}
            def callback(path, modname, desc, modules=modules):
                print(path, modname) # <<< Debugging statement >>>                                            
                if modname and modname[-9:] == '.__init__':
                    modname = modname[:-9] + ' (package)'
                if modname.find('.') < 0:
                    modules[modname] = 1

I then ran my modified pydoc.py as a standalone Python script with the appropriate command to generate a list of modules. A long list of debugging statements was displayed and then Python crashed.

I searched Macports for the module which was causing the crash and I found it was in py311-pyobjc. I deactivated py311-pyobjc and tried again. This time the list of modules did not crash.

I have also tested this with python310 with the same result.

Change History (2)

comment:1 Changed 16 months ago by jmroot (Joshua Root)

Owner: changed from jmroot to danchr
Port: py-pyobjc added; python311 py311-pyobjc removed
Summary: python311 @3.11.4_0 crashes with SEG Fault if py311-pyobjc is activated and help('modules') is usedpy311-pyobjc crashes the interpreter when help('modules') is used

I'm not realistically able to change the behaviour of the help() builtin, which is to import the modules that are queried. The bug here is that pyobjc crashes when this is done.

comment:2 Changed 16 months ago by snowflake (Dave Evans)

The crash appears to be related to older versions of macOS. I tried it on El Capitan 10.11.6 and it crashed. On Ventura 13.4.1, it worked.

On 10.11.6, almost any use of py-pyobjc crashed. Typing from Cocoa import NSLog at a Python prompt resulted in a crash.

Note: See TracTickets for help on using tickets.