简体   繁体   中英

how to disable pypy assert statement?

$ ./pypy -O
Python 2.7.2 (a3e1b12d1d01, Dec 04 2012, 13:33:26)
[PyPy 1.9.1-dev0 with GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: `` amd64 and ppc are only
available in enterprise version''
>>>> assert 1==2
Traceback (most recent call last):
  File "", line 1, in 
AssertionError
>>>> 

But when i execute

$ python -O
Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> assert 1==2
>>>

PyPy does silently ignore -O. The reasoning behind it is that we believe -O that changes semantics is seriously broken, but well, I guess it's illegal. Feel free to post a bug (that's also where such reports belong, on bugs.pypy.org)

For anyone coming here in the future, Oct 3 2021 pypy3 does accept the -O flag and turn off assertion statements

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM