summaryrefslogtreecommitdiffstats
path: root/Include/compile.h
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-05-01 14:18:27 (GMT)
committerGitHub <noreply@github.com>2020-05-01 14:18:27 (GMT)
commit5055c274c6e4f2bb8025910dedf0ff89f4bdd170 (patch)
tree0e8ec7fff9958bd3afcabb38f968fd26eba9dd5f /Include/compile.h
parent95e208dce505c542b8e4f8f42c57e6d4793b6895 (diff)
downloadcpython-5055c274c6e4f2bb8025910dedf0ff89f4bdd170.zip
cpython-5055c274c6e4f2bb8025910dedf0ff89f4bdd170.tar.gz
cpython-5055c274c6e4f2bb8025910dedf0ff89f4bdd170.tar.bz2
[3.8] bpo-39562: Prevent collision of future and compiler flags (GH-19230) (GH-19835)
The constant values of future flags in the __future__ module is updated in order to prevent collision with compiler flags. Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing with CO_FUTURE_DIVISION.. (cherry picked from commit 4454057269b995341b04d13f0bf97f96080f27d0) Co-authored-by: Batuhan Taşkaya <batuhanosmantaskaya@gmail.com>
Diffstat (limited to 'Include/compile.h')
-rw-r--r--Include/compile.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/compile.h b/Include/compile.h
index 1cda955..015584d 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -18,12 +18,18 @@ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
#define PyCF_MASK_OBSOLETE (CO_NESTED)
+
+/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique.
+ PyCF_ constants can use bits from 0x0100 to 0x10000.
+ CO_FUTURE_ constants use bits starting at 0x20000. */
#define PyCF_SOURCE_IS_UTF8 0x0100
#define PyCF_DONT_IMPLY_DEDENT 0x0200
#define PyCF_ONLY_AST 0x0400
#define PyCF_IGNORE_COOKIE 0x0800
#define PyCF_TYPE_COMMENTS 0x1000
#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
+#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
+ PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT)
#ifndef Py_LIMITED_API
typedef struct {