Skip to content

Conversation

@sergey-miryanov
Copy link
Contributor

@sergey-miryanov sergey-miryanov commented Oct 27, 2025

There is a missing check for the namespace.

@sergey-miryanov sergey-miryanov added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Oct 27, 2025
@sergey-miryanov sergey-miryanov marked this pull request as ready for review October 27, 2025 13:30
@sergey-miryanov
Copy link
Contributor Author

It is ready for review, could you please take a look.

@sergey-miryanov
Copy link
Contributor Author

Python version has this check already, but C version missing it:

        if (not callable(func) or not isinstance(args, tuple) or
           (kwds is not None and not isinstance(kwds, dict)) or
           (namespace is not None and not isinstance(namespace, dict))):
            raise TypeError("invalid partial state")

Copy link
Member

@efimov-mikhail efimov-mikhail left a comment

Choose a reason for hiding this comment

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

LGTM, I have just one comment on the style.

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
@encukou encukou merged commit d26686a into python:main Oct 28, 2025
53 checks passed
@miss-islington-app
Copy link

Thanks @sergey-miryanov for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 28, 2025
…H-140671)

(cherry picked from commit d26686a)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 28, 2025
…H-140671)

(cherry picked from commit d26686a)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Oct 28, 2025

GH-140698 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Oct 28, 2025
@bedevere-app
Copy link

bedevere-app bot commented Oct 28, 2025

GH-140699 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 Oct 28, 2025
kumaraditya303 pushed a commit that referenced this pull request Oct 28, 2025
) (#140699)

GH-140590: Fix setstate for functools.partial C-module (GH-140671)

(cherry picked from commit d26686a)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
kumaraditya303 pushed a commit that referenced this pull request Oct 28, 2025
) (#140698)

GH-140590: Fix setstate for functools.partial C-module (GH-140671)

(cherry picked from commit d26686a)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
@bedevere-bot
Copy link

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

Hi! The buildbot ARM64 macOS 3.13 (tier-2) has failed when building commit bec053c.

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/1404/builds/1360) and take a look at the build logs.
  4. Check if the failure is related to this commit (bec053c) 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/1404/builds/1360

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/contextlib.py", line 136, in __enter__
    def __enter__(self):
ResourceWarning: unclosed <socket.socket fd=6, family=2, type=1, proto=6, laddr=('192.168.0.101', 56972), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 56980), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/contextlib.py", line 136, in __enter__
    def __enter__(self):
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 56980), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 56986), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/contextlib.py", line 136, in __enter__
    def __enter__(self):
ResourceWarning: unclosed <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 56986), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=6, family=2, type=1, proto=6, laddr=('192.168.0.101', 56988), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=6, family=2, type=1, proto=6, laddr=('192.168.0.101', 56988), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 56990), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 56990), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 57016), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 57018), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 57018), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=6, family=2, type=1, proto=6, laddr=('192.168.0.101', 56968), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 56970), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 56970), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('192.168.0.101', 57029), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=10, family=2, type=1, proto=6, laddr=('192.168.0.101', 57031), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=10, family=2, type=1, proto=6, laddr=('192.168.0.101', 57031), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 56982), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=9, family=2, type=1, proto=6, laddr=('192.168.0.101', 56984), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('192.168.0.101', 56984), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 57023), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=9, family=2, type=1, proto=6, laddr=('192.168.0.101', 57025), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('192.168.0.101', 57025), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/test/support/__init__.py", line 845, in gc_collect
    gc.collect()
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 57040), raddr=('68.183.26.59', 21)>


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/test/support/socket_helper.py", line 225, in transient_internet
    captured_errnos = [getattr(errno, name, num)
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 57020), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 57027), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/test/support/socket_helper.py", line 225, in transient_internet
    captured_errnos = [getattr(errno, name, num)
ResourceWarning: unclosed <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 57027), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=9, family=2, type=1, proto=6, laddr=('192.168.0.101', 57033), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/test/support/socket_helper.py", line 225, in transient_internet
    captured_errnos = [getattr(errno, name, num)
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('192.168.0.101', 57033), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 57036), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 57036), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 57038), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 57038), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/test/support/__init__.py", line 845, in gc_collect
    gc.collect()
ResourceWarning: unclosed <socket.socket fd=6, family=2, type=1, proto=6, laddr=('192.168.0.101', 56992), raddr=('68.183.26.59', 21)>


Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=7, family=2, type=1, proto=6, laddr=('192.168.0.101', 56976), raddr=('68.183.26.59', 21)>
Warning -- Unraisable exception
Exception ignored in: <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 56978), raddr=('68.183.26.59', 21)>
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.13.pablogsal-macos-m1.macos-with-brew/build/Lib/socket.py", line 790, in close
    self._sock = None
ResourceWarning: unclosed <socket.socket fd=8, family=2, type=1, proto=6, laddr=('192.168.0.101', 56978), raddr=('68.183.26.59', 21)>
skipped "Resource 'ftp://www.pythontest.net/' is not available"

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.

5 participants