Files
pybind11/include
Henry Schreiner 99117da020 chore(eval): drop Python 2 coding cookie prepended to evaluated source (#6089)
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
2026-06-17 08:16:04 -04:00
..