GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.8] bpo-37250: put back tp_print for backwards compatibility by jdemeyer · Pull Request #14193 · python/cpython

Conversation

@jdemeyer

@jdemeyer jdemeyer commented Jun 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR for 3.8 only, since this is supposed to be a temporary compatibility measure.

https://bugs.python.org/issue37250

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jdemeyer
[3.8] bpo-37250: put back tp_print for backwards compatibility
d886024
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jun 18, 2019
@bedevere-bot bedevere-bot added the awaiting review label Jun 18, 2019
@jdemeyer
Fix sizeof test
35f4388
@ncoghlan

ncoghlan commented Jun 18, 2019

Copy link
Copy Markdown
Contributor

+1, but let's refrain from merging until there's clearer consensus on the tracker issue for the pragmatic Py3.8-only source compatibility fix.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ncoghlan
ncoghlan reviewed Jun 18, 2019
View reviewed changes
Comment thread Include/cpython/object.h Outdated
vectorcallfunc tp_vectorcall;

/* Unused, kept for backwards compatibility in CPython 3.8 only */
int (*tp_print)(PyObject *, FILE *, int);

@ncoghlan ncoghlan Jun 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Does adding the Py_DEPRECATED(3.8) macro here cause the tp_print reference in the test to generate a compiler warning?

If it does, that would be a good thing to add (as long as we also have a way to disable the deprecation warning in the test suite, which I presume we do)

Reference: https://docs.python.org/3.8/c-api/intro.html#c.Py_DEPRECATED

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jdemeyer jdemeyer Jun 19, 2019

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

That works but then the deprecation warning will be shown when compiling _testcapi.c. I'll add a guard for that. If that's controversial, I'll gladly remove it.

(off-topic: since this is the only such warning shown, it seems that we never actually test deprecated functionality of the C API, which is worrying)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
encukou
encukou reviewed Jun 19, 2019
View reviewed changes
Comment thread Misc/NEWS.d/next/C API/2019-06-12-11-45-36.bpo-37221.RhP1E7.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner
vstinner reviewed Jun 19, 2019
View reviewed changes
Comment thread Include/cpython/object.h Outdated
destructor tp_finalize;
vectorcallfunc tp_vectorcall;

/* Unused, kept for backwards compatibility in CPython 3.8 only */

@vstinner vstinner Jun 19, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Please mention that it will be removed from Python 3.8. You may add "bpo-37250: " prefix.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/_testcapimodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@jdemeyer
Use Py_DEPRECATED(3.8) macro but not in _testcapimodule.c
99f11a1
vstinner
vstinner reviewed Jun 19, 2019
View reviewed changes
Comment thread Include/pyport.h Outdated
* Py_DEPRECATED(3.4) typedef int T1;
* Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);
*/
#ifndef Py_DEPRECATED

@vstinner vstinner Jun 19, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Why do you modify pyport.h?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner Jun 19, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

IMHO it's fine if compiling _testcapimodule.c emits a deprecation warning. If it becomes an issue, we can just remove the test.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jdemeyer jdemeyer Jun 19, 2019

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

IMHO it's fine if compiling _testcapimodule.c emits a deprecation warning.

The more warnings are shown, the less value there is in those warnings. A single warning during compilation stands out, an additional warning in between many not. So we should strive for compiling CPython without any warnings.

If it becomes an issue, we can just remove the test.

I think that's the worst solution. We typically test deprecated functionality in pure Python modules, why shouldn't we test deprecated C API?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ncoghlan ncoghlan Jun 21, 2019

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reading https://stackoverflow.com/questions/13459602/how-can-i-get-rid-of-deprecated-warnings-in-deprecated-functions-in-gcc/ suggests there are a few ways we can go here:

  1. Mark the _testcapi init function itself as deprecated, so compilers won't care that it accesses deprecated symbols.
  2. Start defining compiler specific _Py_PUSH_PRAGMA_IGNORE_DEPRECATION_WARNINGS and _Py_POP_PRAGMA macros and use those to selectively silence compiler warnings
  3. Use the testcapi warnings to check that deprecated C APIs actually are deprecated (doing that long term might involve pulling out a separately compiled module for those though, so we can more easily distinguish them from actual warnings in the main interpreter and standard library build process)

For right now, I'd suggest seeing if the warning goes away if you mark the testcapi module's init function as deprecated.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jdemeyer
Re-enable deprecation warning during compilation of _testcapimodule
101163c
scoder
scoder approved these changes Jun 24, 2019
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Jun 24, 2019
willingc
willingc approved these changes Jun 25, 2019
View reviewed changes

@willingc willingc left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks @jdemeyer. This looks good to me. @encukou @ncoghlan Do one of you wish to review and merge?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
encukou
encukou approved these changes Jun 25, 2019
View reviewed changes
@encukou

encukou commented Jun 25, 2019

Copy link
Copy Markdown
Member

Will do. Thanks to everyone involved!

willingc reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou
encukou merged commit d917cfe into python:3.8 Jun 25, 2019
@bedevere-bot bedevere-bot removed the awaiting merge label Jun 25, 2019
@jdemeyer
jdemeyer deleted the define_tp_print branch June 25, 2019 11:39
@bryanwweber bryanwweber mentioned this pull request Dec 10, 2019
Fix building for Python 3.8 Cantera/cantera#765
Merged
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@ncoghlan ncoghlan ncoghlan left review comments
@encukou encukou encukou approved these changes
@scoder scoder scoder approved these changes
@willingc willingc willingc approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@jdemeyer @ncoghlan @encukou @vstinner @scoder @willingc @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.