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 — bpo-1635741: Port _bz2 extension module to multiphase initialization(PEP 489) by shihai1991 · Pull Request #18050 · python/cpython

bpo-1635741: Port _bz2 extension module to multiphase initialization(PEP 489) #18050

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.

Sign up for GitHub

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

Merged
miss-islington merged 5 commits into python:master from shihai1991:bpo_1635741_6
Feb 18, 2020

Uh oh!

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

Merged

bpo-1635741: Port _bz2 extension module to multiphase initialization(PEP 489) #18050

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
5 commits
Select commit Hold shift + click to select a range
d32f9fb
Port _bz2 extension module to multiphase initialization(PEP 489)
shihai1991 Jan 18, 2020
0f39ac1
📜🤖 Added by blurb_it.
blurb-it[bot] Jan 18, 2020
7d93f28
Merge remote-tracking branch 'origin/master' into bpo_1635741_6
shihai1991 Feb 17, 2020
37b8d32
Fix refleaks of _bz2
shihai1991 Feb 17, 2020
264d51a
Merge branch 'bpo_1635741_6' of https://github.com/shihai1991/cpython…
shihai1991 Feb 17, 2020
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view

There are no files selected for viewing

1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Core and Builtins/2020-01-18-11-06-28.bpo-1635741.OKROOt.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Port _bz2 extension module to multiphase initialization (:pep:`489`).
56 changes: 35 additions & 21 deletions 56 Modules/_bz2module.c
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,45 @@ static PyTypeObject BZ2Decompressor_Type = {

/* Module initialization. */

static int
_bz2_exec(PyObject *module)
{
if (PyType_Ready(&BZ2Compressor_Type) < 0) {
return -1;
}
if (PyType_Ready(&BZ2Decompressor_Type) < 0) {
return -1;
}

Py_INCREF(&BZ2Compressor_Type);
if (PyModule_AddObject(module, "BZ2Compressor",
(PyObject *)&BZ2Compressor_Type) < 0) {
Py_DECREF(&BZ2Compressor_Type);
return -1;
}

Py_INCREF(&BZ2Decompressor_Type);
if (PyModule_AddObject(module, "BZ2Decompressor",
(PyObject *)&BZ2Decompressor_Type) < 0) {
Py_INCREF(&BZ2Decompressor_Type);
return -1;
}

return 0;
}

static struct PyModuleDef_Slot _bz2_slots[] = {
{Py_mod_exec, _bz2_exec},
{0, NULL}
};

static struct PyModuleDef _bz2module = {
PyModuleDef_HEAD_INIT,
"_bz2",
NULL,
-1,
NULL,
0,
NULL,
_bz2_slots,
NULL,
NULL,
NULL
Expand All @@ -743,23 +775,5 @@ static struct PyModuleDef _bz2module = {
PyMODINIT_FUNC
PyInit__bz2(void)
{
PyObject *m;

if (PyType_Ready(&BZ2Compressor_Type) < 0)
return NULL;
if (PyType_Ready(&BZ2Decompressor_Type) < 0)
return NULL;

m = PyModule_Create(&_bz2module);
if (m == NULL)
return NULL;

Py_INCREF(&BZ2Compressor_Type);
PyModule_AddObject(m, "BZ2Compressor", (PyObject *)&BZ2Compressor_Type);

Py_INCREF(&BZ2Decompressor_Type);
PyModule_AddObject(m, "BZ2Decompressor",
(PyObject *)&BZ2Decompressor_Type);

return m;
return PyModuleDef_Init(&_bz2module);
}
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 01402520 — 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.