FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148829: Implement PEP 661 by JelleZijlstra · Pull Request #148831 · python/cpython · GitHub

Repository navigation

gh-148829: Implement PEP 661 - #148831

Merged
JelleZijlstra merged 21 commits into
python:mainfrom
JelleZijlstra:pep661
Apr 28, 2026
Merged

JelleZijlstra merged 21 commits into
python:mainfrom
JelleZijlstra:pep661

Conversation

JelleZijlstra commented Apr 21, 2026 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

Comment thread Objects/sentinelobject.c Outdated
Comment thread Lib/typing.py
Comment thread Objects/sentinelobject.c Outdated
Comment thread Objects/sentinelobject.c Outdated
Comment thread Objects/sentinelobject.c Outdated
Comment thread Objects/sentinelobject.c Outdated
Comment thread Objects/sentinelobject.c
Comment thread Objects/sentinelobject.c
Comment thread Objects/sentinelobject.c Outdated
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
JelleZijlstra added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 24, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @JelleZijlstra for commit 53a84b6 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F148831%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 24, 2026

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The C code and the corresponding documentation look good to me. I didn't look very closely at the tests.

Comment thread Objects/sentinelobject.c

sunmy2019 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

sunmy2019 left a comment •
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Clarify the pickle document. So that people will see X = sentinel("Y") is not picklable.

Comment thread Doc/c-api/sentinel.rst Outdated
Comment thread Doc/library/functions.rst Outdated

JelleZijlstra commented Apr 24, 2026 •
edited
Loading

Copy link
Copy Markdown
Member Author

Buildbot run: A few failures look unrelated

In file included from ./Include/internal/pycore_backoff.h:12,
                 from ./Include/internal/pycore_code.h:11,
                 from ./Include/internal/pycore_call.h:11,
                 from ./Modules/_ctypes/_ctypes.c:109:
./Modules/_ctypes/_ctypes.c: In function ‘set_stginfo_ffi_type_pointer’:
./Modules/_ctypes/_ctypes.c:2234:40: error: ‘FFI_TYPE_COMPLEX’ undeclared (first use in this function); did you mean ‘FFI_TYPE_DOUBLE’?
         assert(fmt->pffi_type->type == FFI_TYPE_COMPLEX);
                                        ^~~~~~~~~~~~~~~~
./Modules/_ctypes/_ctypes.c:2234:40: note: each undeclared identifier is reported only once for each function it appears in

But I also see

Traceback (most recent call last):
  File "/home/ubuntu/buildarea/pull_request.stan-aarch64-ubuntu.oddballs/build/Lib/test/pickletester.py", line 3254, in test_builtin_types
    s = self.dumps(t, proto)
  File "/home/ubuntu/buildarea/pull_request.stan-aarch64-ubuntu.oddballs/build/Lib/test/test_xpickle.py", line 190, in dumps
    return self.send_to_worker(python, data)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/home/ubuntu/buildarea/pull_request.stan-aarch64-ubuntu.oddballs/build/Lib/test/test_xpickle.py", line 172, in send_to_worker
    raise exception
AttributeError: Can't get attribute 'sentinel' on <module 'builtins' (built-in)>

https://buildbot.python.org/#/builders/1865/builds/54

Which is a bit mysterious, is this looking at the builtins of another build?

Copy link
Copy Markdown
Member

Which is a bit mysterious, is this looking at the builtins of another build?

Yes. We need to patch this test. It tests pickle compatiblity acrosses python versions.

./python -m test test_xpickle -m test_builtin_types -u xpickle

Copy link
Copy Markdown
Member
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 6366f12257..c2018c9785 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -3244,6 +3244,7 @@ def test_builtin_types(self):
             'BuiltinImporter': (3, 3),
             'str': (3, 4),  # not interoperable with Python < 3.4
             'frozendict': (3, 15),
+            'sentinel': (3, 15),
         }
         for t in builtins.__dict__.values():
             if isinstance(t, type) and not issubclass(t, BaseException):

Copy link
Copy Markdown
Member

Buildbot run: A few failures look unrelated

I opened #148967 to track it.

Comment thread Doc/c-api/sentinel.rst Outdated
Comment thread Doc/library/functions.rst Outdated
Comment thread Include/sentinelobject.h
Comment thread Makefile.pre.in
Comment thread Makefile.pre.in
Comment thread Objects/object.c Outdated
Comment thread Objects/sentinelobject.c Outdated
Comment thread Objects/sentinelobject.c
Comment thread Objects/sentinelobject.c Outdated

Copy link
Copy Markdown
Member Author

Thanks for the feedback! Pushed a new version.

Comment thread Lib/test/test_capi/test_object.py Outdated
Comment thread Doc/library/functions.rst
Comment thread Lib/test/test_builtin.py
Comment thread Lib/test/test_builtin.py
Comment thread Doc/library/functions.rst Outdated
JelleZijlstra added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 27, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @JelleZijlstra for commit 7c276c5 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F148831%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 27, 2026

Copy link
Copy Markdown
Member Author

Buildbot failures seem to be just the FFI_TYPE_COMPLEX thing on RHEL8.

JelleZijlstra merged commit 29a92ab into python:main Apr 28, 2026
107 of 117 checks passed

Copy link
Copy Markdown
Member

The Include/sentinelobject.h header file should be moved to Include/cpython/ since its C API is excluded from the limited C API. I created PR gh-149186 to move the header file.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

8 participants


Back | FazBrowse Home | New Git URL