Crash using encodings.utf_8 in release builds

panda 1.8.1 here, on Window7

I recently fixed my application to load some files as unicode. Now I get the “p3dpythonw.exe has stopped working” message, and no exception or stack trace in the log.

I used my import interceptor to discover this happens during an attempt to import “encodings.utf_8”, which if I dump a trace when that is imported, I can see its imported by:

File “core\”, line 107, in fromFile
File “codecs”, line 884, in open
File “c:\python27\lib\”, line 100, in search_function
File “core\”, line 15, in _newImport

line 107 from is simply:, encoding=‘utf-8’, mode=‘r’)

from panda3d.pdef
182 # To add the multitude of standard Python string encodings.
183 module(‘encodings’, ‘encodings.*’)

Thats suppose to make encodings work. Apparently it does not make encodings.utf_8 work anyway.

I’m going to dig into this more soon, but I figured I’d start up a thread with what I have so far. I’ll probably put together a minimal example of the issue along with a bug report soon. For now I’m going to look for an easy workaround, since I’d like to get this release out. Suggestions for a fix or workaround would be appreciated.

Problem signature:
Problem Event Name: APPCRASH
Application Name: p3dpythonw.exe
Application Version:
Application Timestamp: 516aac0f
Fault Module Name: libp3dtoolconfig.dll
Fault Module Version:
Fault Module Timestamp: 516aa0c8
Exception Code: c00000fd
Exception Offset: 00098287
OS Version: 6.1.7601.
Locale ID: 1033
Additional Information 1: b7e5
Additional Information 2: b7e52d6e65a1fc342e89d51d8d2f4f12
Additional Information 3: f52e
Additional Information 4: f52e85c3fc169c066d91dadede45d3de

Correction: its actually an attempt to call .read(aLargeNumber) on a unicode file (and maybe other files) thats crashing with release builds (Its easy to botch figuring out where a crash is when you get no stack traces, just kaboom)

I was doing this as a work around for a python bug, where .read() only reads up to the 72 character of the file (not the whole file) when reading as unicode. Apparently I need a different work around, as that once crashes under the runtime!

Thus: replacing:

fixed the crash. should work, but has truncation issues.

So my work around for a bug crashes sometimes, so use a different workaround…

Honestly, I should look into this further and try and get the bugs here fixed, but I’m just happy to have it working again.