◐ Shell
clean mode source ↗

bpo-33407: Implement Py_DEPRECATED() on Windows by ZackerySpytz · Pull Request #8980 · python/cpython

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@serhiy-storchaka

This breaks compatibility.

@vstinner

This breaks compatibility.

How? Would you mind to elaborate?

@serhiy-storchaka

The current usage:

extern int foo(int) Py_DEPRECATED(3.2);

This PR changes it to

Py_DEPRECATED(3.2) extern int foo(int);

It requires to rewrite all code that uses Py_DEPRECATED. This is a large breakage. Py_DEPRECATED is public and can be used in user code. We shouldn't break it in such way.

@vstinner

Ok, but we have to make the change to support Visual Studio. Do you think that the macro is used outside Python itself?

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bedevere-bot

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ZackerySpytz

@vstinner I have added a What's New entry for this change.

Can you please confirm that using Py_DEPRECATED() at the start of the function (rather than the end) already works in Python 3.7?

Yes, I can confirm using Py_DEPRECATED() at the start of the function already worked before this change.
I have made the requested changes; please review again.

@bedevere-bot

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

serhiy-storchaka

serhiy-storchaka

@ZackerySpytz

@vstinner, I have implemented all of your requested changes, and Serhiy Storchaka has also now approved this PR. Please have a look.

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have requests on the documentation part.

@bedevere-bot

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ZackerySpytz

Two deprecation warnings are emitted on MSVC because of this PR; they can be seen on AppVeyor (e.g. https://ci.appveyor.com/project/python/cpython/builds/24580662#L125):

_winapi.c
c:\projects\cpython\modules\_winapi.c(505): warning C4996: 'PyErr_SetFromWindowsErrWithUnicodeFilename': deprecated in 3.3 [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
  c:\projects\cpython\include\cpython\pyerrors.h(108): note: see declaration of 'PyErr_SetFromWindowsErrWithUnicodeFilename'
c:\projects\cpython\modules\_winapi.c(1382): warning C4996: 'PyErr_SetFromWindowsErrWithUnicodeFilename': deprecated in 3.3 [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
  c:\projects\cpython\include\cpython\pyerrors.h(108): note: see declaration of 'PyErr_SetFromWindowsErrWithUnicodeFilename'

I had opened https://bugs.python.org/issue36935 and GH-13355 to fix these warnings.

@ZackerySpytz

@vstinner I have made the requested changes; please review again.

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

DinoV pushed a commit to DinoV/cpython that referenced this pull request

Jan 14, 2020