<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">Running <code class="notranslate">numpy.test()</code> resulted in 2 failures.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__]
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__]"><pre class="notranslate"><code class="notranslate">FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__]
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__]
</code></pre></div>
<h3 dir="auto">Reproduce the code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
np.test()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-s1">np</span>.<span class="pl-en">test</span>()</pre></div>
<h3 dir="auto">Error message:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="NumPy version 1.21.4
NumPy relaxed strides checking option: True
NumPy CPU features:  SSE SSE2 SSE3 SSSE3* SSE41* POPCNT* SSE42* AVX* F16C* FMA3* AVX2* AVX512F* AVX512CD* AVX512_KNL? AVX512_KNM? AVX512_SKX* AVX512_CLX* AVX512_CNL? AVX512_ICL?
...
=================================== FAILURES ===================================
___________________ TestGenericAlias.test_getattr[__copy__] ____________________

self = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c02850&gt;
name = '__copy__'

    @pytest.mark.parametrize(&quot;name&quot;, GETATTR_NAMES)
    def test_getattr(self, name: str) -&gt; None:
        &quot;&quot;&quot;Test that `getattr` wraps around the underlying type,
        aka ``__origin__``.

        &quot;&quot;&quot;
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)

        if sys.version_info &gt;= (3, 9):
&gt;           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: 'types.GenericAlias' object has no attribute '__copy__'

name       = '__copy__'
self       = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c02850&gt;
value      = &lt;method '__copy__' of 'numpy.ndarray' objects&gt;
value_ref1 = &lt;method '__copy__' of 'numpy.ndarray' objects&gt;

../../python/gcc/3.9.9/lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
_________________ TestGenericAlias.test_getattr[__deepcopy__] __________________

self = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c10ca0&gt;
name = '__deepcopy__'

    @pytest.mark.parametrize(&quot;name&quot;, GETATTR_NAMES)
    def test_getattr(self, name: str) -&gt; None:
        &quot;&quot;&quot;Test that `getattr` wraps around the underlying type,
        aka ``__origin__``.

        &quot;&quot;&quot;
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)

        if sys.version_info &gt;= (3, 9):
&gt;           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'

name       = '__deepcopy__'
self       = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c10ca0&gt;
value      = &lt;method '__deepcopy__' of 'numpy.ndarray' objects&gt;
value_ref1 = &lt;method '__deepcopy__' of 'numpy.ndarray' objects&gt;

../../python/gcc/3.9.9/lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
=========================== short test summary info ============================
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__]
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__]
2 failed, 15549 passed, 60 skipped, 1253 deselected, 19 xfailed, 3 xpassed in 160.85s (0:02:40)"><pre class="notranslate"><code class="notranslate">NumPy version 1.21.4
NumPy relaxed strides checking option: True
NumPy CPU features:  SSE SSE2 SSE3 SSSE3* SSE41* POPCNT* SSE42* AVX* F16C* FMA3* AVX2* AVX512F* AVX512CD* AVX512_KNL? AVX512_KNM? AVX512_SKX* AVX512_CLX* AVX512_CNL? AVX512_ICL?
...
=================================== FAILURES ===================================
___________________ TestGenericAlias.test_getattr[__copy__] ____________________

self = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c02850&gt;
name = '__copy__'

    @pytest.mark.parametrize("name", GETATTR_NAMES)
    def test_getattr(self, name: str) -&gt; None:
        """Test that `getattr` wraps around the underlying type,
        aka ``__origin__``.

        """
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)

        if sys.version_info &gt;= (3, 9):
&gt;           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: 'types.GenericAlias' object has no attribute '__copy__'

name       = '__copy__'
self       = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c02850&gt;
value      = &lt;method '__copy__' of 'numpy.ndarray' objects&gt;
value_ref1 = &lt;method '__copy__' of 'numpy.ndarray' objects&gt;

../../python/gcc/3.9.9/lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
_________________ TestGenericAlias.test_getattr[__deepcopy__] __________________

self = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c10ca0&gt;
name = '__deepcopy__'

    @pytest.mark.parametrize("name", GETATTR_NAMES)
    def test_getattr(self, name: str) -&gt; None:
        """Test that `getattr` wraps around the underlying type,
        aka ``__origin__``.

        """
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)

        if sys.version_info &gt;= (3, 9):
&gt;           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'

name       = '__deepcopy__'
self       = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x155209c10ca0&gt;
value      = &lt;method '__deepcopy__' of 'numpy.ndarray' objects&gt;
value_ref1 = &lt;method '__deepcopy__' of 'numpy.ndarray' objects&gt;

../../python/gcc/3.9.9/lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
=========================== short test summary info ============================
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__]
FAILED typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__]
2 failed, 15549 passed, 60 skipped, 1253 deselected, 19 xfailed, 3 xpassed in 160.85s (0:02:40)
</code></pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<ul dir="auto">
<li>Python 3.9.9 (compiled with GCC 9.2, OpenBLAS 0.3.12)</li>
<li>numpy 1.21.4 built from source</li>
</ul>
<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">Running numpy.test() results in attribute error</p>
<h3 dir="auto">Reproduce the code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np

np.test()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">np</span>.<span class="pl-en">test</span>()</pre></div>
<h3 dir="auto">Error message:</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="============== FAILURES =====================================================================================================
_____________________________________________________________________________________ TestGenericAlias.test_getattr[__copy__] _____________________________________________________________________________________

self = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f47493442b0&gt;, name = '__copy__'

    @pytest.mark.parametrize(&quot;name&quot;, GETATTR_NAMES)
    def test_getattr(self, name: str) -&gt; None:
        &quot;&quot;&quot;Test that `getattr` wraps around the underlying type,
        aka ``__origin__``.
    
        &quot;&quot;&quot;
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)
    
        if sys.version_info &gt;= (3, 9):
&gt;           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: 'types.GenericAlias' object has no attribute '__copy__'

name       = '__copy__'
self       = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f47493442b0&gt;
value      = &lt;method '__copy__' of 'numpy.ndarray' objects&gt;
value_ref1 = &lt;method '__copy__' of 'numpy.ndarray' objects&gt;

lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
___________________________________________________________________________________ TestGenericAlias.test_getattr[__deepcopy__] ___________________________________________________________________________________

self = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f474935f340&gt;, name = '__deepcopy__'

    @pytest.mark.parametrize(&quot;name&quot;, GETATTR_NAMES)
    def test_getattr(self, name: str) -&gt; None:
        &quot;&quot;&quot;Test that `getattr` wraps around the underlying type,
        aka ``__origin__``.
    
        &quot;&quot;&quot;
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)
    
        if sys.version_info &gt;= (3, 9):
&gt;           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'

name       = '__deepcopy__'
self       = &lt;numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f474935f340&gt;
value      = &lt;method '__deepcopy__' of 'numpy.ndarray' objects&gt;
value_ref1 = &lt;method '__deepcopy__' of 'numpy.ndarray' objects&gt;

lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
============================================================================================= short test summary info =============================================================================================
FAILED lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__] - AttributeError: 'types.GenericAlias' object has no attribute '__copy__'
FAILED lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__] - AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'
2 failed, 14972 passed, 633 skipped, 1253 deselected, 19 xfailed, 3 xpassed in 137.21s (0:02:17)
False"><pre class="notranslate">============== FAILURES =====================================================================================================
_____________________________________________________________________________________ TestGenericAlias.test_getattr[__copy__] _____________________________________________________________________________________

self = <span class="pl-k">&lt;</span>numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f47493442b<span class="pl-k">0&gt;</span>, name = <span class="pl-s"><span class="pl-pds">'</span>__copy__<span class="pl-pds">'</span></span>

    @pytest.mark.parametrize(<span class="pl-s"><span class="pl-pds">"</span>name<span class="pl-pds">"</span></span>, GETATTR_NAMES)
    def test_getattr(self, name: str) -<span class="pl-k">&gt;</span> None:
        <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span><span class="pl-pds">"</span>Test that <span class="pl-s"><span class="pl-pds">`</span>getattr<span class="pl-pds">`</span></span> wraps around the underlying type,</span>
<span class="pl-s">        aka <span class="pl-s"><span class="pl-pds">`</span><span class="pl-pds">`</span></span>__origin__<span class="pl-s"><span class="pl-pds">`</span><span class="pl-pds">`</span></span>.</span>
<span class="pl-s">    </span>
<span class="pl-s">        <span class="pl-pds">"</span><span class="pl-pds">"</span><span class="pl-pds">"</span></span>
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)
    
        <span class="pl-k">if</span> sys.version_info <span class="pl-k">&gt;</span>= (3, 9):
<span class="pl-k">&gt;</span>           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: <span class="pl-s"><span class="pl-pds">'</span>types.GenericAlias<span class="pl-pds">'</span></span> object has no attribute <span class="pl-s"><span class="pl-pds">'</span>__copy__<span class="pl-pds">'</span></span>

name       = <span class="pl-s"><span class="pl-pds">'</span>__copy__<span class="pl-pds">'</span></span>
self       = <span class="pl-k">&lt;</span>numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f47493442b<span class="pl-k">0&gt;</span>
value      = <span class="pl-k">&lt;</span>method <span class="pl-s"><span class="pl-pds">'</span>__copy__<span class="pl-pds">'</span></span> of <span class="pl-s"><span class="pl-pds">'</span>numpy.ndarray<span class="pl-pds">'</span></span> objects<span class="pl-k">&gt;</span>
value_ref1 = <span class="pl-k">&lt;</span>method <span class="pl-s"><span class="pl-pds">'</span>__copy__<span class="pl-pds">'</span></span> of <span class="pl-s"><span class="pl-pds">'</span>numpy.ndarray<span class="pl-pds">'</span></span> objects<span class="pl-k">&gt;</span>

lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
___________________________________________________________________________________ TestGenericAlias.test_getattr[__deepcopy__] ___________________________________________________________________________________

self = <span class="pl-k">&lt;</span>numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f474935f<span class="pl-k">340&gt;</span>, name = <span class="pl-s"><span class="pl-pds">'</span>__deepcopy__<span class="pl-pds">'</span></span>

    @pytest.mark.parametrize(<span class="pl-s"><span class="pl-pds">"</span>name<span class="pl-pds">"</span></span>, GETATTR_NAMES)
    def test_getattr(self, name: str) -<span class="pl-k">&gt;</span> None:
        <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span><span class="pl-pds">"</span>Test that <span class="pl-s"><span class="pl-pds">`</span>getattr<span class="pl-pds">`</span></span> wraps around the underlying type,</span>
<span class="pl-s">        aka <span class="pl-s"><span class="pl-pds">`</span><span class="pl-pds">`</span></span>__origin__<span class="pl-s"><span class="pl-pds">`</span><span class="pl-pds">`</span></span>.</span>
<span class="pl-s">    </span>
<span class="pl-s">        <span class="pl-pds">"</span><span class="pl-pds">"</span><span class="pl-pds">"</span></span>
        value = getattr(NDArray, name)
        value_ref1 = getattr(np.ndarray, name)
    
        <span class="pl-k">if</span> sys.version_info <span class="pl-k">&gt;</span>= (3, 9):
<span class="pl-k">&gt;</span>           value_ref2 = getattr(NDArray_ref, name)
E           AttributeError: <span class="pl-s"><span class="pl-pds">'</span>types.GenericAlias<span class="pl-pds">'</span></span> object has no attribute <span class="pl-s"><span class="pl-pds">'</span>__deepcopy__<span class="pl-pds">'</span></span>

name       = <span class="pl-s"><span class="pl-pds">'</span>__deepcopy__<span class="pl-pds">'</span></span>
self       = <span class="pl-k">&lt;</span>numpy.typing.tests.test_generic_alias.TestGenericAlias object at 0x7f474935f<span class="pl-k">340&gt;</span>
value      = <span class="pl-k">&lt;</span>method <span class="pl-s"><span class="pl-pds">'</span>__deepcopy__<span class="pl-pds">'</span></span> of <span class="pl-s"><span class="pl-pds">'</span>numpy.ndarray<span class="pl-pds">'</span></span> objects<span class="pl-k">&gt;</span>
value_ref1 = <span class="pl-k">&lt;</span>method <span class="pl-s"><span class="pl-pds">'</span>__deepcopy__<span class="pl-pds">'</span></span> of <span class="pl-s"><span class="pl-pds">'</span>numpy.ndarray<span class="pl-pds">'</span></span> objects<span class="pl-k">&gt;</span>

lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py:95: AttributeError
============================================================================================= short <span class="pl-c1">test</span> summary info =============================================================================================
FAILED lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__copy__] - AttributeError: <span class="pl-s"><span class="pl-pds">'</span>types.GenericAlias<span class="pl-pds">'</span></span> object has no attribute <span class="pl-s"><span class="pl-pds">'</span>__copy__<span class="pl-pds">'</span></span>
FAILED lib/python3.9/site-packages/numpy/typing/tests/test_generic_alias.py::TestGenericAlias::test_getattr[__deepcopy__] - AttributeError: <span class="pl-s"><span class="pl-pds">'</span>types.GenericAlias<span class="pl-pds">'</span></span> object has no attribute <span class="pl-s"><span class="pl-pds">'</span>__deepcopy__<span class="pl-pds">'</span></span>
2 failed, 14972 passed, 633 skipped, 1253 deselected, 19 xfailed, 3 xpassed <span class="pl-k">in</span> 137.21s (0:02:17)
False</pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<p dir="auto">numpy 1.21.4 and 1.21.2 (didn't test numpy 1.21.3)<br>
python 3.9.9</p>
<p dir="auto">tests for the same versions of numpy did not return any error for python 3.9.7</p>
<p dir="auto">OS Ubuntu 20.04, pythons and numpy compiled from source</p>