<p dir="auto"><a href="https://twisted.readthedocs.io/en/latest/core/howto/defer-intro.html#inline-callbacks-using-yield" rel="nofollow">https://twisted.readthedocs.io/en/latest/core/howto/defer-intro.html#inline-callbacks-using-yield</a> says "On Python 3, instead of writing returnValue(json.loads(responseBody)) you can instead write return json.loads(responseBody). This can be a significant readability advantage, but unfortunately if you need compatibility with Python 2, this isn’t an option.".</p>
<p dir="auto">Reported by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/dangra/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/dangra">@dangra</a></p>
<p dir="auto">This issue manifests when mixing old paths and new ones for extensions and middlewares (this can happen for example while using a newer version of Scrapy in a project that hasn't updated to the new paths yet). Since paths aren't normalized, the same component can be loaded twice.</p>
<p dir="auto">Take these settings for example:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# scrapy/settings/default_settings.py
EXTENSIONS_BASE = {
    'scrapy.extensions.debug.StackTraceDump': 100,  # new path
} "><pre class="notranslate"><span class="pl-c"># scrapy/settings/default_settings.py</span>
<span class="pl-v">EXTENSIONS_BASE</span> <span class="pl-c1">=</span> {
    <span class="pl-s">'scrapy.extensions.debug.StackTraceDump'</span>: <span class="pl-c1">100</span>,  <span class="pl-c"># new path</span>
} </pre></div>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# myproject/settings.py
EXTENSIONS = {
    'scrapy.contrib.debug.StackTraceDump': 200,  # old path
}"><pre class="notranslate"><span class="pl-c"># myproject/settings.py</span>
<span class="pl-v">EXTENSIONS</span> <span class="pl-c1">=</span> {
    <span class="pl-s">'scrapy.contrib.debug.StackTraceDump'</span>: <span class="pl-c1">200</span>,  <span class="pl-c"># old path</span>
}</pre></div>
<p dir="auto">While merging both dictionaries to build the list of components, the same StackTraceDump class is going to be loaded twice since it appears in two different keys.</p>