Repository: pyqtgraph/pyqtgraph

Issue:
Conflict with tensorflow-datasets
There is a conflict between pyqtgraph and tensorflow-datasets.  This is caused by iteration over the garbage-collected objects:
```
    for o in gc.get_objects():
        try:
            if isinstance(o, QtWidgets.QGraphicsItem) and isQObjectAlive(o) and o.scene() is None:
```
which triggers a lazy object in tensorflow-datasets:
```
class LazyBuilderImport():
  """Lazy load DatasetBuilder from given name from legacy locations."""

  def __init__(self, dataset_name: Text):
    object.__setattr__(self, "_dataset_name", dataset_name)
    object.__setattr__(self, "_dataset_cls", None)

  def _get_builder_cls(self):
    cls = object.__getattribute__(self, "_dataset_cls")
    if not cls:
      builder_name = object.__getattribute__(self, "_dataset_name")
      logging.warning(
          "DEPRECATED! Do not use a DatasetBuilder class directly, but"
          " call `tfds.builder_cls('%s')`.", builder_name)
      cls = registered.imported_builder_cls(builder_name)
      object.__setattr__(self, "_dataset_cls", cls)
    return cls

  def __getattribute__(self, attr_name):
    cls = object.__getattribute__(self, "_get_builder_cls")()
    return getattr(cls, attr_name)

  def __call__(self, *args, **kwargs):
    cls = object.__getattribute__(self, "_get_builder_cls")()
    return cls(*args, **kwargs)
```
Here's the error produced:
```
❯ cmm_demo deduction gui
WARNING:absl:You use TensorFlow DType <dtype: 'float32'> in tfds.features This will soon be deprecated in favor of NumPy DTypes. In the meantime it was converted to float32.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('accentdb')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('groove')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('librispeech')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('libritts')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('ljspeech')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('nsynth')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('savee')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('ogbg_molpcba')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('abstract_reasoning')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('aflw2k3d')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('arc')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('bccd')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('binarized_mnist')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('celeb_a')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('celeb_a_hq')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('cityscapes')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('clevr')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('clic')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('coil100')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('div2k')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('downsampled_imagenet')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('dsprites')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('duke_ultrasound')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('flic')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('lost_and_found')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('nyu_depth_v2')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('pass')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('s3o4d')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('scene_parse150')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('shapes3d')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('symmetric_solids')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('the300w_lp')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('beans')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('bee_dataset')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('bigearthnet')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('binary_alpha_digits')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('caltech101')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet2012')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet2012_corrupted')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet2012_fewshot')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet2012_multilabel')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet2012_real')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet2012_subset')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet_a')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet_lt')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet_r')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet_resized')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet_sketch')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenet_v2')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagenette')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imagewang')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('lfw')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('malaria')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('oxford_flowers102')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('oxford_iiit_pet')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('patch_camelyon')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('pet_finder')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('places365_small')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('placesfull')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('plant_leaves')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('plant_village')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('plantae_k')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('quickdraw_bitmap')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('resisc45')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('rock_paper_scissors')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('siscore')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('smallnorb')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('kitti')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('lvis')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('open_images_v4')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('open_images_challenge2019_detection')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('sift1m')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('ai2_arc')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('ai2_arc_with_ir')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('answer_equivalence')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('asqa')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('mctaco')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('mlqa')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('natural_questions')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('natural_questions_open')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('qasc')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('simpte')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('robomimic_ph')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('amazon_us_reviews')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('ble_wind_field')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('e2e_cleaned')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('efron_morris75')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('kddcup99')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('penguins')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('protein_net')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('radon')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('rock_you')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('aeslc')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('big_patent')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('billsum')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('booksum')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('media_sum')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('newsroom')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('opinion_abstracts')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('opinosis')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('reddit')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('reddit_tifu')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('samsum')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('scientific_papers')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('ag_news_subset')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('anli')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('assin2')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('beir')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('blimp')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('bool_q')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('imdb_reviews')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('irc_disentanglement')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('lambada')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('librispeech_lm')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('lm1b')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('math_dataset')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('math_qa')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('openbookqa')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('paws_wiki')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('paws_x_wiki')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('pg19')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('piqa')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('qa4mre')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('quac')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('quality')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('race')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('reddit_disentanglement')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('salient_span_wikipedia')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('scan')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('schema_guided_dialogue')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('scicite')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('sci_tail')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('sentiment140')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('universal_dependencies')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('xtreme_pos')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('asset')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('bucc')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('opus')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('para_crawl')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('bair_robot_pushing_small')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('robonet')`.
WARNING:absl:DEPRECATED! Do not use a DatasetBuilder class directly, but call `tfds.builder_cls('ref_coco')`.
```
In the comments, it says:
```
    ## Workaround for Qt exit crash:
    ## ALL QGraphicsItems must have a scene before they are deleted.
    ## This is potentially very expensive, but preferred over crashing.
    ## Note: this appears to be fixed in PySide as of 2012.12, but it should be left in for a while longer..
```
Maybe it's time to remove it.


Discussion:

Resolving patch:
diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py
--- a/pyqtgraph/__init__.py
+++ b/pyqtgraph/__init__.py
@@ -35,8 +35,8 @@
 elif 'darwin' in sys.platform: ## openGL can have a major impact on mac, but also has serious bugs
     useOpenGL = False
 else:
-    useOpenGL = False  ## on windows there's a more even performance / bugginess tradeoff. 
-                
+    useOpenGL = False  ## on windows there's a more even performance / bugginess tradeoff.
+
 CONFIG_OPTIONS = {
     'useOpenGL': useOpenGL, ## by default, this is platform-dependent (see widgets/GraphicsView). Set to True or False to explicitly enable/disable opengl.
     'leftButtonPan': True,  ## if false, left button drags a rubber band for zooming in viewbox
@@ -72,9 +72,9 @@ def setConfigOption(opt, value):
     CONFIG_OPTIONS[opt] = value
 
 def setConfigOptions(**opts):
-    """Set global configuration options. 
-    
-    Each keyword argument sets one global option. 
+    """Set global configuration options.
+
+    Each keyword argument sets one global option.
     """
     for k,v in opts.items():
         setConfigOption(k, v)
@@ -90,7 +90,7 @@ def systemInfo():
     print("sys.version: %s" % sys.version)
     from .Qt import VERSION_INFO
     print("qt bindings: %s" % VERSION_INFO)
-    
+
     global __version__
     rev = None
     if __version__ is None:  ## this code was probably checked out from bzr; look up the last-revision file
@@ -98,7 +98,7 @@ def systemInfo():
         if os.path.exists(lastRevFile):
             with open(lastRevFile, 'r') as fd:
                 rev = fd.read().strip()
-    
+
     print("pyqtgraph: %s; %s" % (__version__, rev))
     print("config:")
     import pprint
@@ -106,16 +106,16 @@ def systemInfo():
 
 ## Rename orphaned .pyc files. This is *probably* safe :)
 ## We only do this if __version__ is None, indicating the code was probably pulled
-## from the repository. 
+## from the repository.
 def renamePyc(startDir):
     ### Used to rename orphaned .pyc files
     ### When a python file changes its location in the repository, usually the .pyc file
-    ### is left behind, possibly causing mysterious and difficult to track bugs. 
+    ### is left behind, possibly causing mysterious and difficult to track bugs.
 
     ### Note that this is no longer necessary for python 3.2; from PEP 3147:
-    ### "If the py source file is missing, the pyc file inside __pycache__ will be ignored. 
+    ### "If the py source file is missing, the pyc file inside __pycache__ will be ignored.
     ### This eliminates the problem of accidental stale pyc file imports."
-    
+
     printed = False
     startDir = os.path.abspath(startDir)
     for path, dirs, files in os.walk(startDir):
@@ -138,7 +138,7 @@ def renamePyc(startDir):
                 print("  " + fileName + "  ==>")
                 print("  " + name2)
                 os.rename(fileName, name2)
-                
+
 path = os.path.split(__file__)[0]
 
 ## Import almost everything to make it available from a single namespace
@@ -147,8 +147,8 @@ def renamePyc(startDir):
 #from . import frozenSupport
 #def importModules(path, globals, locals, excludes=()):
     #"""Import all modules residing within *path*, return a dict of name: module pairs.
-    
-    #Note that *path* MUST be relative to the module doing the import.    
+
+    #Note that *path* MUST be relative to the module doing the import.
     #"""
     #d = os.path.join(os.path.split(globals['__file__'])[0], path)
     #files = set()
@@ -159,7 +159,7 @@ def renamePyc(startDir):
             #files.add(f[:-3])
         #elif f[-4:] == '.pyc' and f != '__init__.pyc':
             #files.add(f[:-4])
-        
+
     #mods = {}
     #path = path.replace(os.sep, '.')
     #for modName in files:
@@ -176,7 +176,7 @@ def renamePyc(startDir):
             #traceback.print_stack()
             #sys.excepthook(*sys.exc_info())
             #print("[Error importing module: %s]" % modName)
-            
+
     #return mods
 
 #def importAll(path, globals, locals, excludes=()):
@@ -288,7 +288,7 @@ def renamePyc(startDir):
 from .widgets.VerticalLabel import *
 
 ##############################################################
-## PyQt and PySide both are prone to crashing on exit. 
+## PyQt and PySide both are prone to crashing on exit.
 ## There are two general approaches to dealing with this:
 ##  1. Install atexit handlers that assist in tearing down to avoid crashes.
 ##     This helps, but is never perfect.
@@ -300,34 +300,12 @@ def cleanup():
     global _cleanupCalled
     if _cleanupCalled:
         return
-    
+
     if not getConfigOption('exitCleanup'):
         return
-    
+
     ViewBox.quit()  ## tell ViewBox that it doesn't need to deregister views anymore.
-    
-    ## Workaround for Qt exit crash:
-    ## ALL QGraphicsItems must have a scene before they are deleted.
-    ## This is potentially very expensive, but preferred over crashing.
-    ## Note: this appears to be fixed in PySide as of 2012.12, but it should be left in for a while longer..
-    app = QtWidgets.QApplication.instance()
-    if app is None or not isinstance(app, QtWidgets.QApplication):
-        # app was never constructed is already deleted or is an
-        # QCoreApplication/QGuiApplication and not a full QApplication
-        return
-    import gc
-    s = QtWidgets.QGraphicsScene()
-    for o in gc.get_objects():
-        try:
-            if isinstance(o, QtWidgets.QGraphicsItem) and isQObjectAlive(o) and o.scene() is None:
-                if getConfigOption('crashWarning'):
-                    sys.stderr.write('Error: graphics item without scene. '
-                        'Make sure ViewBox.close() and GraphicsView.close() '
-                        'are properly called before app shutdown (%s)\n' % (o,))
-                
-                s.addItem(o)
-        except (RuntimeError, ReferenceError):  ## occurs if a python wrapper no longer has its underlying C++ object
-            continue
+
     _cleanupCalled = True
 
 atexit.register(cleanup)
@@ -349,28 +327,28 @@ def _connectCleanup():
 def exit():
     """
     Causes python to exit without garbage-collecting any objects, and thus avoids
-    calling object destructor methods. This is a sledgehammer workaround for 
+    calling object destructor methods. This is a sledgehammer workaround for
     a variety of bugs in PyQt and Pyside that cause crashes on exit.
-    
+
     This function does the following in an attempt to 'safely' terminate
     the process:
-    
+
       * Invoke atexit callbacks
       * Close all open file handles
       * os._exit()
-    
+
     Note: there is some potential for causing damage with this function if you
     are using objects that _require_ their destructors to be called (for example,
     to properly terminate log files, disconnect from devices, etc). Situations
     like this are probably quite rare, but use at your own risk.
     """
-    
+
     ## first disable our own cleanup function; won't be needing it.
     setConfigOptions(exitCleanup=False)
-    
+
     ## invoke atexit callbacks
     atexit._run_exitfuncs()
-    
+
     ## close file handles
     if sys.platform == 'darwin':
         for fd in range(3, 4096):
@@ -384,7 +362,7 @@ def exit():
         os.closerange(3, 4096) ## just guessing on the maximum descriptor count..
 
     os._exit(0)
-    
+
 
 ## Convenience functions for command-line use
 plots = []
@@ -393,7 +371,7 @@ def exit():
 
 def plot(*args, **kargs):
     """
-    Create and return a :class:`PlotWidget <pyqtgraph.PlotWidget>` 
+    Create and return a :class:`PlotWidget <pyqtgraph.PlotWidget>`
     Accepts a *title* argument to set the title of the window.
     All other arguments are used to plot data. (see :func:`PlotItem.plot() <pyqtgraph.PlotItem.plot>`)
     """
@@ -417,7 +395,7 @@ def plot(*args, **kargs):
 
 def image(*args, **kargs):
     """
-    Create and return an :class:`ImageView <pyqtgraph.ImageView>` 
+    Create and return an :class:`ImageView <pyqtgraph.ImageView>`
     Will show 2D or 3D image data.
     Accepts a *title* argument to set the title of the window.
     All other arguments are used to show data. (see :func:`ImageView.setImage() <pyqtgraph.ImageView.setImage>`)
@@ -436,7 +414,7 @@ def image(*args, **kargs):
 def dbg(*args, **kwds):
     """
     Create a console window and begin watching for exceptions.
-    
+
     All arguments are passed to :func:`ConsoleWidget.__init__() <pyqtgraph.console.ConsoleWidget.__init__>`.
     """
     mkQApp()
@@ -455,7 +433,7 @@ def dbg(*args, **kwds):
 def stack(*args, **kwds):
     """
     Create a console window and show the current stack trace.
-    
+
     All arguments are passed to :func:`ConsoleWidget.__init__() <pyqtgraph.console.ConsoleWidget.__init__>`.
     """
     mkQApp()


Test patch: