summaryrefslogtreecommitdiffstats
path: root/Include/pyport.h
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-05-28 15:16:33 (GMT)
committerVictor Stinner <vstinner@redhat.com>2019-05-28 15:16:33 (GMT)
commit3c8724fc60163f4f3c3b0d531c84cc7b36783f82 (patch)
treebb195253b921a259f0a6e02ffc80f4eb6ad16738 /Include/pyport.h
parent17a5588740b3d126d546ad1a13bdac4e028e6d50 (diff)
downloadcpython-3c8724fc60163f4f3c3b0d531c84cc7b36783f82.zip
cpython-3c8724fc60163f4f3c3b0d531c84cc7b36783f82.tar.gz
cpython-3c8724fc60163f4f3c3b0d531c84cc7b36783f82.tar.bz2
bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)
Diffstat (limited to 'Include/pyport.h')
-rw-r--r--Include/pyport.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index ab88a9a..32d98c5 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -504,14 +504,18 @@ extern "C" {
/* Py_DEPRECATED(version)
* Declare a variable, type, or function deprecated.
+ * The macro must be placed before the declaration.
* Usage:
- * extern int old_var Py_DEPRECATED(2.3);
- * typedef int T1 Py_DEPRECATED(2.4);
- * extern int x() Py_DEPRECATED(2.5);
+ * Py_DEPRECATED(3.3) extern int old_var;
+ * Py_DEPRECATED(3.4) typedef int T1;
+ * Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);
*/
#if defined(__GNUC__) \
&& ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
+#elif defined(_MSC_VER)
+#define Py_DEPRECATED(VERSION) __declspec(deprecated( \
+ "deprecated in " #VERSION))
#else
#define Py_DEPRECATED(VERSION_UNUSED)
#endif