Mercurial > cpython-lru_cache-weakref
diff Modules/_ctypes/callbacks.c @ 43569:19319e70fc3e
Patch #1272, by Christian Heimes and Alexandre Vassalotti.
Changes to make __file__ a proper Unicode object, using the default
filesystem encoding.
This is a bit tricky because the default filesystem encoding isn't
set by the time we import the first modules; at that point we fudge
things a bit. This is okay since __file__ isn't really used much
except for error reporting.
Tested on OSX and Linux only so far.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 15 Oct 2007 02:52:41 +0000 |
| parents | 0fcc18aba385 |
| children | 3df5c7461603 |
line wrap: on
line diff
--- a/Modules/_ctypes/callbacks.c Mon Oct 15 02:40:08 2007 +0000 +++ b/Modules/_ctypes/callbacks.c Mon Oct 15 02:52:41 2007 +0000 @@ -34,9 +34,9 @@ PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_srcfile = PyString_FromString(filename); + py_srcfile = PyUnicode_DecodeFSDefault(filename); if (!py_srcfile) goto bad; - py_funcname = PyString_FromString(funcname); + py_funcname = PyUnicode_FromString(funcname); if (!py_funcname) goto bad; py_globals = PyDict_New(); if (!py_globals) goto bad;
