[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ec729d5407adafaae566136448ef0551bb29c070 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. 
(GH-8262) (GH-8424)
https://github.com/python/cpython/commit/ec729d5407adafaae566136448ef0551bb29c070


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 220afffb683af1ba9e04c37535cfaa41348e9ebb by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.7':
bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. 
(GH-8262) (GH-8423)
https://github.com/python/cpython/commit/220afffb683af1ba9e04c37535cfaa41348e9ebb


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7950

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7949

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset aba24ff3601ddc86b85e01880a8be596fb799287 by Serhiy Storchaka in 
branch 'master':
bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. 
(GH-8262)
https://github.com/python/cpython/commit/aba24ff3601ddc86b85e01880a8be596fb799287


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The problem is that 'from __future__ import' is parsed after converting the 
sources to the AST. But this flag affects the behavior of the tokenizer, before 
an AST is created.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 8262 fixes the intended setting of error message for the "Barry as BDFL" 
easter egg.

>>> from __future__ import barry_as_FLUFL
>>> 1 != 2
  File "", line 1
1 != 2
   ^
SyntaxError: with Barry as BDFL, use '<>' instead of '!='

But there is other problem. As was exposed in the private communication with 
Victor and Barry, this easter egg works only in REPL (or if explicitly pass 
__future__.CO_FUTURE_BARRY_AS_BDFL to compile()). I'll try to fix this too.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +7795

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +7792

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

AFAICT, that future only works in the REPL.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread STINNER Victor


STINNER Victor  added the comment:

> Could you add a test in test_flufl.py that will fail with not patched code?

It seems like PyObject_FREE() is never called with the static string "with 
Barry as BDFL, use '<>' instead of '!='".

When parsetok() goes to code path (1):

err_ret->text = "with Barry as BDFL, use '<>' "
"instead of '!='";

Later, it goes to code path (2) as well:

if (tok->buf != NULL) {
...
err_ret->text = (char *) PyObject_MALLOC(len + 1);

Hum, I modified my PR to removed *dead code*:

err_ret->text = "with Barry as BDFL, use '<>' "
"instead of '!='";

> This issue and issue34080 look unrelated to me. They can be fixed 
> independently.

In practice, both issues are related and it seems easier to me to fix them both 
at the same time ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Could you add a test in test_flufl.py that will fail with not patched code?

This issue and issue34080 look unrelated to me. They can be fixed independently.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread STINNER Victor


STINNER Victor  added the comment:

Oh, this easter egg is tested by Lib/test/test_flufl.py.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread STINNER Victor


STINNER Victor  added the comment:

> I expected it should be easy to reproduce a crash, but I failed to find an 
> example.

I don't understand how parsetok.c is supposed to handle "from __future__ import 
barry_as_FLUFL":

* Parser/parsetok.c tests (ps->p_flags & CO_FUTURE_BARRY_AS_BDFL)
* Python/future.c uses "if (strcmp(feature, FUTURE_BARRY_AS_BDFL) == 0) { 
ff->ff_features |= CO_FUTURE_BARRY_AS_BDFL; }"
* Python/pythonrun.c: PARSER_FLAGS() copies CO_FUTURE_BARRY_AS_BDFL flag as 
PyPARSE_BARRY_AS_BDFL

The only way to use "<>" operator seems to pass explicitly 
CO_FUTURE_BARRY_AS_BDFL flag to compile() flags, which is not the convenient 
way to use "from __future__ import barry_as_FLUFL" :-(

Code:
---
import inspect
CO_FUTURE_BARRY_AS_BDFL = 0x4
flags = CO_FUTURE_BARRY_AS_BDFL
code = "print(1 <> 2)"
try:
compile(code, "filename", "exec", flags=0)
except SyntaxError:
print("ok")
else:
raise Exception("SyntaxError expected")
compile(code, "filename", "exec", flags=flags)
print("ok")
---

Maybe we need a test for the easter egg. Or maybe we should remove it? :-p

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread STINNER Victor


STINNER Victor  added the comment:

This issue is related to bpo-34080.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-11 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +7775
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-10 Thread Xiang Zhang


Change by Xiang Zhang :


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I expected it should be easy to reproduce a crash, but I failed to find an 
example.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34084] possible free statically allocated string in compiler when easter egg on

2018-07-10 Thread Xiang Zhang


Change by Xiang Zhang :


--
title: possible free statically allocated string -> possible free statically 
allocated string in compiler when easter egg on

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com