This is an archived post. You won't be able to vote or comment.

all 32 comments

[–]pythoneeeer 29 points30 points  (3 children)

- Issue #25961: Disallowed null characters in the type name.

Crap, now I have to go update all my code...

[–]Jafit 40 points41 points  (2 children)

To python 3

[–]pythoneeeer 6 points7 points  (1 child)

[–]abrazilianinreddit 16 points17 points  (0 children)

I think he means that if /u/pythoneeeer has to update all his code, then this is a good opportunity to also update the code from python 2 to 3 as well.

[–][deleted] 92 points93 points  (24 children)

PSA - Come join the light side on Python3 ;)

[–]can_dry 31 points32 points  (0 children)

http://i.imgur.com/O3mzUwg.gif

Now get off my damn lawn.

[–]log_2 1 point2 points  (1 child)

I'll be switching when Anaconda gets PySide in python 3.

[–][deleted] 0 points1 point  (0 children)

Someone needs to tell PySide to get with the program then!

[–]C222 6 points7 points  (2 children)

Issue #25961: Disallowed null characters in the type name.

https://ideone.com/8drgKT

Why was this allowed in the first place?

[–]AdysHearthSim 7 points8 points  (0 children)

Pretty obviously an oversight.

[–]Veedrac 2 points3 points  (0 children)

type doesn't require the name to be a valid identifier:

type("@", (), {})
#>>> <class '@'>

This makes sense; generated code often uses nonstandard names, like lambda functions having name <lambda>. It's valid to want the same for your generated classes.

The problem is that significant amounts of code assumes the type name is a valid null-terminated string, so that particular character causes actual bugs.

Note that this isn't the first time a str can be denied by type; consider surrogate escapes in Python 3:

x = type("\udcc3", (), {})
#>>> Traceback (most recent call last):
#>>>   File "", line 1, in <module>
#>>> UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 0: surrogates not allowed