mirror of
https://github.com/pybind/pybind11.git
synced 2026-07-14 11:07:22 +00:00
The `# -*- coding: utf-8 -*-` line prepended to every string passed to PyRun_String was a Python 2 workaround. Python 3's PyRun_String already assumes UTF-8 source encoding, so the cookie is dead weight — and harmful: it shifts all line numbers up by one in tracebacks and SyntaxErrors from evaluated code (a `raise` on line 2 would incorrectly appear as line 3). Remove the cookie and replace the stale comment with one that explains the actual reason for the `std::string` conversion (need a C string for PyRun_String). No other location in eval.h uses this pattern (eval_file reads directly from a FILE*). Assisted-by: ClaudeCode:claude-fable-5