A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-September/017615.html below:

[Python-Dev] Null bytes in source code

[Python-Dev] Null bytes in source codeTim Peters tim@zope.com
Tue, 25 Sep 2001 17:50:55 -0400
[Greg Ward]
> Weird: in the current CVS, certain files in Lib have null bytes (ASCII
> 0) in them.  Install-time byte-compilation complains about this, so
> "make install" fails.
>
> Eg. here's what "less Lib/reconvert.py" shows me me:
>
> ------------------------------------------------------------------------
> #! /usr/bin/env python1.5
>
> r"""Convert old ("regex") regular expressions to new syntax ("re").
>
> When imported as a module, there are two functions, with their own
> strings:
>
>   convert(s, syntax=None) -- convert a regex regular expression
> to re syntax
>
>  ^@^@^@^@te(s) -- return a quoted string literal
> [...]
> ------------------------------------------------------------------------
>
> Those "^@"'s are really ASCII 0 -- I checked with "od -c".
>
> Am I on drugs here?

This is a problem with running on a system other than Windows <wink>.  I get
this output from the attached program:

checking .py files in C:\Code\python\Lib
checked 165 files

checking .py files in C:\Code\python\Lib\test
checked 201 files


import os
dir = os.getcwd()
print "checking .py files in", dir

count = 0
for fname in os.listdir(dir):
    if fname.endswith('.py'):
        count += 1
        f = file(fname, 'rb')
        guts = f.read()
        i = guts.find('\x00')
        if i >= 0:
            print "Whoa!  Null byte at offset", i, "in", fname
        f.close()

print "checked", count, "files"


no-nulls-under-a-real-os-ly y'rs  - tim




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