Search code examples
eclipsepython-3.6pydevnull-pointer

Python 36 (Eclipse Oxygen, PyDev) crashes when reaching breakpoint


Python 36 (on Windows 7, latest Anaconda with Python 36 under latest Eclipse Oxygen) is crashing whenever it reaches a breakpoint. The error is a 'classic' NULL pointer error.

Unhandled exception at 0x000000001D8CF76D (python36.dll) in python.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

The (top) of the stack trace looks like this:

>   python36.dll!PyType_IsSubtype(_typeobject * a, _typeobject * b) Line 1358   C
    sip.pyd!000007fec602092d()  Unknown
    sip.pyd!000007fec6020897()  Unknown
    QtGui.pyd!000007fec6649d02()    Unknown
    python36.dll!_PyImport_LoadDynamicModuleWithSpec(_object * spec, _iobuf *) Line 160 C
    python36.dll!_imp_create_dynamic_impl(_object * spec, _object * file, _object *) Line 1984  C
    python36.dll!_imp_create_dynamic(_object * module, _object * args) Line 289 C
    python36.dll!_PyEval_EvalFrameDefault(_frame * f, int throwflag) Line 3391  C
    pydevd_frame_evaluator.cp36-win_amd64.pyd!000007fed57869ac()    Unknown
    python36.dll!_PyEval_EvalCodeWithName(_object * _co, _object * globals, _object * locals, _object * * args, __int64 argcount, _object * * kwnames, _object * * kwargs, __int64 kwcount, int kwstep, _object * * defs, __int64 defcount, _object * kwdefs, _object * closure, _object * name, _object * qualname) Line 4153  C
    python36.dll!call_function(_object * * * pp_stack, __int64 oparg, _object * kwnames) Line 4845  C

Not sure whether it is relevant, but my code is a Django 2.x application. Any idea what is going on? (I just ported this code from Python2)

Can I tell PyDev to not use precompiled code (pyd)?

UPDATE

Setting the env variable didn't help; I tried setting it for Eclipse, in the Python definition and in the Debug configuration.

Surprisingly deleting (renaming really) the .pyd didn't work either.

I tried to re-install PyDev and not build the debugger speedups this time (assuming this is how the .pyd are created), but the error remains.

warning: Debugger speedups using cython not found. Run '"C:\Anaconda3\python.exe" "C:\eclipse-jee-oxygen\configuration\org.eclipse.osgi\364\data\779679999\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\setup_cython.py" build_ext --inplace' to build.


Solution

  • I managed to "solve" (at least work around) the problem by downgrading the sip package conda install sip=4.18 (I had version 4.19.8)

    I first tried to simply uninstall it with conda uninstall sip ---force (conda wanted to uninstall totally unrelated package as well), however that resulted in Qt5 errors.

    Following the workaround auto-complete in debug mode broke down (not sure whether related). Both the error and the fix for that case were absurd.

    Completion error:

    Error in fetching completionsTraceback (most recent call last):
      File "C:\eclipse-jee-oxygen\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\_pydevd_bundle\pydevd_comm.py", 
        line 1431, in do_it 
            completions_xml = pydevd_console.get_completions(frame, elf.act_tok)
      File "C:\eclipse-jee-oxygen\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\_pydevd_bundle\pydevd_console.py", 
        line 248, in get_completions
            return _pydev_completer.generate_completions_as_xml(frame, act_tok)
      File "C:\eclipse-jee-oxygen\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\_pydev_bundle\_pydev_completer.py", 
        line 167, in generate_completions_as_xml
            completions = pydevconsole.get_completions(act_tok, act_tok, updated_globals, frame.f_locals)
      File "C:\eclipse-jee-oxygen\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\pydevconsole.py", 
        line 462, in get_completions
            interpreterInterface.interpreter.update(globals, locals)
      File "C:\eclipse-jee-oxygen\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\_pydev_bundle\pydev_ipython_console_011.py", 
        line 350, in update
            for key in dict_keys(self.ipython.user_ns):
    NameError: name 'dict_keys' is not defined
    

    dict_keys is not a method in pydev_ipython_console_011.py nor is it imported as far as I can tell.

    My 'fix' was to add a print(type(self.ipython.user_ns)) to check whether I can remove dict_keys and this miraculously fixed the problem. My assumption was that this triggered some recompilation of a pyc, but removing the print line made the error re-occur ... so I guess there is some memory corruption involved.