Skip to content

Commit 7d37dad

Browse files
sd2kclaude
andcommitted
fix: use Path::to_str instead of display for compiler paths
Path::display() does a lossy conversion which can cause subtle, hard-to-diagnose failures when passing paths to compiler commands. Use to_str() with explicit error handling instead, as suggested in PR review. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9f0c900 commit 7d37dad

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

build.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,20 @@ fn write_setup_local(cpython_wasi_dir: &Path) -> Result<()> {
393393
// The _sqlite3 module source files (relative to Modules/)
394394
// These are the files that make up the _sqlite3 extension in CPython 3.14
395395
// Note: blob.c is required - it defines pysqlite_close_all_blobs and pysqlite_blob_setup_types
396+
let include_dir = deps_dir.join("include");
397+
let lib_dir = deps_dir.join("lib");
396398
let setup_local_content = format!(
397399
r#"# Auto-generated by build.rs for SQLite support
398400
# Enable _sqlite3 module with statically linked SQLite
399401
400402
_sqlite3 _sqlite/blob.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -I{include} -L{lib} -lsqlite3
401403
"#,
402-
include = deps_dir.join("include").display(),
403-
lib = deps_dir.join("lib").display(),
404+
include = include_dir
405+
.to_str()
406+
.ok_or_else(|| anyhow!("non-UTF8 path: {}", include_dir.display()))?,
407+
lib = lib_dir
408+
.to_str()
409+
.ok_or_else(|| anyhow!("non-UTF8 path: {}", lib_dir.display()))?,
404410
);
405411

406412
// Create the Modules directory if it doesn't exist

0 commit comments

Comments
 (0)