From b26f6d02db56527d7fb36b1245085160574a91df Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Thu, 5 Jun 2025 17:14:53 +0530 Subject: [PATCH] Added architecture validation validated for freethreaded related inputs --- dist/setup/index.js | 5 +++-- src/find-python.ts | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index cf853b26..7ef5eccc 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -96817,6 +96817,9 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest // Use the freethreaded version if it was specified in the input, e.g., 3.13t freethreaded = true; } + if (architecture.endsWith('-freethreaded')) { + throw new Error(`Invalid architecture '${architecture}'. Use 'freethreaded' flag in the python-version (e.g., '3.13.1t') or - freethreaded: true instead of specifying '-freethreaded' in the architecture`); + } core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`); if (freethreaded) { // Free threaded versions use an architecture suffix like `x64-freethreaded` @@ -96887,8 +96890,6 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest const version = path.basename(path.dirname(installDir)); const major = semver.major(version); const minor = semver.minor(version); - const freethreadedInput = core.getInput('freethreaded'); - const freethreaded = freethreadedInput === 'true' || architecture.includes('freethreaded'); const basePath = process.env['APPDATA'] || ''; let versionSuffix = `${major}${minor}`; // Append '-32' for x86 architecture if Python version is >= 3.10 diff --git a/src/find-python.ts b/src/find-python.ts index a57390b7..e15525a0 100644 --- a/src/find-python.ts +++ b/src/find-python.ts @@ -49,8 +49,12 @@ export async function useCpythonVersion( // Use the freethreaded version if it was specified in the input, e.g., 3.13t freethreaded = true; } + if (architecture.endsWith('-freethreaded')) { + throw new Error( + `Invalid architecture '${architecture}'. Use 'freethreaded' flag in the python-version (e.g., '3.13.1t') or - freethreaded: true instead of specifying '-freethreaded' in the architecture` + ); + } core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`); - if (freethreaded) { // Free threaded versions use an architecture suffix like `x64-freethreaded` core.debug(`Using freethreaded version of ${semanticVersionSpec}`); @@ -156,9 +160,6 @@ export async function useCpythonVersion( const version = path.basename(path.dirname(installDir)); const major = semver.major(version); const minor = semver.minor(version); - const freethreadedInput = core.getInput('freethreaded'); - const freethreaded = - freethreadedInput === 'true' || architecture.includes('freethreaded'); const basePath = process.env['APPDATA'] || ''; let versionSuffix = `${major}${minor}`;