Skip to content

Commit

Permalink
Merge pull request #1712 from bstaletic/py312-bugs
Browse files Browse the repository at this point in the history
Python 3.12 compatibility fixes
  • Loading branch information
mergify[bot] authored Oct 2, 2023
2 parents ed6a49a + 53a7c2c commit e755af6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#
# For more information, please refer to <http://unlicense.org/>

from distutils.sysconfig import get_python_inc
from sysconfig import get_path
import platform
import os.path as p
import subprocess
Expand Down Expand Up @@ -71,7 +71,7 @@
'-isystem',
'cpp/BoostParts',
'-isystem',
get_python_inc(),
get_path( 'include' ),
'-isystem',
'cpp/llvm/include',
'-isystem',
Expand Down
18 changes: 9 additions & 9 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,23 @@ def FindLatestMSVC( quiet ):
try:
latest_v = int( latest_full_v.split( '.' )[ 0 ] )
except ValueError:
raise ValueError( f"{latest_full_v} is not a version number." )
raise ValueError( f"{ latest_full_v } is not a version number." )

if not quiet:
print( f'vswhere -latest returned version {latest_full_v}' )
print( f'vswhere -latest returned version { latest_full_v }' )

if latest_v not in ACCEPTABLE_VERSIONS:
if latest_v > 17:
if not quiet:
print( f'MSVC Version {latest_full_v} is newer than expected.' )
print( f'MSVC Version { latest_full_v } is newer than expected.' )
else:
raise ValueError(
f'vswhere returned {latest_full_v} which is unexpected.'
f'vswhere returned { latest_full_v } which is unexpected.'
'Pass --msvc <version> argument.' )
return latest_v
else:
if not quiet:
print( f'vswhere returned nothing usable, {latest_full_v}' )
print( f'vswhere returned nothing usable, { latest_full_v }' )

# Fall back to registry parsing, which works at least until MSVC 2019 (16)
# but is likely failing on MSVC 2022 (17)
Expand All @@ -161,11 +161,11 @@ def FindLatestMSVC( quiet ):
for i in ACCEPTABLE_VERSIONS:
if not quiet:
print( 'Trying to find '
rf'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\{i}.0' )
rf'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\{ i }.0' )
try:
winreg.OpenKey( handle, rf'SOFTWARE\Microsoft\VisualStudio\{i}.0' )
winreg.OpenKey( handle, rf'SOFTWARE\Microsoft\VisualStudio\{ i }.0' )
if not quiet:
print( f"Found MSVC version {i}" )
print( f"Found MSVC version { i }" )
msvc = i
break
except FileNotFoundError:
Expand Down Expand Up @@ -978,7 +978,7 @@ def EnableRustCompleter( switches ):
req_toolchain_version = switches.rust_toolchain_version

if switches.quiet:
sys.stdout.write( f'Installing rust-analyzer "{req_toolchain_version}" '
sys.stdout.write( f'Installing rust-analyzer "{ req_toolchain_version }" '
'for Rust support...' )
sys.stdout.flush()

Expand Down
2 changes: 1 addition & 1 deletion third_party/jedi_deps/jedi
Submodule jedi updated 44 files
+10 −8 .github/workflows/ci.yml
+14 −0 CHANGELOG.rst
+3 −2 README.rst
+9 −0 SECURITY.md
+2 −2 docs/docs/acknowledgements.rst
+1 −1 docs/docs/features.rst
+4 −3 docs/docs/usage.rst
+1 −1 jedi/__init__.py
+23 −2 jedi/api/__init__.py
+1 −2 jedi/api/classes.py
+3 −4 jedi/api/environment.py
+1 −2 jedi/api/keywords.py
+22 −6 jedi/api/refactoring/__init__.py
+5 −2 jedi/api/strings.py
+4 −3 jedi/inference/__init__.py
+30 −26 jedi/inference/compiled/access.py
+2 −2 jedi/inference/compiled/mixed.py
+3 −3 jedi/inference/compiled/subprocess/__main__.py
+7 −9 jedi/inference/compiled/subprocess/functions.py
+30 −16 jedi/inference/compiled/value.py
+3 −3 jedi/inference/dynamic_params.py
+4 −0 jedi/inference/gradual/annotation.py
+2 −2 jedi/inference/gradual/typing.py
+2 −2 jedi/inference/syntax_tree.py
+24 −3 jedi/plugins/pytest.py
+2 −0 jedi/plugins/stdlib.py
+9 −0 jedi/settings.py
+1 −1 jedi/utils.py
+6 −0 setup.cfg
+14 −4 setup.py
+4 −0 test/completion/basic.py
+1 −1 test/completion/on_import.py
+26 −0 test/completion/pep0593_annotations.py
+1 −4 test/test_api/test_classes.py
+5 −0 test/test_api/test_documentation.py
+108 −7 test/test_api/test_interpreter.py
+43 −0 test/test_api/test_refactoring.py
+5 −1 test/test_inference/test_compiled.py
+0 −7 test/test_inference/test_fstring.py
+3 −9 test/test_inference/test_literals.py
+3 −5 test/test_inference/test_signature.py
+6 −4 test/test_inference/test_sys_path.py
+26 −7 test/test_integration.py
+2 −2 test/test_utils.py
2 changes: 1 addition & 1 deletion ycmd/completers/cs/solutiondetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _SolutionTestCheckHeuristics( candidates, tokens, i ):
# 1. is there a solution named just like the subdirectory with the source?
if ( not selection and i < len( tokens ) - 1 and
f'{ tokens[ i + 1 ] }.sln' in candidates ):
selection = os.path.join( path, f'{ tokens[ i + 1] }.sln' )
selection = os.path.join( path, f'{ tokens[ i + 1 ] }.sln' )
LOGGER.info( 'Selected solution file %s as it matches source subfolder',
selection )

Expand Down
4 changes: 2 additions & 2 deletions ycmd/completers/typescript/typescript_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _StartServerNoLock( self ):
return

self._logfile = utils.CreateLogfile( LOGFILE_FORMAT )
tsserver_log = f'-file { self._logfile } -level {_LogLevel()}'
tsserver_log = f'-file { self._logfile } -level { _LogLevel() }'
# TSServer gets the configuration for the log file through the
# environment variable 'TSS_LOG'. This seems to be undocumented but
# looking at the source code it seems like this is the way:
Expand Down Expand Up @@ -911,7 +911,7 @@ def _GetDoc( self, request_data ):
'offset': request_data[ 'column_codepoint' ]
} )

message = f'{ info[ "displayString" ] }\n\n{info[ "documentation" ]}'
message = f'{ info[ "displayString" ] }\n\n{ info[ "documentation" ] }'
return responses.BuildDetailedInfoResponse( message )


Expand Down

0 comments on commit e755af6

Please sign in to comment.