Skip to content

pymodule: tidy up module init#1630

Merged
messense merged 2 commits intoPyO3:mainfrom
davidhewitt:module-init
May 26, 2021
Merged

pymodule: tidy up module init#1630
messense merged 2 commits intoPyO3:mainfrom
davidhewitt:module-init

Conversation

@davidhewitt
Copy link
Member

@davidhewitt davidhewitt commented May 25, 2021

Three small tweaks:

  • Remove PyModuleDef_INIT symbol.
  • Set module __doc__ via m_doc def member rather than with a setattr() call.
  • Don't bother calling ffi::PyEval_InitThreads() - as far as I can tell this isn't necessary (even on Python 3.6).

@@ -312,14 +321,8 @@ impl ModuleDef {
#[cfg(not(Py_3_7))]
ffi::PyEval_InitThreads();
Copy link
Member

Choose a reason for hiding this comment

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

Missing a unsafe block here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I don't think this call to PyEval_InitThreads is needed at all. Pushed a commit to remove it, and updated the OP.

@davidhewitt davidhewitt force-pushed the module-init branch 2 times, most recently from 85092f0 to 3e87ea3 Compare May 25, 2021 21:51
Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

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

LGTM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants