New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DirectEntry._autoCapitalize() on Python 3.x #628
Conversation
I presume the original call was there for a reason; I guess if the case that there was a |
As in, use UTF-8 characters in a string, or just use any string that just so happens to be UTF-8 encoded? |
As in, use a string that has non-ASCII characters, in UTF-8 encoding. (If a string doesn't have non-ASCII characters, its UTF-8 encoded form is identical to the ASCII form, because of how UTF-8 is designed.) |
It now tests DirectEntry._autoCapitalize() against a UTF-8 string.
@rdb Hi there, I have made the necessary changes you have requested. Sorry about the extended delay. I am not entirely sure if this is 100% ideal, as I am setting the UTF-8 encoding within the unit test itself, nevertheless it does function as intended on both Python 2.x & Python 3.x. Take care! |
Here I go again! Hopefully reviving @rdb on this one. A definite good push towards full Python 3 support. 👍 |
Yeah, let's get this into the next release. I'd only additionally like to see tests with Unicode objects in Python 2, but I can make that change myself if needed. |
This pull request aims to resolve the following crash with DirectEntry._autoCapitalize() under Python 3.x (Specifically Python 3.7.2 included with the current release of Panda3D 1.10.2, 64-bit, under Windows 10):
Two simple changes in the
_autoCapitalize
function were all that was needed to resolve this crash under Python 3.x, while also preserving compatibility with Python 2.7.A simple unit test was also included to test this, and a simple test program can be found here: https://pastebin.com/P5sjhYQt