Skip to content

Commit 7cd943a

Browse files
committed
Mention about change, describe tests, remove old macro
1 parent c14888d commit 7cd943a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Doc/whatsnew/3.9.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,9 @@ Changes in the Python API
827827
in the object itself.
828828
(Contributed by Serhiy Storchaka in :issue:`40257`.)
829829

830+
* The constant values of future flags in the :mod:`future` module
831+
is updated in order to prevent collision with compiler flags.
832+
(Contributed by Batuhan Taskaya in :issue:`39562`)
830833

831834
CPython bytecode changes
832835
------------------------

Include/code.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ typedef struct {
8989
#define CO_ASYNC_GENERATOR 0x0200
9090

9191
/* These are no longer used. */
92-
#if 0
93-
#define CO_GENERATOR_ALLOWED 0x10000
94-
#endif
92+
/* These values are changed in 3.9 to prevent collision with
93+
compiler flags. See issue 39562 for more details. */
9594
#define CO_FUTURE_DIVISION 0x20000
9695
#define CO_FUTURE_ABSOLUTE_IMPORT 0x40000 /* do absolute imports by default */
9796
#define CO_FUTURE_WITH_STATEMENT 0x80000

Lib/test/test_future.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,13 @@ def test_badfuture10(self):
7878
self.check_syntax_error(cm.exception, "badsyntax_future10", 3)
7979

8080
def test_ensure_flags_dont_clash(self):
81+
# test that future flags and compiler flags doesn't clash
82+
# obtain future flags (CO_****) from future module
8183
flags = [
8284
getattr(__future__, future).compiler_flag
8385
for future in __future__.all_feature_names
8486
]
87+
# obtain some of the exported compiler flags (PyCF_****) from ast
8588
flags.extend(
8689
getattr(ast, flag) for flag in dir(ast) if flag.startswith("PyCF_")
8790
)

0 commit comments

Comments
 (0)