Yeah, let's kill this undefined behavior. On Thu, Nov 19, 2015 at 4:10 AM, Chris Angelico <rosuav at gmail.com> wrote: > On Thu, Nov 19, 2015 at 10:51 PM, Serhiy Storchaka <storchaka at gmail.com> wrote: >> http://bugs.python.org/issue20115 > > Interestingly, the file linked in the last comment on that issue [1] > ties in with another part of this thread, regarding binary blobs in > Python scripts. It uses open(sys.argv[0],'rb') to find itself, and has > the binary data embedded as a comment. (Though the particular > technique strikes me as fragile; to prevent newlines from messing > things up, \n becomes #% and \r becomes #$, but I don't see any > protection against those sequences occurring naturally in the blob. > Given that it's a bz2 archive, I would expect any two-byte sequence to > be capable of occurring.) To be quite honest, I wouldn't mind if > Python objected to this kind of code. If I were writing it myself, I'd > use a triple-quoted string containing some kind of textualized version > - either the repr of the string, or some kind of base 64 or base 85 > encoding. Binary data embedded literally will prevent non-ASCII file > encodings. > > ChrisA > > [1] http://ftp.waf.io/pub/release/waf-1.7.16 > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4