← 返回首页
GH-101362: Call join() only when >1 argument supplied to pathlib.PurePath() by barneygale · Pull Request #101665 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

GH-101362: Call join() only when >1 argument supplied to pathlib.PurePath()#101665

Merged
AlexWaygood merged 1 commit into
python:mainfrom
barneygale:gh-101362-purepath-stop-joining-one-arg
Mar 5, 2023
Merged

GH-101362: Call join() only when >1 argument supplied to pathlib.PurePath()#101665
AlexWaygood merged 1 commit into
python:mainfrom
barneygale:gh-101362-purepath-stop-joining-one-arg

Conversation

barneygale commented Feb 7, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

This reduces the time taken to run PurePath("foo") by ~15%

…b.PurePath This reduces the time taken to run `PurePath("foo")` by ~15%

hauntsaninja left a comment

Copy link
Copy Markdown
Contributor

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 Hide comment

Looks great! (By far the majority of Paths in the codebases I work on are constructed with a single argument)

AlexWaygood 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 Hide comment

Fantastic work @barneygale! Sorry for the delay on this

AlexWaygood added the performance Performance or resource usage label Mar 5, 2023
AlexWaygood merged commit 3572c86 into python:main Mar 5, 2023

Copy link
Copy Markdown
Contributor Author

Thanks so much, both! :D

Copy link
Copy Markdown

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

Hi! The buildbot s390x SLES 3.x has failed when building commit 3572c86.

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

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

== Tests result: ENV CHANGED ==

415 tests OK.

10 slowest tests:

  • test_tools: 3 min 6 sec
  • test_concurrent_futures: 2 min 32 sec
  • test_multiprocessing_spawn: 2 min 5 sec
  • test_asyncio: 1 min 44 sec
  • test_math: 1 min 30 sec
  • test_multiprocessing_forkserver: 1 min 26 sec
  • test_multiprocessing_fork: 1 min 15 sec
  • test_signal: 1 min 13 sec
  • test_capi: 1 min 5 sec
  • test_gdb: 1 min 2 sec

1 test altered the execution environment:
test_asyncio

18 tests skipped:
test_check_c_globals test_devpoll test_ioctl test_kqueue
test_launcher test_msilib test_nis test_peg_generator
test_perf_profiler test_startfile test_tix test_tkinter test_ttk
test_winconsoleio test_winreg test_winsound test_wmi
test_zipfile64

Total duration: 6 min 9 sec

Click to see traceback logs
remote: Enumerating objects: 9, done. remote: Counting objects: 12% (1/8) remote: Counting objects: 25% (2/8) remote: Counting objects: 37% (3/8) remote: Counting objects: 50% (4/8) remote: Counting objects: 62% (5/8) remote: Counting objects: 75% (6/8) remote: Counting objects: 87% (7/8) remote: Counting objects: 100% (8/8) remote: Counting objects: 100% (8/8), done. remote: Compressing objects: 16% (1/6) remote: Compressing objects: 33% (2/6) remote: Compressing objects: 50% (3/6) remote: Compressing objects: 66% (4/6) remote: Compressing objects: 83% (5/6) remote: Compressing objects: 100% (6/6) remote: Compressing objects: 100% (6/6), done. remote: Total 9 (delta 2), reused 2 (delta 2), pack-reused 1 From https://github.com/python/cpython * branch main -> FETCH_HEAD Note: switching to '3572c861d8e8f03c34793608e7e2221e116aaec0'. 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 3572c861d8 GH-101362: Call join() only when >1 argument supplied to pathlib.PurePath() (#101665) Switched to and reset branch 'main' make: *** [Makefile:1938: buildbottest] Error 3

Copy link
Copy Markdown
Member

Hi! The buildbot s390x SLES 3.x has failed when building commit 3572c86.

From the logs, it looks like this is just test_asyncio being flaky again. Nothing for us to worry about, I don't think :)

hugovk pushed a commit to hugovk/cpython that referenced this pull request Mar 6, 2023
…b.PurePath() (python#101665) pythonGH-101362: Call join() only when >1 argument supplied to pathlib.PurePath This reduces the time taken to run `PurePath("foo")` by ~15%
carljm added a commit to carljm/cpython that referenced this pull request Mar 6, 2023
* main: (21 commits) pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in sub interpreters module (python#102472) pythongh-95672: Fix versionadded indentation of get_pagesize in test.rst (pythongh-102455) pythongh-102416: Do not memoize incorrectly loop rules in the parser (python#102467) pythonGH-101362: Optimise PurePath(PurePath(...)) (pythonGH-101667) pythonGH-101362: Check pathlib.Path flavour compatibility at import time (pythonGH-101664) pythonGH-101362: Call join() only when >1 argument supplied to pathlib.PurePath() (python#101665) pythongh-102444: Fix minor bugs in `test_typing` highlighted by pyflakes (python#102445) pythonGH-102341: Improve the test function for pow (python#102342) Fix unused classes in a typing test (pythonGH-102437) pythongh-101979: argparse: fix a bug where parentheses in metavar argument of add_argument() were dropped (python#102318) pythongh-102356: Add thrashcan macros to filter object dealloc (python#102426) Move around example in to_bytes() to avoid confusion (python#101595) pythonGH-97546: fix flaky asyncio `test_wait_for_race_condition` test (python#102421) pythongh-96821: Add config option `--with-strict-overflow` (python#96823) pythongh-101992: update pstlib module documentation (python#102133) pythongh-63301: Set exit code when tabnanny CLI exits on error (python#7699) pythongh-101863: Fix wrong comments in EUC-KR codec (pythongh-102417) pythongh-102302 Micro-optimize `inspect.Parameter.__hash__` (python#102303) pythongh-102179: Fix `os.dup2` error reporting for negative fds (python#102180) pythongh-101892: Fix `SystemError` when a callable iterator call exhausts the iterator (python#101896) ...
carljm added a commit to carljm/cpython that referenced this pull request Mar 7, 2023
* main: (37 commits) pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in sub interpreters module (python#102472) pythongh-95672: Fix versionadded indentation of get_pagesize in test.rst (pythongh-102455) pythongh-102416: Do not memoize incorrectly loop rules in the parser (python#102467) pythonGH-101362: Optimise PurePath(PurePath(...)) (pythonGH-101667) pythonGH-101362: Check pathlib.Path flavour compatibility at import time (pythonGH-101664) pythonGH-101362: Call join() only when >1 argument supplied to pathlib.PurePath() (python#101665) pythongh-102444: Fix minor bugs in `test_typing` highlighted by pyflakes (python#102445) pythonGH-102341: Improve the test function for pow (python#102342) Fix unused classes in a typing test (pythonGH-102437) pythongh-101979: argparse: fix a bug where parentheses in metavar argument of add_argument() were dropped (python#102318) pythongh-102356: Add thrashcan macros to filter object dealloc (python#102426) Move around example in to_bytes() to avoid confusion (python#101595) pythonGH-97546: fix flaky asyncio `test_wait_for_race_condition` test (python#102421) pythongh-96821: Add config option `--with-strict-overflow` (python#96823) pythongh-101992: update pstlib module documentation (python#102133) pythongh-63301: Set exit code when tabnanny CLI exits on error (python#7699) pythongh-101863: Fix wrong comments in EUC-KR codec (pythongh-102417) pythongh-102302 Micro-optimize `inspect.Parameter.__hash__` (python#102303) pythongh-102179: Fix `os.dup2` error reporting for negative fds (python#102180) pythongh-101892: Fix `SystemError` when a callable iterator call exhausts the iterator (python#101896) ...
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

performance Performance or resource usage topic-pathlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.