Skip to content

bpo-28866: No type cache for types with specialized mro, invalidation is hard. - #13157

Merged
markshannon merged 7 commits into
python:masterfrom
JulienPalard:issue28866-alternative
May 26, 2019
Merged

markshannon merged 7 commits into
python:masterfrom
JulienPalard:issue28866-alternative

Conversation

@JulienPalard

@JulienPalard JulienPalard commented May 7, 2019 •

Copy link
Copy Markdown
Member
Comment thread Objects/typeobject.c Resolved
Comment thread Objects/typeobject.c Resolved
Comment thread Objects/typeobject.c
_Py_IDENTIFIER(mro);
int unbound;
PyObject *mro_meth = lookup_maybe_method(
(PyObject *)type, &PyId_mro, &unbound);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mro_meth needs to be checked for NULL before lookup_maybe_method is called again.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

OK :-] is using a goto legit here? It'll avoid a bunch of if (clear == 0) (see current impl).

Comment thread Objects/typeobject.c Resolved
@markshannon markshannon self-assigned this May 26, 2019
@markshannon

Copy link
Copy Markdown
Member

LGTM

@markshannon
markshannon merged commit 180dc1b into python:master May 26, 2019
@bedevere-bot

Copy link
Copy Markdown

@markshannon: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @JulienPalard for the PR, and @markshannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-13589 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 26, 2019
… is hard. (pythonGH-13157)

* No type cache for types with specialized mro, invalidation is hard.

* FIX: Don't disable method cache custom types that do not implement mro().

* fixing implem.

* Avoid storing error flags, also decref.

* news entry

* Clear as soon as we're getting an error.

* FIX: Reference leak.
(cherry picked from commit 180dc1b)

Co-authored-by: Julien Palard <julien@palard.fr>
miss-islington added a commit that referenced this pull request May 26, 2019
…dation is hard. (GH-13157) (GH-13589)

* No type cache for types with specialized mro, invalidation is hard.

* FIX: Don't disable method cache custom types that do not implement mro().

* fixing implem.

* Avoid storing error flags, also decref.

* news entry

* Clear as soon as we're getting an error.

* FIX: Reference leak.
(cherry picked from commit 180dc1b)


Co-authored-by: Julien Palard <julien@palard.fr>


https://bugs.python.org/issue28866
@JulienPalard
JulienPalard deleted the issue28866-alternative branch June 16, 2019 14:05
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
… is hard. (python#13157)

* No type cache for types with specialized mro, invalidation is hard.

* FIX: Don't disable method cache custom types that do not implement mro().

* fixing implem.

* Avoid storing error flags, also decref.

* news entry

* Clear as soon as we're getting an error.

* FIX: Reference leak.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants