Skip to content

gh-155496: Use Argument Clinic for the getpath module - #158132

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:getpath-clinic
Sep 27, 2026
Merged

serhiy-storchaka merged 3 commits into
python:mainfrom
serhiy-storchaka:getpath-clinic

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Convert the 11 helper functions of the internal getpath module (abspath, basename, dirname, hassuffix, isabs, isdir, isfile, isxfile, joinpath, readlines, realpath) from PyArg_ParseTuple() to Argument Clinic, so they use the METH_FASTCALL or METH_O calling convention and the argument types are checked by the generated code.

Argument Clinic now converts the path argument of abspath(), isabs() and
isdir() to a wide character string, and isabs() and isdir() use the bool
return converter.
hassuffix(), isfile() and isxfile() now use the bool return converter,
as isabs() and isdir() already did.

This also fixes a use after free in isxfile() on Windows: the path was
freed before being passed to CompareStringOrdinal().
@serhiy-storchaka
serhiy-storchaka merged commit 964535a into python:main Sep 27, 2026
52 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the getpath-clinic branch September 27, 2026 15:56
@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot s390x Fedora Stable 3.x (tier-3) has failed when building commit 964535a.

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

Failed tests:

  • test_dtrace

Failed subtests:

  • test_function_entry_return - test.test_dtrace.SystemTapOptimizedTests.test_function_entry_return
  • test_function_entry_return - test.test_dtrace.SystemTapNormalTests.test_function_entry_return

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-fedora-stable-s390x/3.x.cstratak-fedora-stable-s390x/build/Lib/test/test_dtrace.py", line 466, in test_function_entry_return
    self.run_case("call_stack")
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-fedora-stable-s390x/3.x.cstratak-fedora-stable-s390x/build/Lib/test/test_dtrace.py", line 463, in run_case
    self.assertEqual(actual_output, expected_output)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'func[21 chars]k.py:function_1:1\nfunction__entry:call_stack.[642 chars]5:21' != 'func[21 chars]k.py:start:23\nfunction__entry:call_stack.py:f[723 chars]t:28'
+ function__entry:call_stack.py:start:23
  function__entry:call_stack.py:function_1:1
  function__entry:call_stack.py:function_3:9
  function__return:call_stack.py:function_3:10
  function__return:call_stack.py:function_1:2
  function__entry:call_stack.py:function_2:5
  function__entry:call_stack.py:function_1:1
  function__entry:call_stack.py:function_3:9
  function__return:call_stack.py:function_3:10
  function__return:call_stack.py:function_1:2
  function__return:call_stack.py:function_2:6
  function__entry:call_stack.py:function_3:9
  function__return:call_stack.py:function_3:10
  function__entry:call_stack.py:function_4:13
  function__return:call_stack.py:function_4:14
  function__entry:call_stack.py:function_5:18
  function__return:call_stack.py:function_5:21
+ function__return:call_stack.py:start:28

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.

2 participants