Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-43916: PyStdPrinter_Type uses Py_TPFLAGS_DISALLOW_INSTANTIATION#25749

Merged
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:stdprinterCopy head branch name to clipboard
Apr 30, 2021
Merged

bpo-43916: PyStdPrinter_Type uses Py_TPFLAGS_DISALLOW_INSTANTIATION#25749
vstinner merged 1 commit into
python:masterpython/cpython:masterfrom
vstinner:stdprinterCopy head branch name to clipboard

Conversation

@vstinner

@vstinner vstinner commented Apr 30, 2021

Copy link
Copy Markdown
Member

The PyStdPrinter_Type type now uses the
Py_TPFLAGS_DISALLOW_INSTANTIATION flag to disallow instantiation,
rather than seting a tp_init method which always fail.

Write also unit tests for PyStdPrinter_Type.

https://bugs.python.org/issue43916

The PyStdPrinter_Type type now uses the
Py_TPFLAGS_DISALLOW_INSTANTIATION flag to disallow instantiation,
rather than seting a tp_init method which always fail.

Write also unit tests for PyStdPrinter_Type.
@vstinner

Copy link
Copy Markdown
Member Author

The funny part is that technically, Py_TPFLAGS_DISALLOW_INSTANTIATION or setting tp_new explicitly to NULL are not needed.

Since it's a static type, tp_new is NULL and tp_base is NULL, it gets Py_TPFLAGS_DISALLOW_INSTANTIATION flag automatically.

cc @erlend-aasland

@erlend-aasland

Copy link
Copy Markdown
Contributor

I'll have a look as soon as possible! Offline again :)

@vstinner vstinner merged commit 4908fae into python:master Apr 30, 2021
@vstinner vstinner deleted the stdprinter branch April 30, 2021 12:56
@vstinner

Copy link
Copy Markdown
Member Author

I merged my PR, but you can still review the merged change ;-)

@erlend-aasland

Copy link
Copy Markdown
Contributor

LGTM 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.