Message258977
| Author |
vstinner |
| Recipients |
serhiy.storchaka, vstinner, yselivanov |
| Date |
2016年01月26日.22:05:19 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1453845919.69.0.439646073362.issue26204@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
"""
Will the following code compile OK? What will it compile to?
if 1:
42
"""
compile OK: what do you mean? This code doesn't make any sense to me :-)
Currently text strings statements are ignored:
---
>>> def f():
... if 1:
... "abc"
...
>>> import dis
>>> dis.dis(f)
3 0 LOAD_CONST 0 (None)
3 RETURN_VALUE
---
But byte strings emit a LOAD_CONST+POP_TOP:
---
>>> def g():
... if 1:
... b'bytes'
...
>>> dis.dis(g)
3 0 LOAD_CONST 1 (b'bytes')
3 POP_TOP
4 LOAD_CONST 0 (None)
7 RETURN_VALUE
---
With my patch, all constants statements will be ignored. Example with my patch:
---
>>> def h():
... if 1:
... b'bytes'
...
>>> import dis; dis.dis(h)
3 0 LOAD_CONST 0 (None)
3 RETURN_VALUE
--- |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年01月26日 22:05:19 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka, yselivanov |
| 2016年01月26日 22:05:19 | vstinner | set | messageid: <1453845919.69.0.439646073362.issue26204@psf.upfronthosting.co.za> |
| 2016年01月26日 22:05:19 | vstinner | link | issue26204 messages |
| 2016年01月26日 22:05:19 | vstinner | create |
|