Skip to content

GH-120097: Make FrameLocalsProxy a mapping #120101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2024

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Jun 5, 2024

@markshannon markshannon requested a review from rhettinger as a code owner June 5, 2024 09:35
@markshannon markshannon changed the title GH-120097: Make locals proxy mapping GH-120097: Make FrameLocalsProxy a mapping Jun 5, 2024
@@ -420,6 +421,17 @@ def test_unsupport(self):
with self.assertRaises(TypeError):
copy.deepcopy(d)

def test_is_mapping(self):
x = 1
Copy link
Member

@sobolevn sobolevn Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need x? To fill f_locals? In this case I propose to use a inner function. Or maybe two: with and without locals.

Copy link
Member Author

@markshannon markshannon Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contents are irrelevant, but we want something just to make sure we are testing the right thing.
Without x = 1, the locals would just be {} and it would be too easy to mistakenly test the wrong mapping.

Co-authored-by: Nikita Sobolev <[email protected]>
@gaogaotiantian
Copy link
Member

Is the test failure related?

@markshannon markshannon merged commit d1c673b into python:main Jun 19, 2024
38 checks passed
@AlexWaygood AlexWaygood added the needs backport to 3.13 bugs and security fixes label Jun 19, 2024
@miss-islington-app
Copy link

Thanks @markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 19, 2024
* Register FrameLocalsProxy as a subclass of collections.abc.Mapping

* Allow FrameLocalsProxy to matching mapping patterns
(cherry picked from commit d1c673b)

Co-authored-by: Mark Shannon <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 19, 2024

GH-120749 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 19, 2024
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
* Register FrameLocalsProxy as a subclass of collections.abc.Mapping

* Allow FrameLocalsProxy to matching mapping patterns
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
* Register FrameLocalsProxy as a subclass of collections.abc.Mapping

* Allow FrameLocalsProxy to matching mapping patterns
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
* Register FrameLocalsProxy as a subclass of collections.abc.Mapping

* Allow FrameLocalsProxy to matching mapping patterns
@markshannon markshannon deleted the make-locals-proxy-mapping branch August 6, 2024 10:15
markshannon pushed a commit that referenced this pull request Aug 23, 2024
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot iOS ARM64 Simulator 3.13 has failed when building commit 95b4f9c.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1386/builds/503) and take a look at the build logs.
  4. Check if the failure is related to this commit (95b4f9c) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1386/builds/503

Failed tests:

  • test_socketserver

Failed subtests:

  • test_UnixDatagramServer - test.test_socketserver.SocketServerTest.test_UnixDatagramServer
  • test_ThreadingUnixDatagramServer - test.test_socketserver.SocketServerTest.test_ThreadingUnixDatagramServer

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 694, in process_request_thread
    self.handle_error(request, client_address)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 692, in process_request_thread
    self.finish_request(request, client_address)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 362, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 763, in __init__
    self.finish()
    ~~~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 858, in finish
    self.socket.sendto(self.wfile.getvalue(), self.client_address)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 54] Connection reset by peer
Warning -- threading_cleanup() failed to clean up threads in 1.0 seconds
Warning --   before: thread count=0, dangling=1
Warning --   after: thread count=1, dangling=4
Warning -- Dangling thread: <_MainThread(MainThread, started 4366598720)>
Warning -- Dangling thread: <Thread(Thread-2873 (process_request_thread), stopped 6137769984)>
Warning -- Dangling thread: <Thread(<class 'socketserver.ThreadingUnixDatagramServer'> serving, started daemon 6120943616)>
Warning -- Dangling thread: <Thread(Thread-2874 (process_request_thread), stopped 6154596352)>
ERROR


Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 228, in test_ThreadingUnixDatagramServer
    self.run_server(socketserver.ThreadingUnixDatagramServer,
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    socketserver.DatagramRequestHandler,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    self.dgram_examine)
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/support/threading_helper.py", line 66, in decorator
    return func(*args)
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 133, in run_server
    testfunc(svrcls.address_family, addr)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 160, in dgram_examine
    buf = data = receive(s, 100)
                 ~~~~~~~^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 43, in receive
    raise RuntimeError("timed out on %r" % (sock,))
RuntimeError: timed out on <socket.socket fd=33, family=1, type=2, proto=0, laddr=./test_python__imgs0_7.sock>


Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 240, in serve_forever
    self._handle_request_noblock()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 320, in _handle_request_noblock
    self.handle_error(request, client_address)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 318, in _handle_request_noblock
    self.process_request(request, client_address)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 349, in process_request
    self.finish_request(request, client_address)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 362, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 763, in __init__
    self.finish()
    ~~~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/socketserver.py", line 858, in finish
    self.socket.sendto(self.wfile.getvalue(), self.client_address)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 54] Connection reset by peer
ERROR


Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 222, in test_UnixDatagramServer
    self.run_server(socketserver.UnixDatagramServer,
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    socketserver.DatagramRequestHandler,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    self.dgram_examine)
                    ^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/support/threading_helper.py", line 66, in decorator
    return func(*args)
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 133, in run_server
    testfunc(svrcls.address_family, addr)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 160, in dgram_examine
    buf = data = receive(s, 100)
                 ~~~~~~~^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/F4BBB41D-5207-4016-951B-2DC02AC8DD0F/data/Containers/Bundle/Application/150C37C0-A406-4BC6-B95F-53E7B448E825/iOSTestbed.app/python/lib/python3.13/test/test_socketserver.py", line 43, in receive
    raise RuntimeError("timed out on %r" % (sock,))
RuntimeError: timed out on <socket.socket fd=34, family=1, type=2, proto=0, laddr=./test_python_sow1nfse.sock>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants