Skip to content

gh-120526: Correct signature of map builtin#120528

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
AdamWill:correct-map-signature
Jun 15, 2024
Merged

gh-120526: Correct signature of map builtin#120528
serhiy-storchaka merged 1 commit into
python:mainfrom
AdamWill:correct-map-signature

Conversation

@AdamWill

@AdamWill AdamWill commented Jun 14, 2024

Copy link
Copy Markdown
Contributor

map requires at least one iterable arg. If you just do map(map) you get an error "map() must have at least two arguments." This corrects the signature to reflect this, in line with how it's shown in https://docs.python.org/3/library/functions.html#map .

@ghost

ghost commented Jun 14, 2024

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app

bedevere-app Bot commented Jun 14, 2024

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app

bedevere-app Bot commented Jun 14, 2024

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

map requires at least one iterable arg. If you just do `map(map)`
you get an error "map() must have at least two arguments." This
corrects the signature to reflect this, in line with how it's
shown in https://docs.python.org/3/library/functions.html#map .

Signed-off-by: Adam Williamson <awilliam@redhat.com>
@AdamWill AdamWill force-pushed the correct-map-signature branch from fd2b592 to 77089f2 Compare June 14, 2024 22:08
@bedevere-app

bedevere-app Bot commented Jun 14, 2024

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@serhiy-storchaka serhiy-storchaka 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.

LGTM.

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) June 15, 2024 05:32
@serhiy-storchaka serhiy-storchaka merged commit d4039d3 into python:main Jun 15, 2024
@miss-islington-app

Copy link
Copy Markdown

Thanks @AdamWill for the PR, and @serhiy-storchaka for merging it 🌮🎉.. 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 15, 2024
map() requires at least one iterable arg.

(cherry picked from commit d4039d3)

Co-authored-by: Adam Williamson <adam@blueradius.ca>
Signed-off-by: Adam Williamson <awilliam@redhat.com>
@bedevere-app

bedevere-app Bot commented Jun 15, 2024

Copy link
Copy Markdown

GH-120539 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 15, 2024
serhiy-storchaka pushed a commit that referenced this pull request Jun 15, 2024
…120539)

map() requires at least one iterable arg.

(cherry picked from commit d4039d3)

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Co-authored-by: Adam Williamson <adam@blueradius.ca>
@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot AMD64 Fedora Stable Clang Installed 3.x has failed when building commit d4039d3.

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/all/#builders/350/builds/6135) and take a look at the build logs.
  4. Check if the failure is related to this commit (d4039d3) 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/all/#builders/350/builds/6135

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

Click to see traceback logs
remote: Enumerating objects: 4, done.        
remote: Counting objects:  25% (1/4)        
remote: Counting objects:  50% (2/4)        
remote: Counting objects:  75% (3/4)        
remote: Counting objects: 100% (4/4)        
remote: Counting objects: 100% (4/4), done.        
remote: Compressing objects:  33% (1/3)        
remote: Compressing objects:  66% (2/3)        
remote: Compressing objects: 100% (3/3)        
remote: Compressing objects: 100% (3/3), done.        
remote: Total 4 (delta 1), reused 1 (delta 1), pack-reused 0        
From https://github.com/python/cpython
 * branch                  main       -> FETCH_HEAD
Note: switching to 'd4039d3f6f8cb7738c5cd272dde04171446dfd2b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at d4039d3f6f gh-120526: Correct signature of map() builtin (GH-120528)
Switched to and reset branch 'main'

configure: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)

Python/import.c:1555:1: warning: unused function 'is_core_module' [-Wunused-function]
 1555 | is_core_module(PyInterpreterState *interp, PyObject *name, PyObject *path)
      | ^~~~~~~~~~~~~~
1 warning generated.
Python/pystate.c:1135:1: warning: unused function 'check_interpreter_whence' [-Wunused-function]
 1135 | check_interpreter_whence(long whence)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
             ~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__init__.py", line 257, in _main
    return _bootstrap(
        root=args.root,
    ...<4 lines>...
        default_pip=args.default_pip,
    )
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__init__.py", line 172, in _bootstrap
    return _run_pip([*args, "pip"], [os.fsdecode(tmp_wheel_path)])
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__init__.py", line 87, in _run_pip
    return subprocess.run(cmd, check=True).returncode
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.clang-installed/build/python', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmp9_2n5m4z/pip-24.0-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmp9_2n5m4z\', \'--root\', \'/\', \'--upgrade\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:2282: install] Error 1

@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot AMD64 Windows11 Bigmem 3.x has failed when building commit d4039d3.

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/all/#builders/1079/builds/4229) and take a look at the build logs.
  4. Check if the failure is related to this commit (d4039d3) 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/all/#builders/1079/builds/4229

Failed tests:

  • test_repl

Failed subtests:

  • test_asyncio_repl_is_ok - test.test_repl.TestInteractiveInterpreter.test_asyncio_repl_is_ok

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\test_repl.py", line 199, in test_asyncio_repl_is_ok
    assert_python_ok("-m", "asyncio")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\support\script_helper.py", line 180, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\support\script_helper.py", line 165, in _assert_python
    res.fail(cmd_line)
    ~~~~~~~~^^^^^^^^^^
  File "R:\buildarea\3.x.ambv-bb-win11.bigmem\build\Lib\test\support\script_helper.py", line 75, in fail
    raise AssertionError("Process return code is %d\n"
    ...<13 lines>...
                            err))
AssertionError: Process return code is 2147483651
command line: ['R:\\buildarea\\3.x.ambv-bb-win11.bigmem\\build\\PCbuild\\amd64\\python_d.exe', '-X', 'faulthandler', '-I', '-m', 'asyncio']

@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot AMD64 Fedora Stable Clang Installed 3.13 has failed when building commit 9f0269d.

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/all/#builders/1493/builds/120) and take a look at the build logs.
  4. Check if the failure is related to this commit (9f0269d) 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/all/#builders/1493/builds/120

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

Click to see traceback logs
remote: Enumerating objects: 4, done.        
remote: Counting objects:  25% (1/4)        
remote: Counting objects:  50% (2/4)        
remote: Counting objects:  75% (3/4)        
remote: Counting objects: 100% (4/4)        
remote: Counting objects: 100% (4/4), done.        
remote: Compressing objects:  25% (1/4)        
remote: Compressing objects:  50% (2/4)        
remote: Compressing objects:  75% (3/4)        
remote: Compressing objects: 100% (4/4)        
remote: Compressing objects: 100% (4/4), done.        
remote: Total 4 (delta 0), reused 3 (delta 0), pack-reused 0        
From https://github.com/python/cpython
 * branch                  3.13       -> FETCH_HEAD
Note: switching to '9f0269d6aed1b61996b95dc0730a4008de012011'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 9f0269d6ae [3.13] gh-120526: Correct signature of map() builtin (GH-120528) (GH-120539)
Switched to and reset branch '3.13'

configure: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)

Python/import.c:1555:1: warning: unused function 'is_core_module' [-Wunused-function]
 1555 | is_core_module(PyInterpreterState *interp, PyObject *name, PyObject *path)
      | ^~~~~~~~~~~~~~
1 warning generated.
Python/pystate.c:1135:1: warning: unused function 'check_interpreter_whence' [-Wunused-function]
 1135 | check_interpreter_whence(long whence)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

make: [Makefile:2656: libinstall] Error 1 (ignored)
ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device: '/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.clang-installed/build/target/lib/python3.13/site-packages/pip'

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
             ~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__init__.py", line 257, in _main
    return _bootstrap(
        root=args.root,
    ...<4 lines>...
        default_pip=args.default_pip,
    )
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__init__.py", line 172, in _bootstrap
    return _run_pip([*args, "pip"], [os.fsdecode(tmp_wheel_path)])
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/ensurepip/__init__.py", line 87, in _run_pip
    return subprocess.run(cmd, check=True).returncode
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.clang-installed/build/Lib/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/home/buildbot/buildarea/3.13.cstratak-fedora-stable-x86_64.clang-installed/build/python', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpy4y9osax/pip-24.0-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpy4y9osax\', \'--root\', \'/\', \'--upgrade\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:2280: install] Error 1

mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
map() requires at least one iterable arg.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
map() requires at least one iterable arg.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
map() requires at least one iterable arg.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants