This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author seberg
Recipients seberg
Date 2022-01-21.05:05:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642741515.93.0.0483052867584.issue46451@roundup.psfhosted.org>
In-reply-to
Content
Ahh, a further data-point.  The name from the module scope that is overwritten IS a parameter name used in the function locals.  Strangly, if I modify the tracing to print more:

stop = 0
def trace(frame, event, arg):
    global stop
    if stop > 10:
        return None

    if np.core.numeric.dtype is not np.dtype:
        #print("Something happened here, `np.core.numeric.dtype IS np.dtype`")
        print(np.core.numeric.dtype)
        print(frame, event, arg)
        stop += 1
    else:
        print(frame, event, arg)

    return trace

Then what I get is:

None
<frame at 0x7faa254396c0, file '/home/sebastian/forks/numpy/build/testenv/lib/python3.10/site-packages/numpy/core/numeric.py', line 289, code full> call None
None
<frame at 0x7faa254396c0, file '/home/sebastian/forks/numpy/build/testenv/lib/python3.10/site-packages/numpy/core/numeric.py', line 337, code full> line None
None
<frame at 0x7faa254396c0, file '/home/sebastian/forks/numpy/build/testenv/lib/python3.10/site-packages/numpy/core/numeric.py', line 340, code full> line None
None
<frame at 0x7faa254396c0, file '/home/sebastian/forks/numpy/build/testenv/lib/python3.10/site-packages/numpy/core/numeric.py', line 341, code full> line None
None
<frame at 0x7faa254396c0, file '/home/sebastian/forks/numpy/build/testenv/lib/python3.10/site-packages/numpy/core/numeric.py', line 342, code full> line None
bool


So, upon entering the function, the value is (already) cleared/set to None (which is correct of course for `dtype=None`) and then while the function runs storing into the function locals _mutates_ the module global?

For the fact that it keeps changing during the function run, points very strongly at CPython?
History
Date User Action Args
2022-01-21 05:05:15sebergsetrecipients: + seberg
2022-01-21 05:05:15sebergsetmessageid: <1642741515.93.0.0483052867584.issue46451@roundup.psfhosted.org>
2022-01-21 05:05:15seberglinkissue46451 messages
2022-01-21 05:05:15sebergcreate