GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-109590: Fix incorrect resolution of paths without extensions in shutil.which on win32. by csm10495 · Pull Request #109797 · python/cpython

Conversation

@csm10495

@csm10495 csm10495 commented Sep 24, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Implement the change described in #109590.

Without this:

shutil.which('npm')

Can resolve a file named npm. (I thought): To match Windows CMD, it should only try that if a '.' is one of the PATHEXT

While here also fix up the test cases to make better use of the bytes vs str for testing.

  • Issue: On Windows, shutil.which incorrectly resolves to non-executable extensionless files (python >= 3.12.0b1) #109590

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@csm10495
pythongh-109590 - Fix shutil.which to more closely match CMD on win32
41cb299
An extensionless file will on be attempted if '.' is in PATHEXT

Fix up the tests to make better use of the bytes testing of shutil.which
@bedevere-app bedevere-app Bot mentioned this pull request Sep 24, 2023
On Windows, shutil.which incorrectly resolves to non-executable extensionless files (python >= 3.12.0b1) #109590
Closed
blurb-it Bot and others added 28 commits September 24, 2023 06:04
@blurb-it
📜🤖 Added by blurb_it.
d505afd
@mdboom @csm10495
pythonGH-109373: Store metadata required for pystats comparison in th…
287a3fa
…e JSON (pythonGH-109374)
@gpshead @JelleZijlstra @csm10495
pythongh-109096: Deprecate http.server.CGIHTTPRequestHandler (pytho…
99d114e
…n#109387)

Deprecate `http.server.CGIHTTPRequestHandler`.

Co-authored-by: Jelle Zijlstra <[email protected]>
@hoodmane @Yhg1s
@brettcannon @csm10495
pythongh-106213: Make Emscripten trampolines work with JSPI (pythonGH…
f9cabbf
…-106219)

There is a WIP proposal to enable webassembly stack switching which have been
implemented in v8:

https://github.com/WebAssembly/js-promise-integration

It is not possible to switch stacks that contain JS frames so the Emscripten JS
trampolines that allow calling functions with the wrong number of arguments
don't work in this case. However, the js-promise-integration proposal requires
the [type reflection for Wasm/JS API](https://github.com/WebAssembly/js-types)
proposal, which allows us to actually count the number of arguments a function
expects.

For better compatibility with stack switching, this PR checks if type reflection
is available, and if so we use a switch block to decide the appropriate
signature. If type reflection is unavailable, we should use the current EMJS
trampoline.

We cache the function argument counts since when I didn't cache them performance
was negatively affected.

Co-authored-by: T. Wouters <[email protected]>
Co-authored-by: Brett Cannon <[email protected]>
@brettcannon @AA-Turner
@hugovk @csm10495
pythonGH-83417: Allow venv to add a .gitignore file to environmen…
a4284f9
…ts via a new `scm_ignore_file` parameter (pythonGH-108125)

This feature is off by default via code but on by default via the CLI. The `.gitignore` file contains `*` which causes the entire directory to be ignored.

Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
@partev @csm10495
pythongh-109474: Update two Unix packaging URLs (python#109307)
691fd9c
update packaging URLs

fix a broken URL for fedora RPM packaging guide and fix a URL redirect for Slackware packaging guide.
@vsajip @vstinner @csm10495
pythongh-109414: Add some basic information about venvs in the introd…
b7ff008
…uction. (pythonGH-109440)

Co-authored-by: Victor Stinner <[email protected]>
@AlberLC @csm10495
pythongh-109451: Fix wrong format specifier in logging documentation (p…
d152179
…ythonGH-109465)
@sobolevn @csm10495
pythongh-108303: Move all certificates to Lib/test/certdata/ (pytho…
0174f87
…n#109489)
@serhiy-storchaka @csm10495
pythongh-108511: Add C API functions which do not silently ignore err…
b14d608
…ors (pythonGH-109025)

Add the following functions:

* PyObject_HasAttrWithError()
* PyObject_HasAttrStringWithError()
* PyMapping_HasKeyWithError()
* PyMapping_HasKeyStringWithError()
@hugovk @csm10495
pythongh-109408: Remove Ubuntu unit tests from Azure Pipelines (pytho…
be22f09
…n#109452)
@AlexWaygood @csm10495
pythongh-109413: Improve mypy config for libregrtest (python#109518)
ea912a6
Improve the mypy config file for libregrtest
@asottile @csm10495
Fix extraneous backslashes in hashlib docs (python#109468)
657f884
@Son-Dongwoo @sunmy2019
@dcollison @csm10495
Fix a typo in c-analyzer (python#109213)
5e484bf
Co-authored-by: sunmy2019 <[email protected]>
Co-authored-by: Dale Collison <[email protected]>
@hugovk @csm10495
Docs: getopt is deprecated in Python 3.13 (python#109438)
0722ddf
@hugovk @csm10495
pythongh-109408: Azure Pipelines: test 3.12 branch (python#109453)
7c24e26
@sobolevn @AlexWaygood @csm10495
pythongh-108303: Fix and move badsyntax_pep3120.py (python#109513)
3394750
Co-authored-by: Alex Waygood <[email protected]>
@hauntsaninja @csm10495
pythongh-108843: fix ast.unparse for f-string with many quotes (pytho…
0fe458e
…n#108981)
@gaogaotiantian @csm10495
pythongh-109371: Fix monitoring with instruction events set (pythongh…
ea21924
…-109385)
@vstinner @csm10495
pythongh-109508: Fix libregrtest formatting of getcwd() (python#109537)
aad8670
@vstinner @csm10495
pythongh-109496: Detect Py_DECREF() after dealloc in debug mode (pyth…
6d4c96a
…on#109539)

On a Python built in debug mode, Py_DECREF() now calls
_Py_NegativeRefcount() if the object is a dangling pointer to
deallocated memory: memory filled with 0xDD "dead byte" by the debug
hook on memory allocators. The fix is to check the reference count
*before* checking for _Py_IsImmortal().

Add test_decref_freed_object() to test_capi.test_misc.
@XuehaiPan @csm10495
pythongh-102757: fix function signature mismatch for `functools.reduc…
ebfa90b
…e` between code and documentation (python#102759)
@serhiy-storchaka @csm10495
Fix error handling in _PySys_UpdateConfig() (pythonGH-109524)
6d6ceb9
@serhiy-storchaka @csm10495
pythongh-109546: Add more tests for formatting floats and fractions (p…
be83a3a
…ythonGH-109548)
@serhiy-storchaka @csm10495
pythongh-109469: Silence compiler warnings on string comparisons in _…
3eb65fb
…testcapi (pythonGH-109533)
@sobolevn @csm10495
pythongh-109125: Run mypy on Tools/wasm (python#109126)
c0a0a8a
@jenner9212 @csm10495
no-issue: Fix typo TestContentTyopeHeader to TestContentTypeHeader (p…
20b9e40
…ythongh-109069)
@vstinner @csm10495
pythongh-109435: Add Doc/library/cmdline.rst (python#109436)
a116a04
Document modules providing a command-line interface (CLI).
vstinner and others added 28 commits September 27, 2023 17:08
@vstinner @csm10495
Remove concurrent.futures deadcode: process_result_item() (python#109906
3c55b15
)

process_result_item() cannot be called with an int anymore, the
protocol changed.
@vstinner @csm10495
pythongh-109276, pythongh-109508: Fix libregrtest stdout (python#109903)
5c99caf
Remove replace_stdout(): call sys.stdout.reconfigure() instead of set
the error handler to backslashreplace.

display_header() logs an empty line and flush stdout.

Remove encoding workaround in display_header() since stdout error
handler is now set to backslashreplace earlier.
@serhiy-storchaka @csm10495
pythongh-109845: Make test_ftplib more stable under load (pythonGH-10…
925b25e
…9912)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
@OmniTroid @csm10495
Fix argument ordering of embuilder command documented in `Tools/wasm/…
aef7403
…README.md` (pythonGH-109863)
@AA-Turner @csm10495
pythonGH-109190: Copyedit 3.12 What's New: Deprecations (python#109766)
5ca9552
@vstinner @csm10495
pythongh-109566: Fix regrtest code adding Python options (python#109926)
b46c07a
* On Windows, use subprocess.run() instead of os.execv().
* Only add needed options
* Rename reexec parameter to _add_python_opts.
* Rename --no-reexec option to --dont-add-python-opts.
@vstinner @csm10495
pythongh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (p…
0933e14
…ython#109928)
@ammaraskar @csm10495
pythongh-109098: Fuzz re module instead of internal sre (python#109911)
6608db3
* pythongh-109098: Fuzz re module instead of internal sre
* Fix c-analyzer globals test failure
* Put globals exception in ignored.tsv
@vstinner @csm10495
pythongh-101100: Fix Sphinx warnings in Doc/using/configure.rst (pyth…
8ab8b6e
…on#109931)
@tgbugs @csm10495
Remove loop from docstring for asyncio.streams.open_connection (pytho…
14530dd
…n#108528)
@AA-Turner @csm10495
pythonGH-109190: Copyedit 3.12 What's New: Deprecations (os fix) (p…
d31993e
…ython#109927)

Merge the two ``os`` entries
@vstinner @csm10495
pythongh-109615: Fix test_tools.test_freeze SRCDIR (python#109935)
a6dd426
Fix copy_source_tree() function of test_tools.test_freeze:

* Don't copy SRC_DIR/build/ anymore. This directory is modified by
  other tests running in parallel.
* Add test.support.copy_python_src_ignore().
* Use sysconfig to get the source directory.
* Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
@vstinner @csm10495
pythongh-109565: Fix concurrent.futures test_future_times_out() (pyth…
cb42e83
…on#109949)

as_completed() uses a timeout of 100 ms instead of 10 ms. Windows
monotonic clock resolution is around 15.6 ms.
@vstinner @csm10495
pythongh-109566: Fix regrtest Python options for WASM/WASI (python#10…
f13088c
…9954)

WASM and WASI buildbots use multiple PYTHON environment variables
such as PYTHONPATH and _PYTHON_HOSTRUNNER. Don't use -E if the
--python=COMMAND option is used.
@vstinner @csm10495
pythongh-109615: Fix support test_copy_python_src_ignore() (python#10…
387cdc7
…9958)

Fix the test when run on an installed Python: use "abs_srcdir" of
sysconfig, and skip the test if the Python source code cannot be
found.

* Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and
  Lib/test/libregrtest/utils.py now first try to get "abs_srcdir"
  from sysconfig, before getting "srcdir" from sysconfig.
* test.pythoninfo logs sysconfig "abs_srcdir".
@iritkatriel @csm10495
pythongh-109923: set line number on the POP_TOP that follows a RETURN…
64fcb92
…_GENERATOR (python#109924)
@sobolevn @AA-Turner @csm10495
pythongh-101100: Fix sphinx warnings in library/devmode.rst (python…
467a22b
…#109963)

Co-authored-by: Adam Turner <[email protected]>
@vstinner @csm10495
pythongh-109566: regrtest doesn't enable --rerun if --python is used (p…
5e4b590
…ython#109969)

regrtest: --fast-ci and --slow-ci options no longer enable --rerun if
the --python option is used.
@AA-Turner @csm10495
pythonGH-109190: Copyedit 3.12 What's New: Release highlights (python…
c722559
…#109770)
@colesbury @csm10495
pythongh-109740: Use 't' in --disable-gil SOABI (python#109922)
9e0dbb9
Shared libraries for CPython 3.13 are now marked with a 't' for
threading. For example, `binascii.cpython-313t-darwin.so`.
@vstinner @csm10495
pythongh-109615: Fix support test_copy_python_src_ignore() on WASM (p…
c98e6ba
…ython#109970)

Not only check if src_dir exists, but look also for Lib/os.py
landmark.
@dcollison @vstinner @csm10495
pythongh-109461: Update logging module lock to use context manager (p…
e5576c0
…ython#109462)

Co-authored-by: Victor Stinner <[email protected]>
@JelleZijlstra @csm10495
Enhance TypedDict docs around required/optional keys (python#109547)
d2bd511
As discussed in comments to python#109544, the semantics of this attribute
are somewhat confusing. Add a note explaining its limitations and
steering users towards __required_keys__ and __optional_keys__ instead.
@ericsnowcurrently @csm10495
pythongh-109793: Allow Switching Interpreters During Finalization (py…
93da346
…thongh-109794)

Essentially, we should check the thread ID rather than the thread state pointer.
@kristjanvalur @AA-Turner @csm10495
pythongh-109955 : Update state transition comments for asyncio.Task (p…
bd9e1cb
…ython#109910)

Co-authored-by: Adam Turner <[email protected]>
@gvanrossum @csm10495
pythongh-104909: Split some more insts into ops (python#109943)
e3cdf36
These are the most popular specializations of `LOAD_ATTR` and `STORE_ATTR`
that weren't already viable uops:

* Split LOAD_ATTR_METHOD_WITH_VALUES
* Split LOAD_ATTR_METHOD_NO_DICT
* Split LOAD_ATTR_SLOT
* Split STORE_ATTR_SLOT
* Split STORE_ATTR_INSTANCE_VALUE

Also:

* Add `-v` flag to code generator which prints a list of non-viable uops
  (easter-egg: it can print execution counts -- see source)
* Double _Py_UOP_MAX_TRACE_LENGTH to 128



I had dropped one of the DEOPT_IF() calls! :-(
@csm10495
Only return PATHEXT matches on win32 if X_OK is in mode
9dd1e2f
@csm10495
Merge branch 'python:main' into shutil_which_no_extv2
10e3394
@csm10495 csm10495 closed this Sep 28, 2023
@csm10495
csm10495 deleted the shutil_which_no_extv2 branch September 28, 2023 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@giampaolo giampaolo Awaiting requested review from giampaolo giampaolo will be requested when the pull request is marked ready for review giampaolo is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

20 participants

@csm10495 @mdboom @gpshead @hoodmane @brettcannon @partev @vsajip @AlberLC @sobolevn @serhiy-storchaka @hugovk @AlexWaygood @asottile @Son-Dongwoo @hauntsaninja @gaogaotiantian @vstinner @XuehaiPan @jenner9212 @rhettinger
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.