homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Arfrever, alex, arigo, benjamin.peterson, georg.brandl, gvanrossum, iritkatriel, ita1024, jwilk, serhiy.storchaka, terry.reedy
Date 2021年09月07日.03:02:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630983740.92.0.574822018738.issue20115@roundup.psfhosted.org>
In-reply-to
Content
What I missed before is that duplicating the effect of the first two interactive entries (no exception) requires escaping the backslash so that the source argument for the explicit compile does not have a null. 
compile("'\0円'", '', 'exec')
<code object <module> at 0x00000214431CAA20, file "", line 1>
compile("#\0円", '', 'exec')
<code object <module> at 0x00000214431CAC30, file "", line 1>
So I did not actually see an exception to the rule.
---
*On Win 10*, I experimented with a version of Armin and Irit's example, without and with b'...' and 'wb'.
s = '#\x00\na\nb\n' 
print(len(s)) # 7
with open("f:/Python/a/nulltest.py", 'w') as f:
 f.write(s)
import nulltest
When I ran a local repository build of 3.9, 3.10, or 3.11 with
 f:\dev3円x>python f:/Python/a/nulltest.py
I got Irit's strange NameError instead of the proper ValueError.
When I ran with installed 3.9 or 3.10 with
 py -3.10 -m a.nulltest
I got the null-byte ValueError.
When I ran from IDLE's editor running on either installed or repository python, the import gave the null-byte ValueError.
History
Date User Action Args
2021年09月07日 03:02:20terry.reedysetrecipients: + terry.reedy, gvanrossum, arigo, georg.brandl, benjamin.peterson, jwilk, Arfrever, alex, ita1024, serhiy.storchaka, iritkatriel
2021年09月07日 03:02:20terry.reedysetmessageid: <1630983740.92.0.574822018738.issue20115@roundup.psfhosted.org>
2021年09月07日 03:02:20terry.reedylinkissue20115 messages
2021年09月07日 03:02:20terry.reedycreate

AltStyle によって変換されたページ (->オリジナル) /