Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Py_DEPRECATED() macro for Visual Studio #77588

Closed
vstinner opened this issue May 2, 2018 · 5 comments
Closed

Implement Py_DEPRECATED() macro for Visual Studio #77588

vstinner opened this issue May 2, 2018 · 5 comments
Labels
3.8 only security fixes OS-windows

Comments

@vstinner
Copy link
Member

vstinner commented May 2, 2018

BPO 33407
Nosy @pfmoore, @pitrou, @vstinner, @tjguk, @zware, @zooba, @ZackerySpytz
PRs
  • bpo-33407: Implement Py_DEPRECATED() on Windows #8980
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-05-28.15:19:44.920>
    created_at = <Date 2018-05-02.09:29:49.384>
    labels = ['3.8', 'OS-windows']
    title = 'Implement Py_DEPRECATED() macro for Visual Studio'
    updated_at = <Date 2019-05-28.15:19:44.919>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-05-28.15:19:44.919>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-28.15:19:44.920>
    closer = 'vstinner'
    components = ['Windows']
    creation = <Date 2018-05-02.09:29:49.384>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33407
    keywords = ['patch']
    message_count = 5.0
    messages = ['316059', '316060', '316061', '343789', '343790']
    nosy_count = 7.0
    nosy_names = ['paul.moore', 'pitrou', 'vstinner', 'tim.golden', 'zach.ware', 'steve.dower', 'ZackerySpytz']
    pr_nums = ['8980']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue33407'
    versions = ['Python 3.8']

    @vstinner
    Copy link
    Member Author

    vstinner commented May 2, 2018

    According to the following links, it would be possible to implement the Pc_DEPRECATED() macro for Visual Studio:

    https://mail.python.org/pipermail/python-dev/2018-May/153299.html
    https://stackoverflow.com/questions/295120/c-mark-as-deprecated/295229#295229

    """
    #ifdef __GNUC__
    #define DEPRECATED(func) func __attribute__ ((deprecated))
    #elif defined(_MSC_VER)
    #define DEPRECATED(func) __declspec(deprecated) func
    #else
    #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
    #define DEPRECATED(func) func
    #endif
    """

    Moreover, is Py_DEPRECATED() defined on clang which also supports the deprecated function attribute?
    https://clang.llvm.org/docs/AttributeReference.html#deprecated-gnu-deprecated

    Current Include/pyport.h code:

    #if defined(__GNUC__) \
        && ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
    #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
    #else
    #define Py_DEPRECATED(VERSION_UNUSED)
    #endif

    @vstinner vstinner added 3.8 only security fixes OS-windows labels May 2, 2018
    @vstinner
    Copy link
    Member Author

    vstinner commented May 2, 2018

    Oh, bpo-19569 is still open, for Visual Studio see:
    https://bugs.python.org/issue19569#msg227727

    @pitrou
    Copy link
    Member

    pitrou commented May 2, 2018

    In Arrow we use the following:

    #if __cplusplus <= 201103L
    # ifdef __GNUC__
    #  define ARROW_DEPRECATED(...) __attribute__((deprecated(__VA_ARGS__)))
    # elif defined(_MSC_VER)
    #  define ARROW_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__))
    # else
    #  define ARROW_DEPRECATED(...)
    # endif
    #else
    #  define ARROW_DEPRECATED(...) [[deprecated(__VA_ARGS__)]]
    #endif

    @vstinner
    Copy link
    Member Author

    New changeset 3c8724f by Victor Stinner (Zackery Spytz) in branch 'master':
    bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)
    3c8724f

    @vstinner
    Copy link
    Member Author

    Thanks Zackery Spytz for the fix!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes OS-windows
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants