#842 NullPointerException on Find definition for generated class


I get a NullPointerException when hitting F3 to go to the definition of a method in a class that is generated dynamically. To reproduce:

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
Session = scoped_session(sessionmaker(bind=create_engine('sqlite:///:memory:')))

When I hit F3 on notreallythere, nothing happens.

When I hit F3 on add, I get an error dialog about a NullPointerException. This is how that exception looks in workspace/.metadata/.log:

!ENTRY org.python.pydev 4 4 2009-01-26 11:20:20.647
!MESSAGE java.lang.NullPointerException
java.lang.RuntimeException: java.lang.NullPointerException
at com.python.pydev.analysis.AnalysisPlugin.getDefinitionFromIInfo(AnalysisPlugin.java:100)
at com.python.pydev.refactoring.refactorer.RefactorerFindDefinition.findDefinition(RefactorerFindDefinition.java:70)
at com.python.pydev.refactoring.refactorer.Refactorer.findDefinition(Refactorer.java:91)
at org.python.pydev.editor.actions.PyGoToDefinition.findDefinition(PyGoToDefinition.java:245)
at org.python.pydev.editor.actions.PyGoToDefinition.findDefinitionsAndOpen(PyGoToDefinition.java:97)
at org.python.pydev.editor.actions.PyGoToDefinition.run(PyGoToDefinition.java:86)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
Caused by: java.lang.NullPointerException
at org.python.pydev.editor.codecompletion.revisited.SystemModulesManager.getBuiltinModule(SystemModulesManager.java:184)
at org.python.pydev.editor.codecompletion.revisited.SystemModulesManager.getBuiltinModule(SystemModulesManager.java:1)
at org.python.pydev.editor.codecompletion.revisited.ProjectModulesManager.getModuleAndRelatedModulesManager(ProjectModulesManager.java:284)
at org.python.pydev.editor.codecompletion.revisited.ProjectModulesManager.getModule(ProjectModulesManager.java:264)
at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getModule(AbstractASTManager.java:344)
at org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule.findDefinition(CompiledModule.java:350)
at org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule.findDefinition(CompiledModule.java:1)
at com.python.pydev.analysis.AnalysisPlugin.getDefinitionFromIInfo(AnalysisPlugin.java:81)
... 52 more


  • Fabio Zadrozny
    Fabio Zadrozny

    • status: open --> pending
  • Fabio Zadrozny
    Fabio Zadrozny

    I'm trying to reproduce that without success here. I think it can be related to the configurations on your project... Do you think you can attach a sample project (with the .pydevproject files and the source structure) of an example where that error happens?



  • Now I can't reproduce it. I had restarted Eclipse inbetween. I had been messing around with a "global Session" and a "from somepackage import Session" but I tried to run through all permutations of that again, with no luck. No Eclipse/PyDev configuration was changed in the meantime. The error must have been dependent on some Eclipse/PyDev state that I don't know how to reproduce. So I'm afraid all I have for you is this stack trace. I will comment here if I do get this again.

    • status: pending --> open
  • Fabio Zadrozny
    Fabio Zadrozny

    • status: open --> closed-fixed
  • Fabio Zadrozny
    Fabio Zadrozny

    Well, I was able to reproduce it artificially in a test case with the following scenario:
    - A find is done for a token that's defined in the forced builtins
    - The reference is found, but maps to a file that's outside of the PYTHONPATH known by Pydev
    - At that point, it cannot resolve the name of the module and returns null (and a later access to that variable throws the exception pointed in the bug)

    Fixed it for 1.4.3 (svn: 2552)